Bert Posted February 14, 2006 Share Posted February 14, 2006 I know I should know this....but I still get confused! I made a program that streamlines a program I have to use. I wanted to put in a safety check so that if the information was entered in wrong, the user could fix it. I tried to do this with a function and using a case statement inside it. The problem is, the script is getting stuck. To put it in pseudo code: 1. User puts in company code via input box 2. User puts in Cost center via input box 3. msgbox ask is the entries correct. If incorrect, starts again at step 1. If correct, goto step 4. 4. msgbox ask if you want to save input information from steps 1 and 2 5. If 4 is yes, saves data to AME.ini, then runs _deploy() 6. If 4 is no, runs _deploy() func _deploy() _inputCC() local $qst1 while 1 select case $qst1 = 7 $ccode= inputbox("Company code","Put in the company code the PC will be assigned to.", "", " M") $ccenter= inputbox("Cost Center","Put in the Cost Center the PC will be assigned to.", "", " M") case $qst1 = 6 $qst2=msgbox(4, "Save information?", "Do you want to save the Cost Center" & @CRLF _ &"and Bank number information?") if $qst2 = 6 then iniwrite("AME.ini","settings", "code", $ccode) iniwrite("AME.ini","settings", "center", $ccenter) _deploy2() endif if $qst2 = 7 then _deploy2() endselect wend endfunc func _inputCC() $ccode= inputbox("Company code","Put in the company code the PC will be assigned to.", "", " M") $ccenter= inputbox("Cost Center","Put in the Cost Center the PC will be assigned to.", "", " M") $qst1=msgbox(4, "Correct?", "Company code:"& $ccode &""& @CRLF &"Cost Center:"& $ccenter & @CRLF &""& @CRLF &"Is this correct?") endfunc If you need to see the entire script: CODE#Include <Constants.au3> #Include <GUIConstants.au3> AutoItSetOption("TrayIconDebug", 1) ;debug is on global $ccode global $ccenter $main_gui = guicreate("What do you want to do?", 235, 230, -1, -1, -1, $WS_EX_TOPMOST) $button1 = guictrlcreatebutton("1. Deploy new PC", 20, 20, 200, 30) $button2 = guictrlcreatebutton("2. Deploy new PC using saved data", 20, 70, 200, 30) $button3 = guictrlcreatebutton("3. DECOM PC", 20, 120, 200, 30) $button4 = guictrlcreatebutton("4. Run AME Manually", 20, 170, 200, 30) $menu=GUICtrlCreateMenu("&Options") $menuItem1=GUICtrlCreateMenuitem("&Tech ID", $menu) $menuItem2=GUICtrlCreateMenuitem("&Holding Site IP", $menu) $menuItem3=GUICtrlCreateMenuitem("Holding &Site Client RACF", $menu) $menuItem4=GUICtrlCreateMenuitem("Holding &Site Bank number", $menu) $menuItem5=GUICtrlCreateMenuitem("Holding &Site Cost Center", $menu) $menu2=GUICtrlCreateMenu("S&etup Wizard") $menuItemB1=GUICtrlCreateMenuitem("&Run Wizard", $menu2) if iniread("AME.ini","settings", "wizard", "") = 0 then $qst = msgbox(4, "Need help with the setup wizard?", "Do you wish to open the help file for AME?") _wizard() endif GUISetState() while 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $button1 ;new PC guidelete($main_gui) _deploy() Case $msg = $button2 ;saved guidelete($main_gui) _deploy3() Case $msg = $button3 ;Decom guidelete($main_gui) _decom() Case $msg = $button4 ;manually guidelete($main_gui) run("ARTool.exe") WinWaitActive("ARGIS made EASY - Ver: 1.115") winmove("ARGIS made EASY - Ver: 1.115", "Select a value",0,0) exit Case $msg = $menuItem1 GUISetState(@SW_HIDE, $main_gui) _techID() GUISetState(@SW_SHOW, $main_gui) Case $msg = $menuItem2 GUISetState(@SW_HIDE, $main_gui) _hold() GUISetState(@SW_show, $main_gui) Case $msg = $menuItem3 GUISetState(@SW_HIDE, $main_gui) _HSCR() GUISetState(@SW_show, $main_gui) Case $msg = $menuItem4 GUISetState(@SW_HIDE, $main_gui) _DeBN() GUISetState(@SW_show, $main_gui) Case $msg = $menuItem4 GUISetState(@SW_HIDE, $main_gui) _DeCC() GUISetState(@SW_show, $main_gui) Case $msg = $menuItemB1 GUISetState(@SW_HIDE, $main_gui) $qst=msgbox(4, "Need help?", "Do you wish to open the help file for AME?") _wizard() GUISetState(@SW_show, $main_gui) endselect wend func _wizard() if $qst = 6 then _help() _techID() _hold() _HSCR() _DeBN() _DeCC() iniwrite("AME.ini","settings", "wizard", 1) endfunc Func _techID() $id = inputbox("Your RACFid", "Enter your RACFid. This ID will be used when when AME is ran using buttons 1, 2, 3." & @CRLF _ &"" & @CRLF _ &"Button 1: Deploy new PC" & @CRLF _ &"Button 2: Deploy new PC using saved data" & @CRLF _ &"Button 3: DECOM PC", "", " M") iniwrite("AME.ini","settings", "Tech", $id) endfunc Func _hold() $holdSt = inputbox("Holding site IP","Enter the IP address of the holding site you use. If you are not sure of the IP, review the AME tool PFD file." & @CRLF _ &"" & @CRLF _ &"This setting will only be enforced while using button 3.", "", " M") iniwrite("AME.ini","settings", "HoldingSite", $holdSt) endfunc func _help() run( "C:\Program Files\Internet Explorer\IEXPLORE.EXE -new http://etiportal.suntrust.com/sites/cts/Ap...ytool.pdf", "") winwaitactive( "http://etiportal.suntrust.com/sites/cts/Applications/Argis_Made_Easy/argismadeeasytool.pdf", "http://etiportal.suntrust.com/sites/cts/Applications/Argis_Made_Easy/argismadeeasytool.pdf", "") endfunc Func _HSCR() $hscr = inputbox("Holding Site Client RACFid", "Enter in the RACFid of the client that the PC will be assigned to while the status of the asset is placed in Hold collection site. In most cases, this will be your RACFid. In some cases, a designated person is used, such as the team lead." & @CRLF _ &"" & @CRLF _ &"This setting will only be enforced while using button 3: DECOM PC", "", " M", -1, 220) iniwrite("AME.ini","settings", "holding", $hscr) endfunc Func _DeBN() $DEBN = inputbox("Holding Site Bank Number", "Enter in the Bank Number of the client that the PC will be assigned to while the status of the asset is placed in Hold collection site. In most cases, this will be your Bank Number. In some cases, your team lead will have a Bank Number they wish to have the asset assigned."& @CRLF _ &"" & @CRLF _ &"This setting will only be enforced while using button 3: DECOM PC", "", " M", -1, 220) iniwrite("AME.ini","settings", "DecomBN", $DEBN) endfunc Func _DeCC() $DECC = inputbox("Holding Site Cost Center", "Enter in the Cost Center of the client that the PC will be assigned to while the status of the asset is placed in Hold collection site. In most cases, this will be your Cost Center. In some cases, your team lead will have a Cost Center they wish to have tha asset assigned to." & @CRLF _ &"" & @CRLF _ &"This setting will only be enforced while using button 3: DECOM PC", "", " M", -1, 220) iniwrite("AME.ini","settings", "DecomCC", $DECC) endfunc func _deploy() _inputCC() local $qst1 while 1 select case $qst1 = 7 $ccode= inputbox("Company code","Put in the company code the PC will be assigned to.", "", " M") $ccenter= inputbox("Cost Center","Put in the Cost Center the PC will be assigned to.", "", " M") case $qst1 = 6 $qst2=msgbox(4, "Save information?", "Do you want to save the Cost Center" & @CRLF _ &"and Bank number information?") if $qst2 = 6 then iniwrite("AME.ini","settings", "code", $ccode) iniwrite("AME.ini","settings", "center", $ccenter) _deploy2() endif if $qst2 = 7 then _deploy2() endselect wend endfunc func _inputCC() $ccode= inputbox("Company code","Put in the company code the PC will be assigned to.", "", " M") $ccenter= inputbox("Cost Center","Put in the Cost Center the PC will be assigned to.", "", " M") $qst1=msgbox(4, "Correct?", "Company code:"& $ccode &""& @CRLF &"Cost Center:"& $ccenter & @CRLF &""& @CRLF &"Is this correct?") endfunc func _deploy2() run("ARTool.exe") BlockInput(1) WinWaitActive("ARGIS made EASY - Ver: 1.115") winmove("ARGIS made EASY - Ver: 1.115", "Select a value",0,0) sleep(30) mouseclick("left",220, 70,1,2) ;clicks Workstation Tab sleep(10) mouseclick("left",351, 295,1,2) Send("{BS 9}") $id1=iniread("AME.ini","settings", "Tech","") Send($id1) ;sleep(5000) mouseclick("left",220, 337,1,2) ;Active Send("{DOWN}") mouseclick("left",220, 217,1,2) ;cost center Send("{BS 10}") send($ccenter) mouseclick("left",220, 253,1,2) ;Company code Send("{BS 10}") Send($ccode) mouseclick("left",220, 575,1,2) ;add to update mouseclick("left",350, 45,1,2) ;clicks Argis update tab mouseclick("left",45, 112,3,2) ;clicks workstation "+" sign mousemove(220, 575, 2) ;moves mouse to "Submit to Argis" BlockInput(0) ;mouseclick("left",120,120) exit endfunc func _deploy3() run("ARTool.exe") BlockInput(1) WinWaitActive("ARGIS made EASY - Ver: 1.115") winmove("ARGIS made EASY - Ver: 1.115", "Select a value",0,0) sleep(30) mouseclick("left",220, 70,1,2) ;clicks Workstation Tab sleep(10) mouseclick("left",351, 295,1,2) Send("{BS 9}") $id1=iniread("AME.ini","settings", "Tech","") Send($id1) mouseclick("left",220, 337,1,2) ;Active Send("{DOWN}") mouseclick("left",220, 217,1,2) ;cost center Send("{BS 10}") $center=iniread("AME.ini","settings", "center","") send($center) mouseclick("left",220, 253,1,2) ;Company code $code=iniread("AME.ini","settings", "code","") Send("{BS 10}") Send($code) mouseclick("left",220, 575,1,2) ;add to update mouseclick("left",350, 45,1,2) ;clicks Argis update tab mouseclick("left",45, 112,3,2) ;clicks workstation "+" sign mousemove(220, 575, 2) ;moves mouse to "Submit to Argis" BlockInput(0) ;mouseclick("left",120,120) exit endfunc func _decom() run("ARTool.exe") BlockInput(1) WinWaitActive("ARGIS made EASY - Ver: 1.115") winmove("ARGIS made EASY - Ver: 1.115", "Select a value",0,0) sleep(30) mouseclick("left",239, 68,1,2) ;clicks Workstation Tab ;$macn=ControlGetText("ARGIS made EASY - Ver: 1.115", "Select a value",39) sleep(100) mouseclick("left",220, 217,1,2) ;cost center Send("{BS 15}") $BN=iniread("AME.ini","settings", "DecomCC","") Send($BN) mouseclick("left",350, 217,1,2) ;IP address Send("{BS 20}") $IPD=iniread("AME.ini","settings", "HoldingSite","") Send($IPD) mouseclick("left",220, 253,1,2) ;Company code Send("{BS 15}") $CC=iniread("AME.ini","settings", "DecomBN","") Send($CC) mouseclick("left",220, 295,1,2) ;client RACF Send("{BS 20}") $hold1=iniread("AME.ini","settings", "holding","") Send($hold1) mouseclick("left",220, 337,1,2) ;hold collection site Send("{DOWN 3}") mouseclick("left",220, 457,1,2) Send("TO BE DECOMMISSIONED") mouseclick("left",220, 575,1,2) ;add to update mouseclick("left",350, 45,1,2) ;clicks Argis update tab mouseclick("left",45, 112,3,2) ;clicks workstation "+" sign mousemove(220, 575, 2) ;moves mouse to "Submit to Argis" BlockInput(0) exit endfunc The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
GaryFrost Posted February 14, 2006 Share Posted February 14, 2006 Func _deploy() While 1 $ccode = InputBox("Company code", "Put in the company code the PC will be assigned to.", $ccode, " M") If @error Then Return $ccenter = InputBox("Cost Center", "Put in the Cost Center the PC will be assigned to.", $ccenter, " M") If @error Then Return $qst1 = MsgBox(3, "Correct?", "Company code:" & $ccode & "" & @CRLF & "Cost Center:" & $ccenter & @CRLF & "" & @CRLF & "Is this correct?") If $qst1 = 6 Then ExitLoop ElseIf $qst1 = 2 Then Return EndIf WEnd $qst2 = MsgBox(4, "Save information?", "Do you want to save the Cost Center" & @CRLF _ & "and Bank number information?") If $qst2 = 6 Then ConsoleWrite("write ini" & @LF) IniWrite("AME.ini", "settings", "code", $ccode) IniWrite("AME.ini", "settings", "center", $ccenter) _deploy2() EndIf If $qst2 = 7 Then _deploy2() EndFunc ;==>_deploy SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Bert Posted February 14, 2006 Author Share Posted February 14, 2006 Thanks Frost! works perfectly. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now