Jump to content
Macro Express Forums

Boolean argument not working


Recommended Posts

So I have this loop that tests if a window exists by setting the boolean to true/false.

 

The dialog box for setting up the 'If Window' Boolean argument allows for two considerations, 'If the window does not exist', and 'if the window is not focused'. Both scenarios would apply to my problem.

 

So I set the target window title using the "browse" button, with partial match criteria.

 

If the specified window does not exist, then it should return true to the WindExists Variable. The loop agrument is waiting for WindExists == TRUE.

 

Howeeeeeever.... I start the loop up, then close the target window as a test. The macro keeps merrily looping away. What gives? The Boolean value being sent to WindExists Variable is remaining FALSE despite the fact the window is gone and it should return TRUE? The program in question is a java program called Image Viewer. Other macro commands work for this, such as the 'Wait for window title to lose focus'. No problem with that, however, this isn't how I want to set up the detection process, and I shouldn't have to given the boolean test loop SHOULD work.

 

Any ideas from the smarter crowd?

 

<REPEAT UNTIL Variable="%WindExist%" Condition="\x00" Value="TRUE"/>
<VARIABLE SET BOOL Destination="%WindExist%" Command="148" Option="\x01" Title="Image Viewer" Partial="TRUE" Wildcards="FALSE"/>
<END REPEAT/>
<TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 Window is GONE, GONE, GONE!\r\n\\par %WindExist%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>

Link to comment
Share on other sites

<VARIABLE SET BOOL Destination="%WindExist%" Command="148" Option="\x01" Title="Image Viewer" Partial="TRUE" Wildcards="FALSE"/>

This appears to be broken and you should report it to ISS as a bug. I opened Notepad and ran this command and it come s back as True and it should be False. Unless I'm really missing something here.

Link to comment
Share on other sites

Almost forgot. You should insert at least some small delay in your loop. 200mS should work.

 

BTW: don't' try and disable the first line in your script. For me it crashes the scripting editor every time.

Link to comment
Share on other sites

Okey doke, I sent along a bug report regarding this, I know I should have the delay... was just lazy. B) Delay was in the main macro but not in the smaller test macro I set up to try and troubleshoot this issue.

 

BTW: don't' try and disable the first line in your script. For me it crashes the scripting editor every time.

Hey, was this just unrelated advice or something you saw in the code/post I submitted? I am leaning towards the former in which case, good to know... haha

Link to comment
Share on other sites

Hey, was this just unrelated advice or something you saw in the code/post I submitted? I am leaning towards the former in which case, good to know... haha
I discovered it while testing your macro so it's not really related to the bug you found but something else. However it is 'related' in that you might have run into the same issue.
Link to comment
Share on other sites

Almost forgot. You should insert at least some small delay in your loop. 200mS should work.

 

BTW: don't' try and disable the first line in your script. For me it crashes the scripting editor every time.

Hey Cory,

 

I've ahd the same experience (just once, and thought it had something to do with the particular command). If you get me the bug report number, I'll submit my example referencing it.

Link to comment
Share on other sites

<VARIABLE SET BOOL Destination="%WindExist%" Command="148" Option="\x01" Title="Image Viewer" Partial="TRUE" Wildcards="FALSE"/>

This appears to be broken and you should report it to ISS as a bug. I opened Notepad and ran this command and it come s back as True and it should be False. Unless I'm really missing something here.

 

I get the same. It seems that it's reversed. (Maybe so for other entries too.)

 

I also don't see why the command is designed (for example) to return TRUE for If the Window Does Not Exist, which seems counter-intuitive to me.

 

BTW, while working on this simple macro, I managed to lose the command dialog box. So that when I returned to Script Editor (from composing this message in Firefox) it was as if ME Pro had frozen. It was exactly the same as I described in a separate post earlier today, http://pgmacros.invisionzone.com/index.php?showtopic=3788

 

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

Great, thanks Cory.

 

Just a heads-up to everybody else who might read this: The crash happens when disabling the "Repeat Start" line of a Repeat Loop, but seems to only happen when the Start is on Line 1.

 

I'm putting that into the bug report as well.

Not to beat a dead horse, but since I've already got the club drawn...

 

I just had this crash when disabling an If command. So it's apparently not limited to Repeat loops, but potentially any set of commands that have a start and end to them (I have not attempted it with a Text File Process, but it looks like this may also cause a crash. I'll test it and post an Edit.

 

EDIT

Confirmed: The crash occurs with both Text File Process and ASCII File Process commands.

Link to comment
Share on other sites

I also don't see why the command is designed (for example) to return TRUE for If the Window Does Not Exist, which seems counter-intuitive to me.

 

Programming Semantics! :-) IF NOT EXISTS and TRUE were simply the default setting in the Boolean setup box, so I went with that, it was a simple test in a little loop. I just knew it would work anyhow and this is just a case of function trumping form! lol!

 

Maybe for a future release, all 'IF NOT' BOOLEAN conditions should change the default value to 'FALSE'?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...