Cancel Input Doesn't Cancel Macro?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Dexter1
Pro Scripter
Posts: 64
Joined: Mon Jun 19, 2006 3:28 pm

Cancel Input Doesn't Cancel Macro?

Post by Dexter1 » Wed Apr 04, 2007 10:43 pm

The first thing my macro does is ask for Input> from the user. Hitting Cancel simply skips that step of the process, though. Can I get Cancel to end the macro?
Thanks,
Josh

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Thu Apr 05, 2007 12:32 am

How about testing the variable returned by Input> and if it's blank then jump to the end of the macro like:

Input>mydata,Please input a value,
If>mydata=,finish,continue
Label>continue
MessageModal>%mydata%
//do other stuff
Label>finish
MessageModal>The End

If that idea won't work for you then please post your script.

Dexter1
Pro Scripter
Posts: 64
Joined: Mon Jun 19, 2006 3:28 pm

Post by Dexter1 » Thu Apr 05, 2007 3:00 pm

Hmmm. Maybe I'm applying this incorrectly; I have never used Label before. There is more to my code than posted here, but it's just variations on the theme to handle the different check boxes.

Let>Input_Browse=0
Input>Email, Enter Email Addresses
If>%Email%=,finish,continue
Label>Continue

Dialog>Dialog3
Caption=Dialog3
Width=289
Height=246
Top=104
Left=16
Label=Select a database to distribute.,32,8,true
CheckBox=msCheckBox1,Clarify Research,32,24,97,False
CheckBox=msCheckBox2,OA Change,32,72,97,False
Button=OK,192,8,75,25,5
CheckBox=msCheckBox3,Prodcution Training,32,120,129,False
CheckBox=msCheckBox4,Ship Short,32,168,105,False
CheckBox=msCheckBox5,PMO Data Entry,32,96,97,False
CheckBox=msCheckBox6,Quality Training,32,144,97,False
CheckBox=msCheckBox7,SOA Millennium Reports,32,192,137,False
CheckBox=msCheckBox8,Internal Audit,32,48,97,False
EndDialog>Dialog3

Show>dialog3,r3

If>r3=2,finish
If>%Dialog3.mscheckbox1%=True
Let>SaveClarifyResearchVariableForLaterUse=True
Else
Let>SaveClarifyResearchVariableForLaterUse=False
EndIf

If>%SaveClarifyResearchVariableForLaterUse%=True
Let>SendMail_Status=1
Let>Subject=Clarify Research Database Installation
Let>me=[email protected]
Let>MyName=Josh
Let>Recipients=%Email%
Let>body=Follow these instructions to install the attached Clarify Research database.%CRLF%%CRLF%1. Delete any shortcuts to the Clarify Research database you may have on your desktop.%CRLF%2. 1. Open the attached .zip file.%CRLF%3. In the WinZip window, double-click the .bat file.%CRLF%4. A black window will open, please be patient and let it close on its own.%CRLF%5. Once the black window closes go to My Computer > C:\ >scrub.%CRLF%6. In the folder scurb right-click on prd_scrub_xp.bat and select Send to > Desktop (create shortcut).%CRLF%%CRLF%You will then have the database ready to use on your desktop.Please feel free to contact me with any questions or difficulties.%CRLF%%CRLF%Thanks,%CRLF%Josh%CRLF%x1234
Let>Attachments=\\Storage_Location\Setup_PRD_xp.zip

SMTPSendMail>recipients,emailserver.com,me,myname,subject,body,attachments
MDL>The Clarify Research database was sent to %email%
EndIf

Label>Finish
Thanks,
Josh

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Apr 05, 2007 3:08 pm

Let's trace this out:

Input>Email, Enter Email Addresses
If>%Email%=,finish,continue
Label>Continue

Ok, if finish = continue it is easy to see what happens here. Now let's see what happens if finish is NOT continue:

Input>Email, Enter Email Addresses
If>%Email%=,finish,continue
//finish was not continue so we just carry on
Label>Continue
//now we are here
..
..

So whatever the value of finish you get the same outcome. You've said (if finish is continue jump to the next line, if it is not continue we just carry on, which is Label>Continue anyway). Scripts read one line at a time

This is what you really want:

If>%EMAIL%=finish
..
.. your code here
..
Endif

Or:

If>%EMAIL%=finish,continue
Goto>end
Label>continue

...
Label>end

Or:

If>%EMAIL%=finish,continue,end
Label>continue
..
.. your code
..
Label>end

Read it one line at a time. Read the logic. You can see the paths it leads depending on the value.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
JRL
Automation Wizard
Posts: 3505
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Apr 05, 2007 3:28 pm

Marcus -- you've misread the code, there is a comma between %Email%= and finish.

Josh the problem is that labels are case sensitive. Your line:

If>%Email%=,finish,continue

Is looking for a label with all lower case characters. At the end of your script is the label Label>Finish with an upper case "F".

You have the same issue with the continue/Continue label.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Apr 05, 2007 3:33 pm

Oops. Sorry, you're right. Oh well, hopefully my post helps by offering some other options anyway.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts