mIRC Home    About    Download    Register    News    Help

Print Thread
#232494 07/06/11 01:33 AM
Joined: Jun 2011
Posts: 4
F
Self-satisified door
OP Offline
Self-satisified door
F
Joined: Jun 2011
Posts: 4
Not sure if this would be considered as a bug, but I am finding that scripts that attempt to process information from the clipboard (in my case - highlighting a page of around 629 lines and processing each line in a while loop to check for certain elements and add matching lines to a window) seem to lose access to the clipboard briefly..

I put an echo before an after a while loop that checked if a word matched the 2nd token in each clipboard line, adding each matching line to a new window, and the echos before and after posted the starting variable (%a = 1) and the total number of lines in the clipboard ( $cb(0) ).. I got the following response:

before loop - while 1 <= 629
after loop with 173 <=

checking the clipboard afterward and it reports 629 lines still there, and I can read individual lines still.

I have since created a custom identifier to throw the contents of the clipboard into a window and the script then refers to that window instead of the clipboard, and this not only seems to resolve the issue but makes the script run a lot faster. Is it possible for mIRC to either work better with the clipboard or at grab its contents as a whole more easily for scripts to process?

Windows 7 H.P. - Mirc 7.15 - 4GB ram, 3ghz quad - 64bit OS

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
There was a post a month or so ago regarding this same sort of behavior. If I remember correctly, it's an issue with Windows accessing the clipboard at high speeds.


Invision Support
#Invision on irc.irchighway.net
Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
My little work around:

Code:
;This line tells mIRC to play data in clipboard into the command "noop"
;The reason I do this is to force mIRC to save the text in clipboard to a file
/play -bas noop 100

;This retrieves the qued play file that the clipboard text *should* be in[see bottom]
var %f = $findfile($mircdir,playq*.txt,$findfile($mircdir,playq?.txt,0,0),0)

;%f contains the file
;Do stuff with file

/play stop



Two know "bugs" with this:
1) If there is a file in your mIRC dir that matches playq?.txt it COULD mess the finding of the clipboard file up
2) this will stop ALL /play requests.


I am SReject
My Stuff
Joined: Jun 2011
Posts: 4
F
Self-satisified door
OP Offline
Self-satisified door
F
Joined: Jun 2011
Posts: 4
bearing in mind this is something I just threw together last minute as a workaround - I used the following:

Code:
alias cb {
  if ($cb(0) > 1) || ($cb(1)) {
    window -c @cb
    window -an @cb
    var %a = 1
    var %b = $cb(0)
    while (%a <= %b) {
      if ($cb(%a)) { aline @cb $cb(%a) }
      else { aline @cb $crlf }
      inc %a
    }
    clipboard -n
  }
  if ($1 == 0) { return $line(@cb,0) }
  else { return $line(@cb,$1) }
}


this then allows $.cb(n) to work as $cb(n) would. can choose to have the @cb window hidden or not (I like it visible so I can keep an eye on it smile

Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
Could you post the script used to reproduce the bug, with the actual content of the clipboard when the bug occurs ? Describing the problem is fine, but it could very well be a problem in the code and if not, it would greatly help anyway


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Ok, I looked up that post. It wasn't a Windows issue specifically, but still something outside of mIRC. Here it is in case it helps you to find where the problem is.


Invision Support
#Invision on irc.irchighway.net
Wims #232536 08/06/11 01:41 PM
Joined: Jun 2011
Posts: 4
F
Self-satisified door
OP Offline
Self-satisified door
F
Joined: Jun 2011
Posts: 4
I've done a few tests with it and found some further information about the problem.. the main test code I used was:

Code:
alias cbtest {

  var %a = 1
  echo starting with: $cb(0) lines in the clipboard
  while (%a <= $cb(0)) {
    var %b = $cb(%a)
    var %c = $sorttok(%b,32,a)
    inc %a
  }
  echo ending with: $cb(0) lines in the clipboard

  .timerclip 1 1 echo now with $!cb(0) lines in the clipboard
}


I also tried a similar code which had while ($cb(0)) { echo lines $cb(0) } which also halted under the same conditions below. (I have not included the full sample of this code as it will cause an endless loop if it passes)

the issue seems to be dependent on how quickly the script is triggered after the clipboard is filled - typically a couple of seconds or so from what I can see..

I highlighted/copied a page with ~628 lines of text and if I tried the script within a second or two of copying the text, it would end the loop prematurely.

I found with a timer 1 0, it still reported the clipboard as being empty, but timer 1 1 showed the full clipboard once again.

it triggers randomly so there is no particular point in the clipboard contents that it stops..

as to the content, I have tried a number of different sources, and I can only guess it is only affected by mixed content (text and images - ie from a webpage) - I tried my facebook wall as a sample and that caused the trigger, but other text only content of varying sizes did not.


Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
I tried that code, copying the whole versions.txt into the clipboard, it works perfectly for me, there's clearly something wrong with you, are you sure you don't have the same kind of problem as Horstl in Riamus2's link ?


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #232546 08/06/11 11:21 PM
Joined: Jun 2011
Posts: 4
F
Self-satisified door
OP Offline
Self-satisified door
F
Joined: Jun 2011
Posts: 4
as I said, I think it may be linked to mixed content, plain text is also fine for me but for example a facebook wall page (which has images and text, where I am only interested in the text ofc) can cause the problem

Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
I also tried a whole facebook page, images are ignored in this case.
You should try running a clean mIRC 7.19 and see if this still happen and you could also try closing program/process that are not important and see if it's not one of them that cause the problem


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard