i have this constantly looping -- i commented in my logic behind the coding
Code: Select all
loop
;round and round we go, when do we stop, nobody knows
{
if WinExist("ahk_exe PharmAssist.exe")
;check if window is active (or does this just check if its running though not necessarily active?)
{
windowName := WinGetTitle("A")
;get the name of the current window
windowNameText := WinGetText(windowName)
;get the text from the current window using previous variable
haystack := windowNameText
needle := "does not belong"
if instr(haystack, needle)
;search for the needle in the haystack
{
CoordMode "Mouse"
Click(1842,993)
Sleep 150
Click(1072,611)
;if it finds the needle, run this
}
else
{
sleep 5000
;if nothing is found, take a nap
}
windowName := ""
windowNameText := ""
;figured this would help with the errors to have it start empty (im burnt out at this point) :headwall:
}
}
The title of the screen i want to look at says Ship Orders (user name), so it will change for every user, not sure if i'd have to change the titlemode to regex and do "^Ship Orders" or something like that
they bounce between 2 screens. both are titled Ship Orders (user name) so that shouldn't be an issue, but when i go to another screen thats not called Ship Orders (user name), i get an error -- either an Error: Failed, or a TargetError specific to WinGetText(activeWindow1)
Code: Select all
Error: Failed
028: {
029: activeWindow1 := WinGetTitle("A")
▶ 030: windowText1 := WinGetText(activeWindow1)
031: name1 := "Ship Order"
032: If instr(windowText1, name1)
Error: Failed
029: {
030: windowName := WinGetTitle("A")
▶ 031: windowNameText := WinGetText(windowName)
032: haystack := windowNameText
033: needle := "does not belong"
this is what i need it to do
search the active screen over and over for a string of text which is shown in windows spy visible text.
if it sees it, then do a couple of clicks.
i need it to only be within a specific exe running and a specific window title which always shows Ship Order (user name -- where user name will always change)