Sign in to follow this  
Followers 0
Bert

dumb question - feeling real stupid here...

18 posts in this topic

I haven't had much sleep, and I know I should know this by now...yes you can whack me up side the head if you like...

I have a script that has a processor hunger problem. Here is the jist of the code, and you will see what a goof I am this morning...

CODE
AutoItSetOption("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

Opt("WinDetectHiddenText", 1) ;detect hidden text is on

Opt("sendkeydowndelay",1) ;speeds up key sends

Opt("PixelCoordMode",2)

Opt("MouseCoordMode",2)

;Opt("GUIOnEventMode", 1)

Global $help_R

;aaaaaaaaaaaaaaaaaaaaaaaaaaaa

Global $Unicenter_iPID, $Title

Dim $Btn_1, $Btn_2

Dim $GUI1, $GUI2

Dim $p_win1, $p_win2, $x1 = 10, $x2 = 315, $y1 = 10, $y2 = 10, $Dock = 1, $Dock_Location = 1

Dim $NewUnicenter, $check1

;aaaaaaaaaaaaaaaaaaaaaaaaaaaa

;system tray functions

#include <Array.au3>

#Include <Constants.au3>

#Include <GUIConstants.au3>

#include <Date.au3>

$current = "12:00:00 AM"

;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 2.0.08 for ServiceDesk 6.0.", 550, 40, -1, -1, 0, "", 18)

Sleep(1500)

SplashOff()

;--------------------

;Checks to see if Unicenter is loaded. If not

;it will start Unicenter

;If you want to test the script without unicenter running, remark this section out---------

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", 20)

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

;~ If WinExists("Unicenter Toolbar") == 0 Then

;~ Run("maintoolbar.exe")

;~ EndIf

;~ If WinExists("Unicenter Toolbar") == 1 Then

;~ Sleep(10)

;~ EndIf

Dim $keyA

Dim $keyB

;-----------------------------------------------

;These hotsetkeys will always be active. This is due to the nature of the function.

;$keySET = IniRead("bin/unplus.ini", "qkeys", "key", "{" & "F6" & "}") ;old

$keySET = IniRead("bin\unplus.ini", @UserName, "key", "{" & "F6" & "}")

$keyA = HotKeySet($keySET, "_F6_Func");QuickPaste

$keyB = HotKeySet("^!x", "_key1_Func");exit this script only - clrl + alt + x

;------------------------------------------------

After that I have 27 case statements that look to see if certain windows are active. A example of one is like this:

Case WinActive("Service Request", "equest.nsf")
   _win8_func()
   ContinueLoop

I've tried to put sleep statements between the case statements doing this:

EndSelect
sleep(1) 
Select

I hate doing this, for it causes a slowdown in the script. I know Val gave me a snippit that ran a idle, but I couldn't get that to work right due to the idle caused CPU hunger, just the thing I'm trying to fix. Can someone stear me in the right direction? I'm feeling real stupid for not seeing the problem.

Share this post


Link to post
Share on other sites



The snipplet you gave doesn't show the issue your having volly :)


[center]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.[/center]

Share this post


Link to post
Share on other sites

Here is the thing. The more case statements I add, the more processor hungry the thing gets. If I just have, say 4 or 5, everything is fine. If I go above that, the prosessor time starts climbing. If one of the windows are active, the processor time is fine. It seems when nothing is active, the thing gets processor hungry.

Here is the entire script. It is around 1200 lines, and it is somewhat messy.

#region - things that do not need to be changedAutoItSetOption("WinTitleMatchMode", 2) ;any part of the string can be used in a window's nameAutoItSetOption("TrayIconDebug", 1) ;debug is onBreak(1);This fixes the icon in the systemtray. 1 is on, 0 is offOpt("WinDetectHiddenText", 1) ;detect hidden text is on;Opt("TrayAutoPause", 0)Opt("sendkeydowndelay",1)  ;speeds up key sendsOpt("PixelCoordMode",2) Opt("MouseCoordMode",2)Opt("GUIOnEventMode", 1);Global $msg = GUIGetMsg()Global $help_R;aaaaaaaaaaaaaaaaaaaaaaaaaaaaGlobal $Unicenter_iPID, $TitleDim $Btn_1, $Btn_2Dim $GUI1, $GUI2Dim $p_win1, $p_win2, $x1 = 10, $x2 = 315, $y1 = 10, $y2 = 10, $Dock = 1, $Dock_Location = 1Dim $NewUnicenter, $check1;aaaaaaaaaaaaaaaaaaaaaaaaaaaa;system tray functions;#NoTrayIcon#include <Array.au3>#Include <Constants.au3>#Include <GUIConstants.au3>#include <Date.au3>$current = "12:00:00 AM";checks to see if UNPlus.exe is running$g_szVersion = "UNPlus.exe"If WinExists($g_szVersion) Then Exit; It's already running;Startup splash screenAutoItWinSetTitle($g_szVersion)SplashTextOn("Unicenter UNPlus", "Unicenter Plus 2.0.08 for ServiceDesk 6.0.", 550, 40, -1, -1, 0, "", 18)Sleep(1500)SplashOff();place run first time wizard here. This will walk the person through a set of screens asking;questions to configure UNPlus;Checks to see if Unicenter is loaded. If not;it will start Unicenter;If you want to test the script without unicenter running, remark this section out---------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", 20)EndIfIf WinExists("Unicenter ServicePlus Service Desk", "http://usdp/CAisd/pdmweb.exe") == 1 Then WinActivate("Unicenter ServicePlus Service Desk", "http://usdp/CAisd/pdmweb.exe")EndIf;~ If WinExists("Unicenter Toolbar") == 0 Then;~  Run("maintoolbar.exe");~ EndIf;~ If WinExists("Unicenter Toolbar") == 1 Then;~  Sleep(10);~ EndIfDim $keyADim $keyB;-----------------------------------------------;These hotsetkeys will always be active. This is due to the nature of the function.;$keySET = IniRead("bin/unplus.ini", "qkeys", "key", "{" & "F6" & "}")  ;old$keySET = IniRead("bin\unplus.ini", @UserName, "key", "{" & "F6" & "}")$keyA = HotKeySet($keySET, "_F6_Func");QuickPaste$keyB = HotKeySet("^!x", "_key1_Func");exit this script only - clrl + alt + x;------------------------------------------------#endregionWhile 1 ;sleep(1) ;$msg = TrayGetMsg() Select;  ;This section monitors if certain windows are open.;  ;If they are, the hotkeysets for those windows are active.    ;<:::Keys for Request Detail::<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/smile.png' class='bbc_emoticon' alt=':)' />  Case WinActive("Request Detail - Unicenter ServicePlus Service Desk")   $Title = _CheckProcess("Request Detail - Unicenter ServicePlus Service Desk")   _win1_func() ;$Title)   ContinueLoop      ;<:::Keys for Incident Detail::<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/sad.png' class='bbc_emoticon' alt=':(' />  Case WinActive("Incident Detail - Unicenter ServicePlus Service Desk")   $Title = _CheckProcess("Incident Detail - Unicenter ServicePlus Service Desk")   _win2_func() ;$Title)   ContinueLoop   ;<:::Keys for Problem Detail::<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/biggrin.png' class='bbc_emoticon' alt=':D' />  Case WinActive("Problem Detail - Unicenter ServicePlus Service Desk")   $Title = _CheckProcess("Problem Detail - Unicenter ServicePlus Service Desk")   _win3_func() ;$Title)   ContinueLoop;~  EndSelect;~  sleep(1) ;~  Select      ;<:::Keys for Update Incident::<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/oops.gif' class='bbc_emoticon' alt=':oops:' />  Case WinActive("Update Incident - Unicenter ServicePlus Service Desk")   $Title = _CheckProcess("Update Incident - Unicenter ServicePlus Service Desk")           ;_win13_func()   _win4_func() ;$Title)   ContinueLoop   ;<:::Keys for New Incident::<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/sad.png' class='bbc_emoticon' alt=':(' />  Case WinActive("New Incident")   $Title = _CheckProcess("New Incident")   _win4a_func() ;$Title)   ContinueLoop;~  EndSelect;~  sleep(1);~  Select      ;<:::Keys for Update Request::<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/bike.gif' class='bbc_emoticon' alt=':bike:' />  Case WinActive("Update Request - Unicenter ServicePlus Service Desk")   $Title = _CheckProcess("Update Request - Unicenter ServicePlus Service Desk")   _win5_func() ;$Title)   ContinueLoop   ;<:::Keys for New Request::<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/wink.png' class='bbc_emoticon' alt=';)' />  Case WinActive("New Request")   $Title = _CheckProcess("New Request")   _win5a_func() ;$Title)   ContinueLoop   ;<:::Keys for Update Problem::<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.png' class='bbc_emoticon' alt='B)' />  Case WinActive("Update Problem - Unicenter ServicePlus Service Desk")   $Title = _CheckProcess("Update Problem - Unicenter ServicePlus Service Desk")   _win6_func() ;$Title)   ContinueLoop   ;<:::Keys for Update Problem::<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/blush.png' class='bbc_emoticon' alt=':>' />  Case WinActive("New Problem")   $Title = _CheckProcess("New Problem")   _win6a_func() ;$Title)   ContinueLoop;~  EndSelect;~  sleep(1);~  Select   ; ;<:::Keys for Main Announcements Window::<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/blush.png' class='bbc_emoticon' alt=':>' />  Case WinActive("Unicenter ServicePlus Service Desk - Announcements", "http://usdp/CAisd/pdmweb.exe")   _win7A_func() ;DO NOT CHANGE THIS LINE!   ContinueLoop   ; ;<:::Keys for Main Request List Window::<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/blush.png' class='bbc_emoticon' alt=':>' />  Case WinActive("Unicenter ServicePlus Service Desk - Request List", "http://usdp/CAisd/pdmweb.exe")   _win7B_func() ;DO NOT CHANGE THIS LINE!   ContinueLoop   ; ;<:::Keys for Main Incident List Window::<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/blush.png' class='bbc_emoticon' alt=':>' />  Case WinActive("Unicenter ServicePlus Service Desk - Incident List", "http://usdp/CAisd/pdmweb.exe")   _win7C_func() ;DO NOT CHANGE THIS LINE!   ContinueLoop  Case WinActive("Unicenter ServicePlus Service Desk - Problem List", "http://usdp/CAisd/pdmweb.exe")   _win7C2_func() ;DO NOT CHANGE THIS LINE!   ContinueLoop    ; ;<:::Keys for Main Incident Search Window::<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/blush.png' class='bbc_emoticon' alt=':>' />  Case WinActive("Unicenter ServicePlus Service Desk - Incident Search", "http://usdp/CAisd/pdmweb.exe")   _win7D_func() ;DO NOT CHANGE THIS LINE!   ContinueLoop;~  EndSelect   ;attempt to correct processor time issue. ;~  sleep(1);~  Select      ; ;<:::Keys for Main Incident Search Window::<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/blush.png' class='bbc_emoticon' alt=':>' />  Case WinActive("Unicenter ServicePlus Service Desk - Problem Search", "http://usdp/CAisd/pdmweb.exe")   _win7D2_func() ;DO NOT CHANGE THIS LINE!   ContinueLoop    ; ;<:::Keys for Main Request Search Window::<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/blush.png' class='bbc_emoticon' alt=':>' />  Case WinActive("Unicenter ServicePlus Service Desk - Request Search", "http://usdp/CAisd/pdmweb.exe")   _win7E_func() ;DO NOT CHANGE THIS LINE!   ContinueLoop   ; ;<:::Keys for Main Change Order Search Window::<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/blush.png' class='bbc_emoticon' alt=':>' />  Case WinActive("Unicenter ServicePlus Service Desk - Change Order Search", "http://usdp/CAisd/pdmweb.exe")   _win7F_func() ;DO NOT CHANGE THIS LINE!   ContinueLoop;~  EndSelect;~  sleep(1) ;~  Select      ; ;<:::Keys for Main Change Order List Window::<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/blush.png' class='bbc_emoticon' alt=':>' />  Case WinActive("Unicenter ServicePlus Service Desk - Change Order List", "http://usdp/CAisd/pdmweb.exe")   _win7G_func() ;DO NOT CHANGE THIS LINE!   ContinueLoop    ; ;<:::Keys for Service Request Window::<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/blush.png' class='bbc_emoticon' alt=':>' />  Case WinActive("Service Request", "equest.nsf")   _win8_func()   ContinueLoop   ; ;<:::Keys for Argis Web Change Window::<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/blush.png' class='bbc_emoticon' alt=':>' />  Case WinActive("Master Page", "http://dcam.stsc.suntrust.com/PageSetup/master_page.asp")   _win9_func()   ContinueLoop;~  EndSelect;~  sleep(1) ;~  Select   ; ;<:::Keys for email - separate frame::<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/blush.png' class='bbc_emoticon' alt=':>' />  Case WinActive("Message (HTML)", "Menu Bar")   _win10_func()   ContinueLoop   ; ;<:::Keys for email - Outlook::<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/blush.png' class='bbc_emoticon' alt=':>' />  Case WinActive("Inbox - Microsoft Outlook")   _win11_func()   ContinueLoop   ; ;<:::Keys for Work Order Window::<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/blush.png' class='bbc_emoticon' alt=':>' />  Case WinActive("Work Order: Ad Hoc")   _win8a_func()   ContinueLoop;~  EndSelect;~  sleep(1) ;~  Select      ; ;<:::Keys for Depot Order Window::<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/blush.png' class='bbc_emoticon' alt=':>' />  Case WinActive("Depot Ordering System - Order #")   _win8b_func()   ContinueLoop   ; ;<:::Keys for Create New Activity for::<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/blush.png' class='bbc_emoticon' alt=':>' />  Case WinActive("Create New Activity for")   _win8c_func()   ContinueLoop  Case WinActive("Master PCAR List")   _win8a2_func()   ContinueLoop   ;  Case WinExists ("http://usdp/CAisd/html/popup_frames.html?POPUP_URLIX=0") ;then ;   MsgBox(0,"","")  ;_win12_func() ;   ContinueLoop;~  EndSelect;~  sleep(1);~  select  Case _NowTime() = $current   ProcessClose("maintoolbar.exe")   Exit EndSelect  $Check_Ini = StringSplit($Unicenter_iPID, '|') For $x = 1 To $Check_Ini[0]  If FileExists(@TempDir & '\' & $Check_Ini[$x] & '.ini') Then   $IVTool = IniRead(@TempDir & '\' & $Check_Ini[$x] & '.ini', 'Main', 'WinHandle', '')   FileDelete(@TempDir & '\' & $Check_Ini[$x] & '.ini')   If $IVTool <> '' Then    If StringInStr($Unicenter_iPID, '|' & $IVTool) <> 0 Then     $Unicenter_iPID = StringReplace($Unicenter_iPID, '|' & $IVTool, '')    Else     $Unicenter_iPID = StringReplace($Unicenter_iPID, $IVTool & '|', '')    EndIf   EndIf  EndIf Next WEnd#cs table of contents for functions ;Functions-------------------------------a ;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 ; F3: Search Incident ; F3b: Search Change Order ;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: Resolution field ;F9 ;F9A: Time Stamp ;F10 ; F10: Log out Unicenter#ce;-------------------------------------------#region  ; for Hotkeyset functionsFunc _win1_func() ;Request Detail - Unicenter ServicePlus Service Desk) HotKeySet("{F1}", "_F1A_Func");turns key on for help HotKeySet("{F5}", "_F5A_Func");turns key on for refresh ticket HotKeySet("{PRINTSCREEN}", "_key2a_Func"); Print ticket Do  Sleep(10) Until Not WinActive("Request Detail - Unicenter ServicePlus Service Desk") ;$sTitle) <img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/wink.png' class='bbc_emoticon' alt=';)' /> _key_clean_1()EndFunc   ;==>_win1_funcFunc _win2_func() ;Incident Detail - Unicenter ServicePlus Service Desk) 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") ;$sTitle) <img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/wink.png' class='bbc_emoticon' alt=';)' /> ;incident detail _key_clean_1();turns off hotsetkeysEndFunc   ;==>_win2_funcFunc _win3_func() ;$Problem Detail - Unicenter ServicePlus Service Desk) 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") ;$sTitle) <img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/wink.png' class='bbc_emoticon' alt=';)' /> _key_clean_1()EndFunc   ;==>_win3_funcFunc _win4_func() ;Update Incident - Unicenter ServicePlus Service Desk) HotKeySet("{F1}", "_F1D_Func");turns key on for help HotKeySet("{F8}", "_F8_Func");turns key on for Resolution HotKeySet("{F4}", "_F4_Func");turns key on for TreePaste HotKeySet("{F9}", "_F9A_Func");Turns on key for TimeStamp Do  Sleep(10) Until Not WinActive("Update Incident - Unicenter ServicePlus Service Desk") ;$sTitle)  ; _key_clean_1() if WinActive ("Incident Category Selection - Unicenter ServicePlus Service Desk", "http://usdp/CAisd/html/popup_frames.html?POPUP_URLIX=0") then _win12_func() EndFunc   ;==>_win4_funcFunc _win4a_func() ;New Incident) HotKeySet("{F1}", "_F1Da_Func");turns key on for help HotKeySet("{F4}", "_F4_Func");turns key on for TreePaste HotKeySet("{F9}", "_F9A_Func");Turns on key for TimeStamp Do  Sleep(10) Until Not WinActive("New Incident") ;$sTitle)  ;   $wincheckA = Winwait ("http://usdp/CAisd/html/popup_frames.html?POPUP_URLIX=0", "", 10)    if $wincheckA = 1 then MsgBox(0,"","1") sleep(3000)    if WinExists ("Incident Category Selection - Unicenter ServicePlus Service Desk") then MsgBox(0,"","2")  ;_win12_func() _key_clean_1() EndFunc   ;==>_win4a_funcFunc _win5_func() ;Update Request - Unicenter ServicePlus Service Desk) HotKeySet("{F1}", "_F1E_Func");turns key on for help HotKeySet("{F8}", "_F8_Func");turns key on for Resolution HotKeySet("{F4}", "_F4_Func");turns key on for TreePaste HotKeySet("{F9}", "_F9A_Func");Turns on key for TimeStamp Do  Sleep(10) Until Not WinActive("Update Request - Unicenter ServicePlus Service Desk") ; $sTitle)  ; _key_clean_1()EndFunc   ;==>_win5_funcFunc _win5a_func() ;New Request) HotKeySet("{F1}", "_F1Ea_Func");turns key on for help HotKeySet("{F4}", "_F4_Func");turns key on for TreePaste HotKeySet("{F9}", "_F9A_Func");Turns on key for TimeStamp Do  Sleep(10) Until Not WinActive("New Request") ;$sTitle)  ; _key_clean_1()EndFunc   ;==>_win5a_funcFunc _win6_func() ;Update Problem - Unicenter ServicePlus Service Desk) HotKeySet("{F1}", "_F1F_Func");turns key on for help HotKeySet("{F8}", "_F8_Func");turns key on for Resolution HotKeySet("{F4}", "_F4_Func");turns key on for TreePaste HotKeySet("{F9}", "_F9A_Func");Turns on key for TimeStamp Do  Sleep(10) Until Not WinActive("Update Problem - Unicenter ServicePlus Service Desk") ;$sTitle)  <img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/wink.png' class='bbc_emoticon' alt=';)' /> _key_clean_1() if WinActive ("Problem Category Selection - Unicenter ServicePlus Service Desk", "http://usdp/CAisd/html/popup_frames.html?POPUP_URLIX=0") then _win12_func()EndFunc   ;==>_win6_funcFunc _win6a_func() ;New Problem) HotKeySet("{F1}", "_F1Fa_Func");turns key on for help HotKeySet("{F4}", "_F4_Func");turns key on for TreePaste HotKeySet("{F9}", "_F9A_Func");Turns on key for TimeStamp Do  Sleep(10) Until Not WinActive("New Problem") ;$sTitle)  ; _key_clean_1() if WinActive ("Problem Category Selection - Unicenter ServicePlus Service Desk", "http://usdp/CAisd/html/popup_frames.html?POPUP_URLIX=0") then _win12_func()EndFunc   ;==>_win6a_funcFunc _win7A_func() ;Unicenter ServicePlus Service Desk - Announcements HotKeySet("{F1}", "_F1G_Func");turns key on for help HotKeySet("{F2}", "_F2_Func");turns key on for Search Request HotKeySet("{F3}", "_F3_Func");turns key on for Search Incident HotKeySet("^{F3}", "_F3b_Func");turns key on for Search Change Order HotKeySet("{F5}", "_F5B_Func");turns key on Refresh current querry HotKeySet("{F10}", "_F10_Func");turns key on for close Unicenter Do  Sleep(10) Until Not WinActive("Unicenter ServicePlus Service Desk - Announcements", "http://usdp/CAisd/pdmweb.exe") _key_clean_1()EndFunc   ;==>_win7A_funcFunc _win7B_func() ;Unicenter ServicePlus Service Desk - Request List HotKeySet("{F1}", "_F1G_Func");turns key on for help HotKeySet("{F2}", "_F2_Func");turns key on for Search Request HotKeySet("{F3}", "_F3_Func");turns key on for Search Incident HotKeySet("^{F3}", "_F3b_Func");turns key on for Search Change Order HotKeySet("{F5}", "_F5B_Func");turns key on Refresh current querry HotKeySet("{F10}", "_F10_Func");turns key on for close Unicenter Do  Sleep(10) Until Not WinActive("Unicenter ServicePlus Service Desk - Request List", "http://usdp/CAisd/pdmweb.exe") _key_clean_1()EndFunc   ;==>_win7B_funcFunc _win7C_func() ;Unicenter ServicePlus Service Desk - Incident List HotKeySet("{F1}", "_F1G_Func");turns key on for help HotKeySet("{F2}", "_F2_Func");turns key on for Search Request HotKeySet("{F3}", "_F3_Func");turns key on for Search Incident HotKeySet("^{F3}", "_F3b_Func");turns key on for Search Change Order HotKeySet("{F5}", "_F5B_Func");turns key on Refresh current querry HotKeySet("{F10}", "_F10_Func");turns key on for close Unicenter Do  Sleep(10) Until Not WinActive("Unicenter ServicePlus Service Desk - Incident List", "http://usdp/CAisd/pdmweb.exe") _key_clean_1()EndFunc   ;==>_win7C_funcFunc _win7C2_func() ;Unicenter ServicePlus Service Desk - Problem List HotKeySet("{F1}", "_F1G_Func");turns key on for help HotKeySet("{F2}", "_F2_Func");turns key on for Search Request HotKeySet("{F3}", "_F3_Func");turns key on for Search Incident HotKeySet("^{F3}", "_F3b_Func");turns key on for Search Change Order HotKeySet("{F5}", "_F5B_Func");turns key on Refresh current querry HotKeySet("{F10}", "_F10_Func");turns key on for close Unicenter Do  Sleep(10) Until Not WinActive("Unicenter ServicePlus Service Desk - Problem List", "http://usdp/CAisd/pdmweb.exe") _key_clean_1() if WinActive ("Problem Category Selection - Unicenter ServicePlus Service Desk", "http://usdp/CAisd/html/popup_frames.html?POPUP_URLIX=0") then _win12_func()  EndFunc   ;==>_win7C_funcFunc _win7D_func() ;Unicenter ServicePlus Service Desk - Incident Search HotKeySet("{F1}", "_F1G_Func");turns key on for help HotKeySet("{F2}", "_F2_Func");turns key on for Search Request HotKeySet("{F3}", "_F3_Func");turns key on for Search Incident HotKeySet("^{F3}", "_F3b_Func");turns key on for Search Change Order HotKeySet("{F5}", "_F5B_Func");turns key on Refresh current querry HotKeySet("{F10}", "_F10_Func");turns key on for close Unicenter Do  Sleep(10) Until Not WinActive("Unicenter ServicePlus Service Desk - Incident Search", "http://usdp/CAisd/pdmweb.exe") _key_clean_1() if WinActive ("Incident Category Selection - Unicenter ServicePlus Service Desk", "http://usdp/CAisd/html/popup_frames.html?POPUP_URLIX=0") then _win12_func() EndFunc   ;==>_win7D_funcFunc _win7D2_func() ;Unicenter ServicePlus Service Desk - Problem Search HotKeySet("{F1}", "_F1G_Func");turns key on for help HotKeySet("{F2}", "_F2_Func");turns key on for Search Request HotKeySet("{F3}", "_F3_Func");turns key on for Search Incident HotKeySet("^{F3}", "_F3b_Func");turns key on for Search Change Order HotKeySet("{F5}", "_F5B_Func");turns key on Refresh current querry HotKeySet("{F10}", "_F10_Func");turns key on for close Unicenter Do  Sleep(10) Until Not WinActive("Unicenter ServicePlus Service Desk - Problem Search", "http://usdp/CAisd/pdmweb.exe") _key_clean_1() if WinActive ("Problem Category Selection - Unicenter ServicePlus Service Desk", "http://usdp/CAisd/html/popup_frames.html?POPUP_URLIX=0") then _win12_func() EndFunc   ;==>_win7D_funcFunc _win7E_func() ;Unicenter ServicePlus Service Desk - Request Search HotKeySet("{F1}", "_F1G_Func");turns key on for help HotKeySet("{F2}", "_F2_Func");turns key on for Search Request HotKeySet("{F3}", "_F3_Func");turns key on for Search Request HotKeySet("^{F3}", "_F3b_Func");turns key on for Search Change Order HotKeySet("{F5}", "_F5B_Func");turns key on Refresh current querry HotKeySet("{F10}", "_F10_Func");turns key on for close Unicenter Do  Sleep(10) Until Not WinActive("Unicenter ServicePlus Service Desk - Request Search", "http://usdp/CAisd/pdmweb.exe") _key_clean_1()EndFunc   ;==>_win7E_funcFunc _win7F_func() ;Unicenter ServicePlus Service Desk - Change Order Search HotKeySet("{F1}", "_F1G_Func");turns key on for help HotKeySet("{F2}", "_F2_Func");turns key on for Search Request HotKeySet("{F3}", "_F3_Func");turns key on for Search Request HotKeySet("^{F3}", "_F3b_Func");turns key on for Search Change Order HotKeySet("{F5}", "_F5B_Func");turns key on Refresh current querry HotKeySet("{F10}", "_F10_Func");turns key on for close Unicenter Do  Sleep(10) Until Not WinActive("Unicenter ServicePlus Service Desk - Change Order Search", "http://usdp/CAisd/pdmweb.exe") _key_clean_1()EndFunc   ;==>_win7F_funcFunc _win7G_func() ;Unicenter ServicePlus Service Desk - Change Order List HotKeySet("{F1}", "_F1G_Func");turns key on for help HotKeySet("{F2}", "_F2_Func");turns key on for Search Request HotKeySet("{F3}", "_F3_Func");turns key on for Search Request HotKeySet("^{F3}", "_F3b_Func");turns key on for Search Change Order HotKeySet("{F5}", "_F5B_Func");turns key on Refresh current querry HotKeySet("{F10}", "_F10_Func");turns key on for close Unicenter Do  Sleep(10) Until Not WinActive("Unicenter ServicePlus Service Desk - Change Order List", "http://usdp/CAisd/pdmweb.exe") _key_clean_1()EndFunc   ;==>_win7G_funcFunc _win8_func() ;Service Request HotKeySet("{PRINTSCREEN}", "_key3_Func"); Print Service Request HotKeySet("{F9}", "_F9A_Func");Turns on key for TimeStamp Do  Sleep(10) Until Not WinActive("Service Request", "equest.nsf") _key_clean_1()EndFunc   ;==>_win8_funcFunc _win8a_func() ;Work Order: Ad Hoc HotKeySet("{PRINTSCREEN}", "_key3_Func"); Print Work Order HotKeySet("{F9}", "_F9A_Func");Turns on key for TimeStamp Do  Sleep(10) Until Not WinActive("Work Order: Ad Hoc") _key_clean_1()EndFunc   ;==>_win8a_funcFunc _win8a2_func() ;Work Order: Ad Hoc HotKeySet("{PRINTSCREEN}", "_key3_Func"); Print Work Order HotKeySet("{F9}", "_F9A_Func");Turns on key for TimeStamp Do  Sleep(10) Until Not WinActive("Master PCAR List") _key_clean_1()EndFunc   ;==>_win8a2_funcFunc _win8b_func() ;Depot Ordering System - Order # HotKeySet("{PRINTSCREEN}", "_key3_Func"); Print Depot order Do  Sleep(10) Until Not WinActive("Depot Ordering System - Order #") _key_clean_1()EndFunc   ;==>_win8b_funcFunc _win8c_func() ;Create New Activity for HotKeySet("{F9}", "_F9A_Func");Turns on key for TimeStamp Do  Sleep(10) Until Not WinActive("Create New Activity for") _key_clean_1()EndFunc   ;==>_win8c_funcFunc _win9_func() ;Master Page", "http://dcam.stsc.suntrust.com/PageSetup/master_page.asp HotKeySet("{PRINTSCREEN}", "_key4a_Func"); Print Argus Do  Sleep(10) Until Not WinActive("Master Page", "http://dcam.stsc.suntrust.com/PageSetup/master_page.asp") _key_clean_1()EndFunc   ;==>_win9_funcFunc _win10_func() ;Message (HTML)", "Menu Bar HotKeySet("{PRINTSCREEN}", "_key4_Func"); Print Email Do  Sleep(10) Until Not WinActive("Message (HTML)", "Menu Bar") _key_clean_1()EndFunc   ;==>_win10_funcFunc _win11_func() ;Inbox - Microsoft Outlook HotKeySet("{PRINTSCREEN}", "_key5_Func"); Print Email Do  Sleep(10) Until Not WinActive("Inbox - Microsoft Outlook") _key_clean_1()EndFunc   ;==>_win11_func#endregion #region ; hel windows section;F1 section - HelpFunc _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.") ElseIf WinExists("Help in") Then  Sleep(10) Else  ;$fkeyV = IniRead("unplus.ini", "Qkeys", "msg", "")   ;old  $fkeyV = IniRead("bin\unplus.ini", @UserName, "msg", "")  $help_R = GUICreate("Help in Request Ticket view", 445, 150, -1, -1, $WS_DLGFRAME)  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)  GUICtrlSetOnEvent($button1, "_closewin")  GUISetState() EndIfEndFunc   ;==>_F1A_FuncFunc _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.") ElseIf WinExists("Help in") Then  Sleep(10) Else  $fkeyV = IniRead("bin\unplus.ini", @UserName, "msg", "")  $help_R = GUICreate("Help in Incident Ticket view", 445, 150, -1, -1, $WS_DLGFRAME)  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)  GUICtrlSetOnEvent($button1, "_closewin")  GUISetState() EndIfEndFunc   ;==>_F1B_FuncFunc _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.") ElseIf WinExists("Help in") Then  Sleep(10) Else  $fkeyV = IniRead("bin\unplus.ini", @UserName, "msg", "")  $help_R = GUICreate("Help in Problem Ticket view", 445, 150, -1, -1, $WS_DLGFRAME)  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, "", $WS_DLGFRAME)  GUICtrlSetOnEvent($button1, "_closewin")  GUISetState() EndIfEndFunc   ;==>_F1C_FuncFunc _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.") ElseIf WinExists("Help in") Then  Sleep(10) Else  $fkeyV = IniRead("bin\unplus.ini", @UserName, "msg", "")  $help_R = GUICreate("Help in Update Incident view", 445, 150, -1, -1, $WS_DLGFRAME)  GUISetBkColor(0xE0FFFF)  GUICtrlCreateLabel("F1= Opens a help file showing the functions." & @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 _     & "F8= Resolution: This will change the view to the resolution field in edit mode." & @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)  GUICtrlSetOnEvent($button1, "_closewin")  GUISetState() EndIfEndFunc   ;==>_F1D_FuncFunc _F1Da_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.") ElseIf WinExists("Help in") Then  Sleep(10) Else  $fkeyV = IniRead("bin\unplus.ini", @UserName, "msg", "")  $help_R = GUICreate("Help in New Incident view", 445, 150, -1, -1, $WS_DLGFRAME)  GUISetBkColor(0xE0FFFF)  GUICtrlCreateLabel("F1= Opens a help file showing the functions." & @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)  GUICtrlSetOnEvent($button1, "_closewin")  GUISetState() EndIfEndFunc   ;==>_F1Da_FuncFunc _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.") ElseIf WinExists("Help in") Then  Sleep(10) Else  $fkeyV = IniRead("bin\unplus.ini", @UserName, "msg", "")  $help_R = GUICreate("Help in Update Request view", 445, 150, -1, -1, $WS_DLGFRAME)  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)  GUICtrlSetOnEvent($button1, "_closewin")  GUISetState() EndIfEndFunc   ;==>_F1E_FuncFunc _F1Ea_Func();Help in New 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.") ElseIf WinExists("Help in") Then  Sleep(10) Else  $fkeyV = IniRead("bin\unplus.ini", @UserName, "msg", "")  $help_R = GUICreate("Help in New Request view", 445, 150, -1, -1, $WS_DLGFRAME)  GUISetBkColor(0xCCFFCC)  GUICtrlCreateLabel("F1= Opens a help file showing the functions." & @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)  GUICtrlSetOnEvent($button1, "_closewin")  GUISetState() EndIfEndFunc   ;==>_F1Ea_FuncFunc _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.") ElseIf WinExists("Help in") Then  Sleep(10) Else  $fkeyV = IniRead("bin\unplus.ini", @UserName, "msg", "")  $help_R = GUICreate("Help in Update Problem view", 445, 150, -1, -1, $WS_DLGFRAME)  GUISetBkColor(0xCCFFCC)  GUICtrlCreateLabel("F1= Opens a help file showing the functions." & @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 _     & "F8= Resolution: This will change the view to the resolution field in edit mode." & @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)  GUICtrlSetOnEvent($button1, "_closewin")  GUISetState() EndIfEndFunc   ;==>_F1F_FuncFunc _F1Fa_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.") ElseIf WinExists("Help in") Then  Sleep(10) Else  $fkeyV = IniRead("bin\unplus.ini", @UserName, "msg", "")  $help_R = GUICreate("Help in New Problem view", 445, 150, -1, -1, $WS_DLGFRAME)  GUISetBkColor(0xCCFFCC)  GUICtrlCreateLabel("F1= Opens a help file showing the functions." & @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 _     & "F8= Resolution: This will change the view to the resolution field in edit mode." & @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)  GUICtrlSetOnEvent($button1, "_closewin")  GUISetState() EndIfEndFunc   ;==>_F1Fa_FuncFunc _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.") ElseIf WinExists("Help in") Then  Sleep(10) Else  $fkeyV = IniRead("bin\unplus.ini", @UserName, "msg", "")  $help_R = GUICreate("Help in Main Window view", 445, 150, -1, -1, $WS_DLGFRAME)  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 _     & "F10= Logout: This will log you out of Unicenter", 5, 5, 440, 95)  $button1 = GUICtrlCreateButton("OK", 185, 102, 60, 20)  GUICtrlSetOnEvent($button1, "_closewin")  GUISetState() EndIfEndFunc   ;==>_F1G_Func;---------------------------------#endregion;F2 Section: Search RequestFunc _F2_Func(); Search Request $INIre = IniRead("bin\unplus.ini", @UserName, "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  iniwrite("bin\unplus.ini",@UserName, "action", "1");  $mschk = PixelSearch(1, 133, 1400, 133, 0x9CC6E7, 10)  $mschk = PixelSearch(1, 70, 1000, 300, 0x9CC6E7, 5)  ;266 is pixel I'm looking for    $xm = ($mschk[0] + 478)  ControlSend("Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "!e", 0)  Sleep(5)  ControlSend("Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "r", 0)  WinWaitActive( "Unicenter ServicePlus Service Desk", "Opening", 1)  Sleep(200)  WinWaitActive( "Unicenter ServicePlus Service Desk - Request Search", "Done", 1)  BlockInput(1)  $x = 1  while 7    WinActivate("Unicenter ServicePlus Service Desk - Request Search", "Done")   $colorwin = PixelSearch($xm, 400, $xm + 30, 416, 14079694, 10)   if @error = 1 then     sleep(2)   Else    ExitLoop   EndIf   WEnd    $mschk1 = MouseGetPos()  MouseMove($xm , 305,0)   Do   $a = 1   $xa = $a + 1      MouseClick("left", $xm, 305 + $xa, 1, 0)   $color2 = PixelGetColor($xm, 305 + $xa)      sleep(100)   Until $color2 = 16777116 or $color2 = 16777113 or $xa = 20  mousemove($mschk1[0], $mschk1[1], 0)  _F2_chk1()    $g = 1  While 2    $g = $g + 1   $search1 = IniRead("bin\unplus.ini", @UserName, "searchrequest", "")   $info = string(ClipGet())   if $search1 = $info then     ExitLoop   Elseif $g = 10 then    ExitLoop   Else    _F2_chk1()   EndIf   wend  BlockInput(0)  sleep(100)  send("!s")   sleep(1000)  iniwrite("bin\unplus.ini",@UserName, "action", "0")   Else  iniwrite("bin\unplus.ini",@UserName, "action", "1")  RunWait("alert1")  BlockInput(1)  ControlSend("Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "!e", 0)  Sleep(5)  ControlSend("Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "r", 0)  Sleep(3500)  WinActivate("Unicenter ServicePlus Service Desk - Request Search", "http://usdp/CAisd/pdmweb.exe")  ControlSend("Unicenter ServicePlus Service Desk - Request Search", "", "Internet Explorer_Server1", "{TAB}", 0)  Sleep(200)  WinActivate("Unicenter ServicePlus Service Desk - Request Search", "http://usdp/CAisd/pdmweb.exe")  ControlSend("Unicenter ServicePlus Service Desk - Request Search", "", "Internet Explorer_Server1", "{RIGHT}", 0)  Sleep(50)  WinActivate("Unicenter ServicePlus Service Desk - Request Search", "http://usdp/CAisd/pdmweb.exe")  ControlSend("Unicenter ServicePlus Service Desk - Request Search", "", "Internet Explorer_Server1", "{RIGHT}", 0)  Sleep(50)  $note1 = IniRead("bin\unplus.ini", @UserName, "searchrequest", "")  WinActivate("Unicenter ServicePlus Service Desk - Request Search", "http://usdp/CAisd/pdmweb.exe")  Send($note1)  ControlSend("Unicenter ServicePlus Service Desk - Request Search", "", "Internet Explorer_Server1", "!s", 0)  BlockInput(0)  iniwrite("bin\unplus.ini",@UserName, "action", "0") EndIfEndFunc   ;==>_F2_FuncFunc _F2_chk1()   $search1 = IniRead("bin\unplus.ini", @UserName, "searchrequest", "")   sleep(300)      Send($search1)   ClipPut("")   send("^a")   sleep(10)   send("^c")   sleep(5)   send("^c")EndFunc ;----------------------------------;F3 Section; F3: Search IncidentFunc _F3_Func(); Search Incident $INIin = IniRead("bin\unplus.ini", @UserName, "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  iniwrite("bin\unplus.ini",@UserName, "action", "1")  $mschk1 = PixelSearch(1, 70, 1000, 300, 0x9CC6E7, 5)  ;266 is pixel I'm looking for  ;MsgBox(0, "","X =" & $mschk1[0] & "  Y = " & $mschk1[1])  $xm = $mschk1[0]+453  $xm1 = $mschk1[0]+381  $xn = ($XM + 97)  ControlSend("Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "!e", 0)  Sleep(5)  ControlSend("Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "i", 0)  WinWait( "Unicenter ServicePlus Service Desk", "Opening", 1)  Sleep(200)  WinWait( "Unicenter ServicePlus Service Desk - Incident Search", "Done", 3)  $x = 1  while 7    WinActivate("Unicenter ServicePlus Service Desk - Incident Search", "Done")   $colorwin = PixelSearch($xm1, 400, $xm1 + 30, 416, 14079694, 10)   ;MsgBox(0, "","X =" & $colorwin[0] & "  Y = " & $colorwin[1])   if @error = 1 then     sleep(2)   Else    ExitLoop   EndIf   WEnd  BlockInput(1)  ;sleep(10)  $mschk = MouseGetPos()  MouseMove($xm , 263,0)  sleep(3)  MouseClick("left", $xm , 263, 1, 0)  sleep(5)  mousemove($mschk[0], $mschk[1], 0)   _F3_chk1()  $g = 1  While 2   $g = $g + 1     $search1 = IniRead("bin\unplus.ini", @UserName, "searchincident", "")  $info = string(ClipGet())  if $search1 = $info then    ExitLoop  Elseif $g = 10 then   ExitLoop   Else   _F3_chk1()  EndIf   wend  sleep(100)  send("!s")  BlockInput(0)  iniwrite("bin\unplus.ini",@UserName, "action", "0") Else  iniwrite("bin\unplus.ini",@UserName, "action", "1")  RunWait("alert1")  BlockInput(1)  ControlSend("Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "!e", 0)  Sleep(300)  WinActivate("Unicenter ServicePlus Service Desk", "http://usdp/CAisd/pdmweb.exe")  ControlSend("Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "i", 0)  Sleep(3000)  WinActivate("Unicenter ServicePlus Service Desk", "http://usdp/CAisd/pdmweb.exe")  ControlSend("Unicenter ServicePlus Service Desk - Incident Search", "", "Internet Explorer_Server1", "{RIGHT}", 0)  WinActivate("Unicenter ServicePlus Service Desk", "http://usdp/CAisd/pdmweb.exe")  Sleep(20)  WinActivate("Unicenter ServicePlus Service Desk", "http://usdp/CAisd/pdmweb.exe")  ControlSend("Unicenter ServicePlus Service Desk - Incident Search", "", "Internet Explorer_Server1", "{RIGHT}", 0)  WinActivate("Unicenter ServicePlus Service Desk", "http://usdp/CAisd/pdmweb.exe")  Sleep(20)  $note1 = IniRead("unplus.ini", @UserName, "searchincident", "")  ControlSend("Unicenter ServicePlus Service Desk - Incident Search", "", "Internet Explorer_Server1", $note1, 0)  WinActivate("Unicenter ServicePlus Service Desk", "http://usdp/CAisd/pdmweb.exe")  ControlSend("Unicenter ServicePlus Service Desk - Incident Search", "", "Internet Explorer_Server1", "!s", 0)  BlockInput(0)  iniwrite("bin\unplus.ini",@UserName, "action", "0") EndIfEndFunc   ;==>_F3_Func Func _F3_chk1()   $search1 = IniRead("bin\unplus.ini", @UserName, "searchincident", "")   sleep(300)      Send($search1)   ClipPut("")   send("^a")   sleep(10)   send("^c")   sleep(5)   send("^c")EndFunc   Func _F3b_Func(); Search Change Order $INIin = IniRead("bin\unplus.ini", @UserName, "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  iniwrite("bin\unplus.ini",@UserName, "action", "1")  ControlSend("Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "!e", 0)  Sleep(5)  ControlSend("Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "c", 0)  WinWait( "Unicenter ServicePlus Service Desk", "Opening", 1)  Sleep(200)  WinWait( "Unicenter ServicePlus Service Desk - Change Order Search", "Done", 3)  sleep(400)  ControlSend("Unicenter ServicePlus Service Desk - Change Order Search", "", "Internet Explorer_Server1", "{RIGHT}", 0)  Sleep(35)  ControlSend("Unicenter ServicePlus Service Desk - Change Order Search", "", "Internet Explorer_Server1", "{RIGHT}", 0)  $search1 = IniRead("bin\unplus.ini", @UserName, "changeorder", "")  Sleep(20)  send($search1)  ;ControlSend("Unicenter ServicePlus Service Desk - Incident Search", "", "Internet Explorer_Server1", "CTS-MA", 1) ;$search1, 1)  Sleep(5)  ControlSend("Unicenter ServicePlus Service Desk - Change Order Search", "", "Internet Explorer_Server1", "!s", 0)  Sleep(1000)  iniwrite("bin\unplus.ini",@UserName, "action", "0") Else  iniwrite("bin\unplus.ini",@UserName, "action", "1")  RunWait("alert1")  BlockInput(1)  ControlSend("Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "!e", 0)  Sleep(300)  WinActivate("Unicenter ServicePlus Service Desk", "http://usdp/CAisd/pdmweb.exe")  ControlSend("Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "c", 0)  Sleep(3000)  WinActivate("Unicenter ServicePlus Service Desk", "http://usdp/CAisd/pdmweb.exe")  ControlSend("Unicenter ServicePlus Service Desk - Change Order Search", "", "Internet Explorer_Server1", "{RIGHT}", 0)  WinActivate("Unicenter ServicePlus Service Desk", "http://usdp/CAisd/pdmweb.exe")  Sleep(20)  WinActivate("Unicenter ServicePlus Service Desk", "http://usdp/CAisd/pdmweb.exe")  ControlSend("Unicenter ServicePlus Service Desk - Change Order Search", "", "Internet Explorer_Server1", "{RIGHT}", 0)  WinActivate("Unicenter ServicePlus Service Desk", "http://usdp/CAisd/pdmweb.exe")  Sleep(20)  $note1 = IniRead("unplus.ini", @UserName, "changeorder", "")  ControlSend("Unicenter ServicePlus Service Desk - Change Order Search", "", "Internet Explorer_Server1", $note1, 0)  WinActivate("Unicenter ServicePlus Service Desk", "http://usdp/CAisd/pdmweb.exe")  ControlSend("Unicenter ServicePlus Service Desk - Change Order Search", "", "Internet Explorer_Server1", "!s", 0)  BlockInput(0)  iniwrite("bin\unplus.ini",@UserName, "action", "0") EndIfEndFunc;--------------------------;F4 SectionFunc _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) EndIfEndFunc   ;==>_F4_Func;-----------------------------;F5 Section; F5A: Refresh TIcket; F5B: Refresh ListFunc _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("f")  BlockInput(0) EndIfEndFunc   ;==>_F5A_FuncFunc _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) EndIfEndFunc   ;==>_F5B_Func;----------------------------;F6 SectionFunc _F6_Func(); QuickPaste RunWait("quickpaste2_0.exe", "")EndFunc   ;==>_F6_Func;----------------------------;F8 SectionFunc _F8_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") EndIfEndFunc   ;==>_F8_Func;F9 SectionFunc _F9A_Func(); TimeStamp $sLongDayName = _DateDayOfWeek(@WDAY) $stamp = _NowTime() $stamp2 = _NowDate() if WinActive("Service Request", "equest.nsf")then   send("---------------------------")  send("{ENTER}") endif  sleep(20) Send(@UserName & ": " & $sLongDayName & " " & $stamp2 & ", " & $stamp & ": ") ;EndIfEndFunc   ;==>_F9A_Func;---------------------------;F10 SectionFunc _F10_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  ProcessClose("maintoolbar.exe")  Send("!u")  Send("!e")  Exit EndIfEndFunc   ;==>_F10_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  ProcessClose("maintoolbar.exe")  Exit EndIfEndFunc   ;==>_key1_FuncFunc _key2_Func(); Print tickets $check1 = IniRead("bin/unplus.ini", @UserName, "button", "") If WinExists("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Then  WinActivate("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.")  ;Sleep(1) EndIf If $check1 = "default" Then  WinWaitActive("Incident Detail - Unicenter ServicePlus Service Desk")  ControlSend("Incident Detail - Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "!f", 0)  ControlSend("Incident Detail - Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "t", 0)  WinWait("Print", "General", 5)  ControlSend("Print", "General", "Button13", "!p", 0) Else  Sleep(1)  _key2c_Func() EndIfEndFunc   ;==>_key2_FuncFunc _key2c_Func(); Print tickets If WinExists("CAisd report - indtl.rpt") Then  WinActivate("CAisd report - indtl.rpt")  ControlSend("CAisd report - indtl.rpt", "", "Internet Explorer_Server1", "!p", 0)  WinWait("Print", "General", 5)  ControlSend("Print", "General", "Button13", "!p", 0)  WinClose("CAisd report - indtl.rpt") Else  WinWaitActive("Incident Detail - Unicenter ServicePlus Service Desk")  ControlSend("Incident Detail - Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "!r", 0)  Sleep(30)  ControlSend("Incident Detail - Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "d", 0)  WinWait("CAisd report - indtl.rpt", "Opening", 9)  WinWait("CAisd report - indtl.rpt", "done", 5)  WinWait("CAisd report - indtl.rpt", "Opening", 7)  Sleep(1000)  ControlSend("CAisd report - indtl.rpt", "", "Internet Explorer_Server1", "!p", 0)  WinWait("Print", "General", 5)  ControlSend("Print", "General", "Button13", "!p", 0)  WinClose("CAisd report - indtl.rpt") EndIfEndFunc   ;==>_key2c_FuncFunc _key2a_Func(); Print tickets $check1 = IniRead("bin/unplus.ini", @UserName, "button", "") If WinExists("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Then  WinActivate("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.")  Sleep(1) EndIf If $check1 = "default" Then  WinWaitActive("Request Detail - Unicenter ServicePlus Service Desk")  ControlSend("Request Detail - Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "!f", 0)  ControlSend("Request Detail - Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "t", 0)  WinWait("Print", "General", 5)  ControlSend("Print", "General", "Button13", "!p", 0) Else  Sleep(1)  _key2b_Func() EndIfEndFunc   ;==>_key2a_FuncFunc _key2b_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.")  Sleep(1) EndIf If WinExists("CAisd report - indtl.rpt") Then  WinActivate("CAisd report - indtl.rpt")  ControlSend("CAisd report - indtl.rpt", "", "Internet Explorer_Server1", "!p", 0)  WinWait("Print", "General", 5)  ControlSend("Print", "General", "Button13", "!p", 0)  WinClose("CAisd report - indtl.rpt") Else  WinWaitActive("Request Detail - Unicenter ServicePlus Service Desk")  ControlSend("Request Detail - Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "!p", 0)  Sleep(30)  ControlSend("Request Detail - Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "d", 0)  WinWait("CAisd report - indtl.rpt", "Opening", 9)  WinWait("CAisd report - indtl.rpt", "done", 5)  WinWait("CAisd report - indtl.rpt", "Opening", 7)  Sleep(1000)  ControlSend("CAisd report - indtl.rpt", "", "Internet Explorer_Server1", "!p", 0)  WinWait("Print", "General", 5)  ControlSend("Print", "General", "Button13", "!p", 0)  WinClose("CAisd report - indtl.rpt") EndIfEndFunc   ;==>_key2b_FuncFunc _key3_Func(); Print Service request WinActivate("Service Request", "equest.nsf") Send("^p") Sleep(100) WinWait("Print", "", 7) Sleep(100) WinActivate("Print") Sleep(150) Send("!p")EndFunc   ;==>_key3_FuncFunc _key3a_Func(); Print Service request WinActivate("Depot Ordering System - Order #") Send("^p") Sleep(100) WinWait("Print", "", 7) Sleep(100) WinActivate("Print") Sleep(150) Send("!p")EndFunc   ;==>_key3a_FuncFunc _key4_Func(); Print email WinActivate("Message (HTML)", "Menu Bar") Send("!f") Sleep(100) Send("p") WinWait("Print", "", 7) Sleep(100) WinActivate("Print") Sleep(200) Send("!p")EndFunc   ;==>_key4_FuncFunc _key4a_Func(); Print Argis WinActivate("Master Page", "http://dcam.stsc.suntrust.com/PageSetup/master_page.asp") Send("^p") Sleep(100) WinWait("Print", "", 7) Sleep(100) WinActivate("Print") Sleep(150) Send("!p")EndFunc   ;==>_key4a_FuncFunc _key5_Func(); Print email WinActivate("Inbox - Microsoft Outlook") Send("^p") Sleep(100) WinWait("Print", "", 15) Sleep(50) WinActivate("Print") Sleep(50) Send("{ENTER}")EndFunc   ;==>_key5_FuncFunc _key_clean_1() ;Releases hotsetkeys HotKeySet("{F1}"); turns help off HotKeySet("{F2}"); turns Request off HotKeySet("{F3}"); turns Incident off HotKeySet("{F4}"); turns TreePaste off HotKeySet("{F5}"); turns refresh off HotKeySet("{F8}"); turns Resolution off HotKeySet("{F9}"); turns TimeStamp off HotKeySet("{PRINTSCREEN}"); Turns Print ticket offEndFunc   ;==>_key_clean_1Func _closewin() GUIDelete($help_R)EndFunc   ;==>_closewinFunc _CheckProcess($sTitle) Local $Win_List, $UnicenterList $UnicenterList = WinList($sTitle) If $Unicenter_iPID <> '' Then  For $x = 1 To $UnicenterList[0][0]   If StringInStr($Unicenter_iPID, String($UnicenterList[$x][1])) == 0 Then    $Unicenter_iPID &= '|' & $UnicenterList[$x][1]    Run("IVtool.exe " & '"' & $UnicenterList[$x][0] & '"')    Return ($UnicenterList[$x][0])   EndIf  Next Else  For $x = 1 To $UnicenterList[0][0]   $Unicenter_iPID &= '|' & $UnicenterList[$x][1]  Next  If StringLeft($Unicenter_iPID, 1) == '|' Then $Unicenter_iPID = StringTrimLeft($Unicenter_iPID, 1)  Run("IVtool.exe " & '"' & $UnicenterList[1][0] & '"')  Return ($UnicenterList[1][0]) EndIf Return (0)EndFunc   ;==>_CheckProcessFunc _pmsg1() $msgG = GUICreate("Message...", 277, 121, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Label_1 = GUICtrlCreateLabel("Your mouse and keyboard control are temporally disabled while the ticket is being printed. ", 20, 20, 260, 30) $Checkbox_2 = GUICtrlCreateCheckbox("Check this box to disable this message", 20, 60, 200, 20) $buttonmA_1 = GUICtrlCreateButton("Ok", 125, 90, 40, 20) GUISetState(@SW_HIDE) $msg2 = IniRead("bin/UNPlus.ini", @UserName, "printwarning", "") While 8  If $msg2 = 4 Then ExitLoop  If $msg2 = 1 Then GUISetState(@SW_SHOW)  While 9   $msg = GUIGetMsg()   Select    Case $msg = $GUI_EVENT_CLOSE     GUIDelete($msgG)     ExitLoop    Case $msg = $Checkbox_2     $cbox = GUICtrlRead($Checkbox_2)     If $cbox = 4 Then      IniWrite("bin/UNPlus.ini", @UserName, "printwarning", "1")     EndIf     If $cbox = 1 Then      IniWrite("bin/UNPlus.ini", @UserName, "printwarning", "4")     EndIf    Case $msg = $buttonmA_1     GUIDelete($msgG)     ExitLoop   EndSelect  WEnd  ExitLoop WEndEndFunc   ;==>_pmsg1

Share this post


Link to post
Share on other sites

Change your code to somthing like this:

$active = WinGetTitle("");Get active window title
Switch $active
   case "1"
   case "2"
      ; TODO Create new test againts Text!
   case else
     ;;;
WndSwitch

Your select ...case code triggers a loot of similar test. :)

Share this post


Link to post
Share on other sites

LOL, how do you keep track of all that :)


[center]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.[/center]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I think I understand what was suggested to me by Uten, but according to the help file, the case is executed if the expression is between the two values. I need it to be just one value, and any time it is active, it would work. Does this work like GUIOnEventMode? This is one of the things I'm confused about. Also, if the case statement is else, how do I get out of it if something I want to interact with is then made active? Do I need to run this inside a loop? Hope I'm making sence here....

still need coffee..... :)

Edited by vollyman

Share this post


Link to post
Share on other sites

1

add the sleep back in

Sleep(50)

2

change they way you use case winactive over and over again to...

$Title_test = WinGetTitle(WinActive())
Select
;;This section monitors if certain windows are open.
;;If they are, the hotkeysets for those windows are active.
;<:::Keys for Request Detail:::>
Case $Title_test = "Request Detail - Unicenter ServicePlus Service Desk"
....

3

you need to move the iniread in the loop so it does not need to read everytime the loop passes

4

maybe remove AutoItSetOption("TrayIconDebug", 1)

( this is not totally necessary on a running script

hope that helps

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Hei @Vollyman, I think you need sleep not coffe :)

@Valuator has done a deeper study of your code than I did. His nr 2 is the same as I suggested but slightly different code.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Ok, I did this:

While 1
 sleep(20)
 $Title_test = WinGetTitle("") 
 select
  Case $Title_test = "Request Detail - Unicenter ServicePlus Service Desk"
   $Title = _CheckProcess("Request Detail - Unicenter ServicePlus Service Desk")
   _win1_func() 
   ContinueLoop
  Case $Title_test = "Incident Detail - Unicenter ServicePlus Service Desk"
   $Title = _CheckProcess("Incident Detail - Unicenter ServicePlus Service Desk")
   _win2_func() 
   ContinueLoop
  Case $Title_test = "Problem Detail - Unicenter ServicePlus Service Desk"
   $Title = _CheckProcess("Problem Detail - Unicenter ServicePlus Service Desk")
   _win3_func() 
   ContinueLoop
  Case $Title_test = "Update Incident - Unicenter ServicePlus Service Desk"
   $Title = _CheckProcess("Update Incident - Unicenter ServicePlus Service Desk")
   _win4_func() 
   ContinueLoop
  Case $Title_test = "New Incident"
   $Title = _CheckProcess("New Incident")
   _win4a_func() 
   ContinueLoop
  Case $Title_test = "Update Request - Unicenter ServicePlus Service Desk"
   $Title = _CheckProcess("Update Request - Unicenter ServicePlus Service Desk")
   _win5_func() 
   ContinueLoop
