Bert Posted January 3, 2006 Posted January 3, 2006 (edited) For some reason my script is hanging for 5 to 10 seconds then works again, then hangs again. I'm not sure why. Its a rather long one, so I will try to describe the problem. I went to use TrayCreateItem. works fine. here is the code I did for it: #NoTrayIcon #Include <Constants.au3> Opt("TrayAutoPause",0) Opt("TrayMenuMode", 1) $optiontray = TrayCreateItem("Options") $abouttray = TrayCreateItem("About") $helptray = TrayCreateItem("Help") TrayCreateItem("") $exittray = TrayCreateItem("Exit UNPlus") TraySetState() ok, now I have a while statement that runs a bunch of stuff. expandcollapse popupWhile 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $optiontray run("UNOption.exe") Case $msg = $helptray Msgbox(0, "Help", "Help") Case $msg = $exittray exit Case $msg = $abouttray Msgbox(64,"About:","A program by Volly"& @CRLF _ &""& @CRLF _ &" 2006 Volly's Skunkworks") ;This section monitors if certain windows are open. ;If they are, the hotkeysets for those windows are active. ;<:::Keys for Request Detail:::> case WinActive("Request Detail - Unicenter ServicePlus Service Desk") _win1_func() continueloop ;<:::Keys for Incident Detail:::> Case WinActive("Incident Detail - Unicenter ServicePlus Service Desk") _win2_func() continueloop ;<:::Keys for Problem Detail:::> Case WinActive("Problem Detail - Unicenter ServicePlus Service Desk") _win3_func() continueloop ;<:::Keys for Update Incident:::> Case WinActive("Update Incident - Unicenter ServicePlus Service Desk") _win4_func() continueloop ;<:::Keys for Update Request:::> Case WinActive("Update Request - Unicenter ServicePlus Service Desk") _win5_func() continueloop ;<:::Keys for Update Problem:::> Case WinActive("Update Problem - Unicenter ServicePlus Service Desk") _win6_func() continueloop ;;<:::Keys for Main Window:::> Case WinActive("Unicenter ServicePlus Service Desk", "http://usdp/CAisd/pdmweb.exe") _win7_func();DO NOT CHANGE THIS LINE! continueloop ;;<:::Keys for Service Request Window:::> Case WinActive("Service Request") _win8_func() continueloop ;;<:::Keys for Argis Web Change Window:::> Case WinActive("Master Page", "http://dcam.stsc.suntrust.com/PageSetup/master_page.asp") _win9_func() continueloop EndSelect wend My problem is the loop is getting stuck on the "$msg = TrayGetMsg()", This in turn is breaking the hotsetkeys I have running depending on when a certain window is active. Before I added the TrayCreateItem items, the script worked fine. I used AutoItSetOption("TrayIconDebug", 1) to see where the script is hanging. Any ideas? Edited January 3, 2006 by vollyman The Vollatran project My blog: http://www.vollysinterestingshit.com/
Bert Posted January 3, 2006 Author Posted January 3, 2006 update: I found the script will stay stuck unless I click on the window that is spelled out in the script, then right click the tray icon, then the window again. The Vollatran project My blog: http://www.vollysinterestingshit.com/
Bert Posted January 3, 2006 Author Posted January 3, 2006 (edited) For those who want to see the entire script, here. (Its 693 lines) I know, I know....... CODEAutoItSetOption("WinTitleMatchMode", 2);any part of the string can be used in a window's name AutoItSetOption("TrayIconDebug", 1);debug is on Break(1);This fixes the icon in the systemtray. 1 is on, 0 is off ;system tray functions #NoTrayIcon #Include <Constants.au3> Opt("TrayAutoPause",0) Opt("TrayMenuMode", 1) $optiontray = TrayCreateItem("Options") $abouttray = TrayCreateItem("About") $helptray = TrayCreateItem("Help") TrayCreateItem("") $exittray = TrayCreateItem("Exit UNPlus") TraySetState() ;checks to see if UNPlus.exe is running $g_szVersion = "UNPlus.exe" If WinExists($g_szVersion) Then Exit; It's already running ;Startup splash screen AutoItWinSetTitle($g_szVersion) SplashTextOn("Unicenter UNPlus", "Unicenter Plus Beta .9_6 for ServiceDesk 6.0.", 500, 40, -1, -1, 0, "", 18) Sleep(1500) SplashOff() ;Checks to see if Unicenter is loaded. If not ;it will start Unicenter IF WinExists("Unicenter ServicePlus Service Desk", "http://usdp/CAisd/pdmweb.exe") == 0 then run( "C:\Program Files\Internet Explorer\IEXPLORE.EXE -new http://usdp/CAisd/pdmweb.exe", "") WinWaitActive("Unicenter ServicePlus Service Desk", "http://usdp/CAisd/pdmweb.exe") endif IF WinExists ("Unicenter ServicePlus Service Desk", "http://usdp/CAisd/pdmweb.exe" )== 1 then WinActivate ( "Unicenter ServicePlus Service Desk" , "http://usdp/CAisd/pdmweb.exe" ) endif dim $keyA dim $keyB ;----------------------------------------------- ;These hotsetkeys will always be active. This is due to the nature of the function. $keySET = iniread("unplus.ini", "qkeys", "key", "{" & "F6" & "}") $keyA = HotKeySet($keySET, "_F6_Func");QuickPaste $keyB = HotKeySet("^!x", "_key1_Func");exit this script only - clrl + alt + x ;------------------------------------------------ While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $optiontray run("UNOption.exe") Case $msg = $helptray Msgbox(0, "Help", "Help") Case $msg = $exittray exit Case $msg = $abouttray Msgbox(64,"about:","UNPlus 1.0 For Unicenter ServiceDesk"& @CRLF _ &""& @CRLF _ &" 2006 Suntrust Bank") ;This section monitors if certain windows are open. ;If they are, the hotkeysets for those windows are active. ;<:::Keys for Request Detail:: case WinActive("Request Detail - Unicenter ServicePlus Service Desk") _win1_func() continueloop ;<:::Keys for Incident Detail:: Case WinActive("Incident Detail - Unicenter ServicePlus Service Desk") _win2_func() continueloop ;<:::Keys for Problem Detail:: Case WinActive("Problem Detail - Unicenter ServicePlus Service Desk") _win3_func() continueloop ;<:::Keys for Update Incident:: Case WinActive("Update Incident - Unicenter ServicePlus Service Desk") _win4_func() continueloop ;<:::Keys for Update Request:: Case WinActive("Update Request - Unicenter ServicePlus Service Desk") _win5_func() continueloop ;<:::Keys for Update Problem:: Case WinActive("Update Problem - Unicenter ServicePlus Service Desk") _win6_func() continueloop ;;<:::Keys for Main Window:: Case WinActive("Unicenter ServicePlus Service Desk", "http://usdp/CAisd/pdmweb.exe") _win7_func();DO NOT CHANGE THIS LINE! continueloop ;;<:::Keys for Service Request Window:: Case WinActive("Service Request") _win8_func() continueloop ;;<:::Keys for Argis Web Change Window:: Case WinActive("Master Page", "http://dcam.stsc.suntrust.com/PageSetup/master_page.asp") _win9_func() continueloop EndSelect wend ;Functions------------------------------- ;table of contents ;_win1_func(): Request Ticket keys ;_win2_func(): Incident Ticket keys ;_win3_func(): Problem Ticket keys ;_win4_func(): Update Incident keys ;_win5_func(): Update Request keys ;_win6_func(): Update Problem keys ;_win7_func(): Main Window keys ;F1 ; F1A: Help in Request Ticket view ; F1B: Help in Incident Ticket view ; F1C: Help in Problem Ticket view ; F1D: Help in Update Incident view ; F1E: Help in Update Request view ; F1F: Help in Update Problem view ; F1G: Help in Main Window view ;F2 ; F2: Search Request ;F3 ; F3A: Resolution field ; F3B: Search Incident ;F4 ; F4: TreePaste ;F5 ; F5B: Refresh ticket view ; F5B: Refresh Querry ;F6 ; F6: QuickPaste ; This function's key may be changed depending on UNPlus.ini ;F8 ; F8: Log out Unicenter ;------------------------------------------- Func _win1_func() HotKeySet("{F1}", "_F1A_Func");turns key on for help HotKeySet("{F5}", "_F5A_Func");turns key on for refresh ticket HotKeySet("{PRINTSCREEN}", "_key2_Func"); Print ticket Do Sleep(10) Until Not WinActive("Request Detail - Unicenter ServicePlus Service Desk") _key_clean_1() EndFunc Func _win2_func() HotKeySet("{F1}", "_F1B_Func");turns key on for help HotKeySet("{F5}", "_F5A_Func");turns key on for refresh ticket HotKeySet("{PRINTSCREEN}", "_key2_Func"); Print ticket Do Sleep(10) Until Not WinActive("Incident Detail - Unicenter ServicePlus Service Desk") _key_clean_1() EndFunc Func _win3_func() HotKeySet("{F1}", "_F1C_Func");turns key on for help HotKeySet("{F5}", "_F5A_Func");turns key on for refresh ticket HotKeySet("{PRINTSCREEN}", "_key2_Func"); Print ticket Do Sleep(10) Until Not WinActive("Problem Detail - Unicenter ServicePlus Service Desk") _key_clean_1() EndFunc Func _win4_func() HotKeySet("{F1}", "_F1D_Func");turns key on for help HotKeySet("{F3}", "_F3A_Func");turns key on for Resolution HotKeySet("{F4}", "_F4_Func");turns key on for TreePaste Do Sleep(10) Until Not WinActive("Update Incident - Unicenter ServicePlus Service Desk") _key_clean_1() EndFunc Func _win5_func() HotKeySet("{F1}", "_F1D_Func");turns key on for help HotKeySet("{F3}", "_F3A_Func");turns key on for Resolution HotKeySet("{F4}", "_F4_Func");turns key on for TreePaste Do Sleep(10) Until Not WinActive("Update Request - Unicenter ServicePlus Service Desk") _key_clean_1() EndFunc Func _win6_func() HotKeySet("{F1}", "_F1D_Func");turns key on for help HotKeySet("{F3}", "_F3A_Func");turns key on for Resolution HotKeySet("{F4}", "_F4_Func");turns key on for TreePaste Do Sleep(10) Until Not WinActive("Update Problem - Unicenter ServicePlus Service Desk") _key_clean_1() EndFunc Func _win7_func() HotKeySet("{F1}", "_F1G_Func");turns key on for help HotKeySet("{F2}", "_F2_Func");turns key on for Search Request HotKeySet("{F3}", "_F3B_Func");turns key on for Search Request HotKeySet("{F5}", "_F5B_Func");turns key on Refresh current querry HotKeySet("{F8}", "_F8_Func");turns key on for close Unicenter Do Sleep(10) Until Not WinActive("Unicenter ServicePlus Service Desk", "http://usdp/CAisd/pdmweb.exe") _key_clean_1() EndFunc Func _win8_func() HotKeySet("{PRINTSCREEN}", "_key3_Func"); Print Service Request Do Sleep(10) Until Not WinActive("Service Request", "http://atlnotes3.suntrust.com/suntrack/servicerequest.nsf/0") _key_clean_1() EndFunc Func _win9_func() HotKeySet("{PRINTSCREEN}", "_key4_Func"); Print Service Request Do Sleep(10) Until Not WinActive("Master Page", "http://dcam.stsc.suntrust.com/PageSetup/master_page.asp") _key_clean_1() EndFunc ;F1 section - Help Func _F1A_Func();Help in Request Ticket view If WinExists("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Then WinActivate("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Else $fkeyV = iniread("unplus.ini", "Qkeys", "msg", "") $help_R = GUICreate("Help in Request Ticket view", 445, 130) GUISetBkColor (0xE0FFFF) GUICtrlCreateLabel ("F1= Opens a help file showing the functions." & @CRLF _ & "F5= Refresh: This will refresh the current view." & @CRLF _ & "" & $fkeyV & "= Quick Paste: This will paste pre-determined text of your choice to fields." & @CRLF _ & "CTRL + ALT + X: Closes UNPlus, but leaves Unicenter ServiceDesk open" & @CRLF _ & "Print Scrn= Print Ticket: This will print your ticket to your default printer.", 5, 5, 440, 95) $button1 = GUICtrlCreateButton("OK", 185, 102, 60, 20) ; Run the GUI until it is closed GUISetState() While 2 $msg = GUIGetMsg() Select Case $msg = $button1 GuiDelete($help_R) exitloop EndSelect WEnd EndIf EndFunc ;==>_F1A_Func Func _F1B_Func();Help in Incident Ticket view If WinExists("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Then WinActivate("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Else $fkeyV = iniread("unplus.ini", "Qkeys", "msg", "") $help_R = GUICreate("Help in Incident Ticket view", 445, 130) GUISetBkColor (0xE0FFFF) GUICtrlCreateLabel ("F1= Opens a help file showing the functions." & @CRLF _ & "F5= Refresh: This will refresh the current view." & @CRLF _ & "" & $fkeyV & "= Quick Paste: This will paste pre-determined text of your choice to fields." & @CRLF _ & "CTRL + ALT + X: Closes UNPlus, but leaves Unicenter ServiceDesk open" & @CRLF _ & "Print Scrn= Print Ticket: This will print your ticket to your default printer.", 5, 5, 440, 95) $button1 = GUICtrlCreateButton("OK", 185, 102, 60, 20) ; Run the GUI until it is closed GUISetState() While 3 $msg = GUIGetMsg() Select Case $msg = $button1 GuiDelete($help_R) exitloop EndSelect WEnd EndIf EndFunc ;==>_F1B_Func Func _F1C_Func();Help in Problem Ticket view If WinExists("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Then WinActivate("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Else $fkeyV = iniread("unplus.ini", "Qkeys", "msg", "") $help_R = GUICreate("Help in Problem Ticket view", 445, 130) GUISetBkColor (0xE0FFFF) GUICtrlCreateLabel ("F1= Opens a help file showing the functions." & @CRLF _ & "F5= Refresh: This will refresh the current view." & @CRLF _ & "" & $fkeyV & "= Quick Paste: This will paste pre-determined text of your choice to fields." & @CRLF _ & "CTRL + ALT + X: Closes UNPlus, but leaves Unicenter ServiceDesk open" & @CRLF _ & "Print Scrn= Print Ticket: This will print your ticket to your default printer.", 5, 5, 440, 95) $button1 = GUICtrlCreateButton("OK", 185, 102, 60, 20) ; Run the GUI until it is closed GUISetState() While 4 $msg = GUIGetMsg() Select Case $msg = $button1 GuiDelete($help_R) exitloop EndSelect WEnd EndIf EndFunc ;==>_F1C_Func Func _F1D_Func();Help in Incident Ticket view If WinExists("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Then WinActivate("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Else $fkeyV = iniread("unplus.ini", "Qkeys", "msg", "") $help_R = GUICreate("Help in Update Incident view", 445, 130) GUISetBkColor (0xE0FFFF) GUICtrlCreateLabel ("F1= Opens a help file showing the functions." & @CRLF _ & "F3= Resolution: This will change the view to the resolution field in edit mode." & @CRLF _ & "F4= TreePaste: This will open a GUI with a tree menu to allow the user to select the Configuration item desired." & @CRLF _ & "" & $fkeyV & "= Quick Paste: This will paste pre-determined text of your choice to fields." & @CRLF _ & "CTRL + ALT + X: Closes UNPlus, but leaves Unicenter ServiceDesk open" & @CRLF _ & "Print Scrn= Print Ticket: This will print your ticket to your default printer.", 5, 5, 440, 95) $button1 = GUICtrlCreateButton("OK", 185, 102, 60, 20) ; Run the GUI until it is closed GUISetState() While 5 $msg = GUIGetMsg() Select Case $msg = $button1 GuiDelete($help_R) exitloop EndSelect WEnd EndIf EndFunc ;==>_F1D_Func Func _F1E_Func();Help in Request Ticket view If WinExists("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Then WinActivate("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Else $fkeyV = iniread("unplus.ini", "Qkeys", "msg", "") $help_R = GUICreate("Help in Update Request view", 445, 130) GUISetBkColor (0xCCFFCC) GUICtrlCreateLabel ("F1= Opens a help file showing the functions." & @CRLF _ & "F3= Resolution: This will change the view to the resolution field in edit mode." & @CRLF _ & "F4= TreePaste: This will open a GUI with a tree menu to allow the user to select the Configuration item desired." & @CRLF _ & "" & $fkeyV & "= Quick Paste: This will paste pre-determined text of your choice to fields." & @CRLF _ & "CTRL + ALT + X: Closes UNPlus, but leaves Unicenter ServiceDesk open" & @CRLF _ & "Print Scrn= Print Ticket: This will print your ticket to your default printer.", 5, 5, 440, 95) $button1 = GUICtrlCreateButton("OK", 185, 102, 60, 20) ; Run the GUI until it is closed GUISetState() While 6 $msg = GUIGetMsg() Select Case $msg = $button1 GuiDelete($help_R) exitloop EndSelect WEnd EndIf EndFunc ;==>_F1E_Func Func _F1F_Func();Help in Update Problem view If WinExists("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Then WinActivate("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Else $fkeyV = iniread("unplus.ini", "Qkeys", "msg", "") $help_R = GUICreate("Help in Update Problem view", 445, 130) GUISetBkColor (0xCCFFCC) GUICtrlCreateLabel ("F1= Opens a help file showing the functions." & @CRLF _ & "F3= Resolution: This will change the view to the resolution field in edit mode." & @CRLF _ & "F4= TreePaste: This will open a GUI with a tree menu to allow the user to select the Configuration item desired." & @CRLF _ & "" & $fkeyV & "= Quick Paste: This will paste pre-determined text of your choice to fields." & @CRLF _ & "CTRL + ALT + X: Closes UNPlus, but leaves Unicenter ServiceDesk open" & @CRLF _ & "Print Scrn= Print Ticket: This will print your ticket to your default printer.", 5, 5, 440, 95) $button1 = GUICtrlCreateButton("OK", 185, 102, 60, 20) ; Run the GUI until it is closed GUISetState() While 7 $msg = GUIGetMsg() Select Case $msg = $button1 GuiDelete($help_R) exitloop EndSelect WEnd EndIf EndFunc ;==>_F1F_Func Func _F1G_Func();Help in main window view If WinExists("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Then WinActivate("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Else $fkeyV = iniread("unplus.ini", "Qkeys", "msg", "") $help_R = GUICreate("Help in Main Window view", 445, 130) GUISetBkColor (0xFFC1C1) GUICtrlCreateLabel ("F1= Opens a help file showing the functions." & @CRLF _ & "F2= Search Request: This will search for Request tickets in a predefined bucket." & @CRLF _ & "F3= Search Incident: This will search for Incidents tickets in a predefined bucket." & @CRLF _ & "F5= Refresh: This will refresh the current list of tickets that are listed." & @CRLF _ & "" & $fkeyV & "= Quick Paste: This will paste pre-determined text of your choice to fields." & @CRLF _ & "F8= Logout: This will log you out of Unicenter", 5, 5, 440, 95) $button1 = GUICtrlCreateButton("OK", 185, 102, 60, 20) ; Run the GUI until it is closed GUISetState() While 8 $msg = GUIGetMsg() Select Case $msg = $button1 GuiDelete($help_R) exitloop EndSelect WEnd EndIf EndFunc ;==>_F1G_Func ;--------------------------------- ;F2 Section: Search Request Func _F2_Func(); Search Request $INIre = INIread ("unplus.ini", "request", "speed", "") If WinExists("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Then WinActivate("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Elseif $INIre == "normal" then BlockInput(1) send("!e") sleep(5) send("!r") BlockInput(0) WInWaitActive( "Unicenter ServicePlus Service Desk" , "Opening", 2) sleep(200) WInWaitActive( "Unicenter ServicePlus Service Desk" , "Done", 2 ) sleep(600) BlockInput(1) send("{TAB}") sleep(5) send("{TAB}") sleep(5) send("{TAB}") sleep(5) $search1 = iniread("unplus.ini", "request", "search", "") Send($search1) send("!s") BlockInput(0) Else BlockInput(1) send("!e") sleep(250) WinActivate ( "Unicenter ServicePlus Service Desk" , "http://usdp/CAisd/pdmweb.exe" ) send("!r") sleep(3500) WinActivate ( "Unicenter ServicePlus Service Desk" , "http://usdp/CAisd/pdmweb.exe" ) send("{TAB}") sleep(200) WinActivate ( "Unicenter ServicePlus Service Desk" , "http://usdp/CAisd/pdmweb.exe" ) send("{TAB}") sleep(50) WinActivate ( "Unicenter ServicePlus Service Desk" , "http://usdp/CAisd/pdmweb.exe" ) send("{TAB}") sleep(50) fileopen ("search.ini", 0) $note1 = FileReadLine ("search.ini") WinActivate ( "Unicenter ServicePlus Service Desk" , "http://usdp/CAisd/pdmweb.exe" ) Send($note1) send("!s") Blockinput(0) EndIf EndFunc ;==>_F2_Func ;---------------------------------- ;F3 Section ; F3A: Resolution field ; F3B: Search Incident Func _F3A_Func(); Resolution field If WinExists("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Then WinActivate("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Else Send("!4") Send("!9") EndIf EndFunc ;==>_F3A_Func Func _F3B_Func(); Search Incident $INIin = INIread ("unplus.ini", "incident", "speed", "") If WinExists("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Then WinActivate("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Elseif $INIin == "normal" then BlockInput(1) send("!e") sleep(5) WinActivate ( "Unicenter ServicePlus Service Desk" , "http://usdp/CAisd/pdmweb.exe" ) send("!i") BlockInput(0) WinWaitActive( "Unicenter ServicePlus Service Desk" , "Opening", 2 ) sleep(350) WInWaitActive( "Unicenter ServicePlus Service Desk" , "Done", 2 ) BlockInput(1) sleep(500) send("{TAB}") sleep(5) send("{TAB}") sleep(5) $search1 = iniread("unplus.ini", "incident", "search", "") Send($search1) WinActivate ( "Unicenter ServicePlus Service Desk" , "http://usdp/CAisd/pdmweb.exe" ) send("!s") BlockInput(0) Else Blockinput(1) send("!e") sleep(300) WinActivate ( "Unicenter ServicePlus Service Desk" , "http://usdp/CAisd/pdmweb.exe" ) send("!i") sleep(3000) WinActivate ( "Unicenter ServicePlus Service Desk" , "http://usdp/CAisd/pdmweb.exe" ) send("{TAB}") WinActivate ( "Unicenter ServicePlus Service Desk" , "http://usdp/CAisd/pdmweb.exe" ) sleep(20) WinActivate ( "Unicenter ServicePlus Service Desk" , "http://usdp/CAisd/pdmweb.exe" ) send("{TAB}") WinActivate ( "Unicenter ServicePlus Service Desk" , "http://usdp/CAisd/pdmweb.exe" ) sleep(20) fileopen ("search.ini", 0) $note1 = FileReadLine ("search.ini") Send($note1) WinActivate ( "Unicenter ServicePlus Service Desk" , "http://usdp/CAisd/pdmweb.exe" ) send("!s") Blockinput(0) EndIf EndFunc ;==>_F3B_Func ;-------------------------- ;F4 Section Func _F4_Func(); TreePaste If WinExists("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Then WinActivate("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Else BlockInput(1) Send("^a") Sleep(50) Send("{DEL}") Sleep(50) BlockInput(0) RunWait("treepaste.exe", "") BlockInput(1) Sleep(500) Send("^v") BlockInput(0) EndIf EndFunc ;==>_F4_Func ;----------------------------- ;F5 Section ; F5A: Refresh TIcket ; F5B: Refresh List Func _F5A_Func(); Refresh Ticket If WinExists("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Then WinActivate("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Else BlockInput(1) Send("!v") Sleep(5) Send("!e") BlockInput(0) EndIf EndFunc ;==>_F5A_Func Func _F5B_Func(); Refresh Querry If WinExists("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Then WinActivate("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Else BlockInput(1) Send("!v") Sleep(5) Send("!e") BlockInput(0) EndIf EndFunc ;==>_F5B_Func ;---------------------------- ;F6 Section Func _F6_Func(); QuickPaste If WinExists("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Then WinActivate("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Else RunWait("quickpaste2_0.exe", "") EndIf EndFunc ;==>key6 ;---------------------------- ;F8 Section Func _F8_Func(); Close Unicenter If WinExists("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Then WinActivate("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Else BlockInput(1) Send("!u") Send("!e") BlockInput(0) Exit EndIf EndFunc ;==>_F8_Func ;---------------------------- Func _key1_Func(); Closes UNPlus If WinExists("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Then WinActivate("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Else Exit EndIf EndFunc ;==>_key1_Func Func _key2_Func(); Print tickets If WinExists("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Then WinActivate("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Elseif WinExists ("CAisd report - indtl.rpt") then WinActivate("CAisd report - indtl.rpt") Send("!p") WInWaitActive("Print", "General") Send("!p") else Winexists("Detail - Unicenter ServicePlus Service Desk") Send("!r") sleep(100) Send("d") sleep(1000) WinWaitActive("CAisd report - indtl.rpt", "Opening") sleep(1000) WinWaitActive("CAisd report - indtl.rpt", "Opening") sleep(1000) Send("!p") WinWaitActive("Print", "General") Send("!p") EndIf EndFunc ;==>_key2_Func Func _key3_Func(); Print Service request WinActivate("Service Request") Send("^p") sleep(100) WinWait("Print") sleep(100) WinActivate("Print") sleep(200) Send("!p") EndFunc ;==>_key3_Func Func _key4_Func(); Print Argis Change WinActivate("Master Page") Send("^p") sleep(100) WinWait("Print") sleep(100) WinActivate("Print") sleep(200) Send("!p") EndFunc ;==>_key4_Func Func _key_clean_1();Releases hotsetkeys HotKeySet("{F1}"); turns help off HotKeySet("{F2}"); turns Request off HotKeySet("{F3}"); turns Resolution / incident off HotKeySet("{F4}"); turns TreePaste off HotKeySet("{F5}"); turns refresh off HotKeySet("{PRINTSCREEN}"); Turns Print ticket off EndFunc ;==>_key_clean_1 Edited January 3, 2006 by vollyman The Vollatran project My blog: http://www.vollysinterestingshit.com/
Moderators SmOke_N Posted January 3, 2006 Moderators Posted January 3, 2006 Would save room if you just uploaded it (for future post of yours)... I hate scrolling all the way down to see if something else was typed Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Bert Posted January 3, 2006 Author Posted January 3, 2006 (edited) Will do. I have seen where people have the code window with a scroll. How do you do that? Edited January 3, 2006 by vollyman The Vollatran project My blog: http://www.vollysinterestingshit.com/
Moderators SmOke_N Posted January 3, 2006 Moderators Posted January 3, 2006 I think those are post before they switched to this new forum. If it can still be done, I don't now how personally. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Bert Posted January 3, 2006 Author Posted January 3, 2006 Any thought on what is causing this problem? I was wondering when using case statements, do you need to have them pointing to the same $msg so the script doesn't hang. Am I on the right track here? The Vollatran project My blog: http://www.vollysinterestingshit.com/
seandisanti Posted January 3, 2006 Posted January 3, 2006 Would save room if you just uploaded it (for future post of yours)... I hate scrolling all the way down to see if something else was typed christ you're whiney today.
Bert Posted January 3, 2006 Author Posted January 3, 2006 (edited) well!, I needed the laugh today! I still have the problem however with the script. Any thoughts? @Larry - HAHAHAHAHA Edited January 3, 2006 by vollyman The Vollatran project My blog: http://www.vollysinterestingshit.com/
Moderators SmOke_N Posted January 3, 2006 Moderators Posted January 3, 2006 I used AutoItSetOption("TrayIconDebug", 1) to see where the script is hanging.What line did it say? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Bert Posted January 3, 2006 Author Posted January 3, 2006 (edited) $msg = TrayGetMsg() this is what it shows when I place the mouse pointer on the system tray icon When I worked on this script at home, I used dummy notepad files to trick the script. That way I could run it and simulate the windows to test the keys. Today when I discovered the problem, it was running for real. Again, it works fine, just as long as I disable the system tray icon stuff. Edited January 3, 2006 by vollyman The Vollatran project My blog: http://www.vollysinterestingshit.com/
Bert Posted January 4, 2006 Author Posted January 4, 2006 anyone? The Vollatran project My blog: http://www.vollysinterestingshit.com/
Holger Posted January 4, 2006 Posted January 4, 2006 Will take a look... Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
Moderators SmOke_N Posted January 4, 2006 Moderators Posted January 4, 2006 (edited) I can't see the real problem, but try to take the continueloop(s) out and see what that does... it's going to continue as soon as it gets back from the function anyway.EditYou also may want to change all your $msg = ... for every loop you have $msg = TrayGetMsg() or $msg = GUIGetMsg()... try changing them to $msg1 = TrayGetMsg() / $msg2 = GUIGetMsg() / $msg3 = GUIGetMsg() so on and so on.... Edited January 4, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Holger Posted January 4, 2006 Posted January 4, 2006 Here is a small sample script (a changed of yours):expandcollapse popupAutoItSetOption("WinTitleMatchMode", 2);any part of the string can be used in a window's name AutoItSetOption("TrayIconDebug", 1);debug is on ;system tray functions #NoTrayIcon #Include <Constants.au3> Opt("TrayAutoPause",0) Opt("TrayMenuMode", 1) $optiontray = TrayCreateItem("Options") $abouttray = TrayCreateItem("About") $helptray = TrayCreateItem("Help") TrayCreateItem("") $exittray = TrayCreateItem("Exit UNPlus") TraySetState() ;checks to see if UNPlus.exe is running $g_szVersion = "UNPlus.exe" If WinExists($g_szVersion) Then Exit ;Startup splash screen AutoItWinSetTitle($g_szVersion) SplashTextOn("Unicenter UNPlus", "Unicenter Plus Beta .9_6 for ServiceDesk 6.0.", 500, 40, -1, -1, 0, "", 18) Sleep(1500) SplashOff() While 1 $msg = TrayGetMsg() Select Case $msg = $optiontray run("UNOption.exe") Case $msg = $helptray Msgbox(0, "Help", "Help") Case $msg = $exittray exitloop Case $msg = $abouttray Msgbox(64,"About:","UNPlus 1.0 For Unicenter ServiceDesk"& @CRLF _ &""& @CRLF _ &" 2006 Suntrust Bank") EndSelect Select Case WinActive("Calculator") TrayTip("Info", "Calculator" , 5) Case WinActive("Editor") TrayTip("Info", "Editor" , 5) Case Else TrayTip("Info", "Nothing" , 5) EndSelect wend1.) Put the "WinActive"s outside the "Select/EndSelect" after the TrayGetMsg()So if there is no message in the queue (then $msg = 0) the functions will not be called (see 2.)2.) You can delete "Case $msg = 0 Then" (not really needed) Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
Bert Posted January 4, 2006 Author Posted January 4, 2006 That fixed it. I added a endselect then a select to split the case statements, and deleted Case $msg = 0 Thanks! I will have to note this in my brain for future use. The Vollatran project My blog: http://www.vollysinterestingshit.com/
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