AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

if (..) bug

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
Jerry



Joined: 24 Jun 2004
Posts: 39

PostPosted: Tue Mar 01, 2005 6:59 pm    Post subject: if (..) bug Reply with quote

I was attempting to find when the clipboard changes and I used the following code.
Code:
oldText = %clipboard%
oldHold := ClipBoardAll
StringLen , oldLen , oldHold

loop
 {
  sleep, 200
clipText = %clipboard%
clipHold := ClipBoardAll
StringLen , clipLen , ClipHold

if (oldHold <> clipHold OR oldLen <> clipLen OR oldText <> clipText)
   gosub clipchanged

oldHold := clipHold
oldtext = %cliptext%
oldLen = %clipLen%

}
exit
clipchanged:

msgbox,0,clipboard,clipboard changed
return


Anyway, the checking of oldHold <> clipHold does not seem to see a difference all the time. If the clipboard contents change, from one bitmap to another (pressing print scrn button on different windows) the change clipchanged routine does not get called.
Back to top
View user's profile Send private message
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Tue Mar 01, 2005 7:12 pm    Post subject: Reply with quote

ClipboardAll is meant to work with binary data and is not compatible with string operations like StringLen. Currently, it only works in specialized situations and was made to solve the problem of destructive clipboard opertaions. See the variables page for more info.
Back to top
View user's profile Send private message
Jerry



Joined: 24 Jun 2004
Posts: 39

PostPosted: Tue Mar 01, 2005 9:50 pm    Post subject: Reply with quote

Thanks Jonny,

I put in the strlen to help identify the length of the binary value hoping that the if would be satified. (if the bitmap changed in size it did help identify that it changed)

Originally the IF statement was only
if (oldHold <> clipHold)

Maybe I'm wrong here but since both variables are binary I would have expected a difference.
Back to top
View user's profile Send private message
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Tue Mar 01, 2005 9:57 pm    Post subject: Reply with quote

In truth, that's just a guess, but ClipboardAll is extremely young. It doesn't seem to be fully supported yet, either. Plus, it's kind of like adding entirely new functionality to AutoHotkey (storing binary data in variables), so new bugs should be expected. I'm just a pessimist about "Bug Reports" (you'd be surprised how many times its just a bad case of RTFM).
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Tue Mar 01, 2005 11:24 pm    Post subject: Reply with quote

Although you can't compare two "binary" variables, you can use StringLen on them. However, that's about the only string method that they currently support.

The next update will have the following in it. Thanks for the idea.
Quote:
Variables to which ClipboardAll has been assigned can be compared to each other (but not directly to ClipboardAll) with the <> and = operators. In the following example, the length of each variable is checked first. If that is not enough to make the determination, the contents are compared to break the tie:

if ClipSaved1 <> %ClipSaved2% ; This must be an old-style IF statement, not an expression.
MsgBox The two saved clipboards are different.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group