endselect
wend

Processor time is fixed, but now it will not see the windows I need it to see. I have to use a partial window names for the names of the window will be different for they put the ticket number in the window title.

example: A full window name would be:

2088503 Incident Detail - Unicenter ServicePlus Service Desk - Microsoft Internet Explorer provided by XXXXXXXXXXXX, Inc.

I need to cut off the numbers due to it changes for each ticket, and I cut off the Microsoft Internet Explorer provided by XXXXXXXXXXXX, Inc. for it isn't needed. I know I could do a string change, but I like to do it and be less messy. Also other windows do not have this type of name, but I need to be able to find them. Example being this:

Master Page - Argis Web Change - Microsoft Internet Explorer provided by XXXXXXXXXXXXX, Inc.

There are no numbers in this title, and I also may need to get visible or hidden window text to make sure I get the window I want.

To put it simply, how do I use WinGetTitle and match it with a partial window name?

Also; $Title_test = WinGetTitle(Winactive()) doesn't work. get a error:ERROR: WinActive() [built-in] called with wrong number of args.

Edit: I can not use I.E.au3 due to the nature of the windows I deal with. Been there, tried on the t-shirt, didn't fix, left the store....

Edited by vollyman

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

use opt #2

WinTitleMatchMode Alters the method that is used to match window titles during search operations.

