Jump to content
Macro Express Forums

Problem with IF Message


tpiper

Recommended Posts

I have a situation that requires that a window remains open if the user hits “yes” and closes either if they hit “no”, or if nothing is typed into the If Message dialog box within a certain length of time. I can make this work if the default button is “no”, but the user wants the default to be yes so that they don’t inadvertently close the program by hitting enter.

 

I’ve also tried inserting an If Window on Top command to look for the IF Message dialog box still being open after "X" seconds but that didn't work either.

 

I know there’s probably a simple solution but I’m fairly new at this and can’t seem to get my head around the logic. Also, is there possibly another way to go beside using the If Message dialog box?

 

Thanks for any help!

 

Tom

Link to comment
Share on other sites

If I understand correctly then you want something like this:

Activate or Launch: "notepad" OR "notepad.exe"
Wait For Window Title: "notepad"

If Message: "Do you want to leave Notepad open?"
Else
 Window Close: "notepad"
End If

 

Copy this code and paste it into a new macro:

<LAUNCHYES3:0:0112notepad<LAUNCH:notepad.exe><WAITWIN2:000010:000000:notepad><REM2:><IFMESS3:00005:1:1:Do you want to leave Notepad open?Do you want to leave Notepad open?Center:Center><ELSE><WCLS:notepad><ENDIF>

Link to comment
Share on other sites

Kevin, yes except I also need the window to close if there is no user response at all.

 

Tom

 

If I understand correctly then you want something like this:
Activate or Launch: "notepad" OR "notepad.exe"
Wait For Window Title: "notepad"

If Message: "Do you want to leave Notepad open?"
Else
 Window Close: "notepad"
End If

 

Copy this code and paste it into a new macro:

<LAUNCHYES3:0:0112notepad<LAUNCH:notepad.exe><WAITWIN2:000010:000000:notepad><REM2:><IFMESS3:00005:1:1:Do you want to leave Notepad open?Do you want to leave Notepad open?Center:Center><ELSE><WCLS:notepad><ENDIF>

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...