Sign in to follow this  
Followers 0
ct253704

And operator in a switch

5 posts in this topic

This simple script is giving me issues. All I want to happen, if the checkbox is checked, is for BOTH the messagebox to appear with the CD-KEY in it AND the install file to run at the same time. This returns the Multi-line IF missing Then error in this format, but I've tried a lot of different approaches and can't seem to get them both to run at the SAME time. I can either get the message box first and then the program won't run until it's closed or the message box second after the program is installed. However, I need to enter the key before the program finishes installing so I would like them both to open at the same time. 

Switch $EchoValue
 Case $GUI_CHECKED
 Local $EchoExists = FileExists ("\\fileserver01\disks\Echo\Echo_Upgrade_112613\9.1.2.4\Install_EchoWorkstation_912.msi") 
  If $EchoExists = 1 Then MsgBox (0, "ECHO CD-Key", "###-####-###") And ShellExecuteWait("\\fileserver01\disks\Echo\Echo_Upgrade_112613\9.1.2.4\Install_EchoWorkstation_912.msi")
  If $EchoExists = 0 Then MsgBox (0, "ECHO", "ECHO Executable Missing! Check server connection.")
EndSwitch

I've tried using 2 variables as well and doing the IF AND IF THEN ELSE combo and can't seem to make it work that way either. Suggestions?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You'll need to have two scripts if you want two actions to occur at the same time (at least that is my understanding).

EDIT: Shows my understanding ;) Go Melba and DarthCookieMonster!

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

ct253704,

Use a SplashTextOn dialog or my Toast UDF (look in my sig for the link) - both of those will allow you to keep the dialog visible while the script continues. :)

M23

Edited by Melba23
Wrong UDF!

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

This simple script is giving me issues. All I want to happen, if the checkbox is checked, is for BOTH the messagebox to appear with the CD-KEY in it AND the install file to run at the same time. This returns the Multi-line IF missing Then error in this format, but I've tried a lot of different approaches and can't seem to get them both to run at the SAME time. I can either get the message box first and then the program won't run until it's closed or the message box second after the program is installed. However, I need to enter the key before the program finishes installing so I would like them both to open at the same time. 

Switch $EchoValue
 Case $GUI_CHECKED
 Local $EchoExists = FileExists ("\\fileserver01\disks\Echo\Echo_Upgrade_112613\9.1.2.4\Install_EchoWorkstation_912.msi") 
  If $EchoExists = 1 Then MsgBox (0, "ECHO CD-Key", "###-####-###") And ShellExecuteWait("\\fileserver01\disks\Echo\Echo_Upgrade_112613\9.1.2.4\Install_EchoWorkstation_912.msi")
  If $EchoExists = 0 Then MsgBox (0, "ECHO", "ECHO Executable Missing! Check server connection.")
EndSwitch

I've tried using 2 variables as well and doing the IF AND IF THEN ELSE combo and can't seem to make it work that way either. Suggestions?

You "could" do this:

1. make a script that only has the message in it.

2. Change your script to this:

Switch $EchoValue
 Case $GUI_CHECKED
 Local $EchoExists = FileExists ("\\fileserver01\disks\Echo\Echo_Upgrade_112613\9.1.2.4\Install_EchoWorkstation_912.msi") 
  If $EchoExists = 1 Then 
     RUN("message.exe") ;message is displayed and the ShellExcuteWait line will also run without delay
     ShellExecuteWait("\\fileserver01\disks\Echo\Echo_Upgrade_112613\9.1.2.4\Install_EchoWorkstation_912.msi")
endif
  If $EchoExists = 0 Then MsgBox (0, "ECHO", "ECHO Executable Missing! Check server connection.")
EndSwitch
Edited by DarthCookieMonster

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Both good suggestions, thank you guys. I ended up using splashtext simply because I like fewer files and I had never used that option before (it's awesome!) so I wanted to toy with it. Thanks for the help another problem solved.

Edit: Added final working switch

Switch $EchoValue
 Case $GUI_CHECKED
 SplashTextOn ("ECHO CD-Key", "###-####-###", 300, 75, -1, -1, 50, "", 12, -1)
 Local $EchoExists = FileExists ("\\fileserver01\disks\Echo\Echo_Upgrade_112613\9.1.2.4\Install_EchoWorkstation_912.msi") 
  If $EchoExists = 1 Then ShellExecuteWait("\\fileserver01\disks\Echo\Echo_Upgrade_112613\9.1.2.4\Install_EchoWorkstation_912.msi")
  If $EchoExists = 0 Then MsgBox (0, "ECHO", "ECHO Executable Missing! Check server connection.")
 SplashOff ()
EndSwitch
Edited by ct253704

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0