1 = Match the title from the start (default)

2 = Match any substring in the title

3 = Exact title match

4 = Advanced mode, see a href="."/intro/windowsadvanced.htm">Window Titles & Text (Advanced)

8)

EDIT... maybe that wont work with the last change....

maybe string in string.... again may use cpu ...???? dunno

Case StringInStr($Title_test,"Request Detail - ") <> 0
Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

@Val: good catch! that did the trick. I also did this

$Title_test = WinGetTitle("")

$Text_test = WinGetText($Title_test)

Case StringInStr($Title_test,"http://dcam.stsc.suntrust.com/PageSetup/master_page.asp") <> 0 and StringInStr($Text_test,"Master Page") <> 0

This would get the text in the window, so I could use it to help see what I wanted. Thanks dude! :D

Edited by vollyman

Share this post


Link to post
Share on other sites

Ok, for those who want to have this added to their bag of tricks, here is how you keep a eye on a large group of windows with case statements and only needing a partial name of the window, and a partial text name. This method will keep the processor time in check, but you still have normal responce time for your application. I'm going off memory here, for my sorce code is at work, and if I make a mistake, please feel free to make a correction...

My many thanks to Valuater for comming up with this clever solution...

Opt("WinTitleMatchMode", 2)
while 1
sleep(10)
    $Title_test = WinGetTitle("")
    $Text_test = WinGetText($Title_test)
    select
        Case StringInStr($Title_test,"window title") <> 0 and StringInStr($Text_test,"text") <> 0
        MsgBox(0,"","window was active")
        Case StringInStr($Title_test,"window title 2") <> 0 and StringInStr($Text_test,"text 2") <> 0
        MsgBox(0,"","window 2 was active")
    EndSelect
