WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: snowsnowsnow on March 23, 2016, 10:52:07 AM

Title: And old, old bug - has it been fixed in current versions? (IC54)
Post by: snowsnowsnow on March 23, 2016, 10:52:07 AM
(I think this is a reprise of an old thread - but I can't quite remember the outcome of that, hence the posting anew...)

In 10 year old versions of WB, there is a bug in IC54 (aka, WindowOnTop) where the window that you "on-topping" has to exist at the moment when the IC is executed.  That is, unlike most/all other functions that take a window title, it doesn't wait the usual 9 seconds for the window to appear.  I.e., if you execute:

Code (winbatch) Select
IntControl(54,"~Notepad",1,0,0)

and there is no Notepad window open, it will fail immediately (instead of waiting 9 seconds and then failing - that is, if the window doesn't appear in the 9 second window).  Note that a workaround for this bug is:

Code (winbatch) Select
IntControl(54,WinIdGet("~Notepad"),1,0,0)

My question is: Is this fixed in current versions of either IC54() and/or WindowOnTop() ?
Title: Re: And old, old bug - has it been fixed in current versions? (IC54)
Post by: td on March 23, 2016, 01:25:51 PM
You will still need your 'workaround'.   Will add it to 'The List' as a user request.
Title: Re: And old, old bug - has it been fixed in current versions? (IC54)
Post by: snowsnowsnow on March 24, 2016, 02:05:49 PM
Thanks.

And here's another question - that you still see if somehow related to the above question.

In IC(46), what are the limits on the p1 parameter?  This is the IC that changes the "9 second" wait.
The docu says that -1 means no change (just return the current value), but are there any other "special" values?  I'm assuming that 0 means "Don't wait at all", but note that often 0 means "wait forever".

FWIW, in my code, I use IC(46,99999,0,0,0), figuring that 99999 is pretty close to "forever", but again, this looks weird/hacky...
Title: Re: And old, old bug - has it been fixed in current versions? (IC54)
Post by: td on March 24, 2016, 03:11:42 PM
No other intentionally special values and zero means just try once then quit but you probably shouldn't set it to an integer greater than maximum 32-bit signed integer divided by 10 (214,748,364).   Some function take anything bigger to mean the same thing as zero.  Of course  setting it to 214,748,364 would consume the better part of a year in most cases, if the target wasn't found.
Title: Re: And old, old bug - has it been fixed in current versions? (IC54)
Post by: td on March 24, 2016, 03:15:38 PM
Actually, more like 6 years...