WEnd

Share this post


Link to post
Share on other sites

Personally, I would have stuck everything in an Array, and done one simple For/Next loop.


[center]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.[/center]

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

Ok, for those who want to have this added to their bag of tricks, here is how you keep a eye on a large group of windows with case statements and only needing a partial name of the window, and a partial text name. This method will keep the processor time in check, but you still have normal responce time for your application. I'm going off memory here, for my sorce code is at work, and if I make a mistake, please feel free to make a correction...

My many thanks to Valuater for comming up with this clever solution...

I would add a $previousWindow to avoide some cyles :D

Opt("WinTitleMatchMode", 2)
Local $previousTitle=""
Local $previousText="" 
while 1
sleep(10)
    $Title_test = WinGetTitle("")
    $Text_test = WinGetText($Title_test)
        if $Title_test = $previousTitle OR $Text_test = $previousText Then 
           Sleep(100); You can assume nothing is to be done for a while
        Else
       select
        Case StringInStr($Title_test,"window title") <> 0 and StringInStr($Text_test,"text") <> 0
        MsgBox(0,"","window was active")
        Case StringInStr($Title_test,"window title 2") <> 0 and StringInStr($Text_test,"text 2") <> 0
        MsgBox(0,"","window 2 was active")
       EndSelect
        EndIf
WEnd
Edited by Uten

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