supadodger Posted April 28, 2008 Posted April 28, 2008 (edited) ive been using wingettitle and then sleeping and checking again. this isnt the actual code but you guys will get it is there any better way of doing this? $open = wingettitle super if wingettitle = 1 then sleep 5000 else Goto Waiting Endif $open = wingettitle super if wingettitle = 1 then run c:\blah.exe else Endif Edited April 28, 2008 by supadodger
PsaltyDS Posted April 28, 2008 Posted April 28, 2008 ive been using wingettitle and then sleeping and checking again.this isnt the actual code but you guys will get itis there any better way of doing this?$open = wingettitle superif wingettitle = 1 then sleep 5000elseGoto WaitingEndif$open = wingettitle superif wingettitle = 1 then run c:\blah.exeelseEndifThat's some pretty hopeless scripting. AutoIt requires parens around the function parameters (see the help file). WinGetTitle() returns a string (see the help file). There is no GOTO in AutoIt (see the help file).See the help file. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
everseeker Posted April 28, 2008 Posted April 28, 2008 That's some pretty hopeless scripting. AutoIt requires parens around the function parameters (see the help file). WinGetTitle() returns a string (see the help file). There is no GOTO in AutoIt (see the help file).See the help file. this isnt the actual code this isnt the actual code = Pseudocode <> proper formatting(and, since we do not have any methods except for functions, there SHOULD be a way to unconditionally branch... as in On Error Goto...)it would have saved me about 100 lines of code in my most recent project (and made the result a LOT more readable) Everseeker
supadodger Posted April 28, 2008 Author Posted April 28, 2008 That's some pretty hopeless scripting. AutoIt requires parens around the function parameters (see the help file). WinGetTitle() returns a string (see the help file). There is no GOTO in AutoIt (see the help file). See the help file. ive read the help file a bit and cant find a more efficient way of doing this. okay then. here is actual code. Func Wait() ToolTip("Sleeping Tynieko", 0, 0) WinWait ("Tyny") ToolTip("Tyny Dead?", 0, 0) Sleep (10000) $open = WinGetTitle ("Tyny", "") If $open = 1 Then ToolTip("Sleeping Tyny", 0, 0) Winclose ("Tyny") WinClose ("TynyGM") Sleep(1000) Else Endif ENdFunc is there a better way of doing this? better as in more efficient.
PsaltyDS Posted April 28, 2008 Posted April 28, 2008 this isnt the actual code this isnt the actual code = Pseudocode <> proper formattingMy mistake. Correction: That's some pretty hopeless pseudocode... (and, since we do not have any methods except for functions, there SHOULD be a way to unconditionally branch... as in On Error Goto...)it would have saved me about 100 lines of code in my most recent project (and made the result a LOT more readable)No. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
PsaltyDS Posted April 28, 2008 Posted April 28, 2008 ive read the help file a bit and cant find a more efficient way of doing this. okay then. here is actual code. Func Wait() ToolTip("Sleeping Tynieko", 0, 0) WinWait ("Tyny") ToolTip("Tyny Dead?", 0, 0) Sleep (10000) $open = WinGetTitle ("Tyny", "") If $open = 1 Then ToolTip("Sleeping Tyny", 0, 0) Winclose ("Tyny") WinClose ("TynyGM") Sleep(1000) Else Endif ENdFunc is there a better way of doing this? better as in more efficient. Are you just using WinGetTitle() to test if the window exists? Check out WinExists() (see the help file). Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
supadodger Posted April 28, 2008 Author Posted April 28, 2008 (edited) Are you just using WinGetTitle() to test if the window exists? Check out WinExists() (see the help file). it always exists and winexists finds it hidden. its hidden mostly i just need to know if its not hidden.so actually neither code is working right since both find it hidden.thats why im here. i wanna see it only if its not hidden.maybe i can do winacttivate and then winactive and see if its active to tell if its hidden. Edited April 28, 2008 by supadodger
martin Posted April 28, 2008 Posted April 28, 2008 ive read the help file a bit and cant find a more efficient way of doing this. okay then. here is actual code. Func Wait() ToolTip("Sleeping Tynieko", 0, 0) WinWait ("Tyny") ToolTip("Tyny Dead?", 0, 0) Sleep (10000) $open = WinGetTitle ("Tyny", "") If $open = 1 Then ToolTip("Sleeping Tyny", 0, 0) Winclose ("Tyny") WinClose ("TynyGM") Sleep(1000) Else Endif ENdFunc is there a better way of doing this? better as in more efficient.Maybe something like this Global $startedtiming = False, $starttime, $endtime While 1 If Exitcondition() Then Exit If WinExists("some title") Then If Not $statedtiming Then $starttime = TimerInit() $startedtiming = True EndIf Else If $startedtiming Then $endtime = TimerDiff($starttime) $startedtiming = False EndIf EndIf Sleep(100) WEnd Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
martin Posted April 28, 2008 Posted April 28, 2008 Maybe something like this Global $startedtiming = False, $starttime, $endtime While 1 If Exitcondition() Then Exit If WinExists("some title") Then If Not $statedtiming Then $starttime = TimerInit() $startedtiming = True EndIf Else If $startedtiming Then $endtime = TimerDiff($starttime) $startedtiming = False EndIf EndIf Sleep(100) WEndIf you need to know if it's visible rather than it exists then instead of if WinExists("some title") Then use if BitAND(WinGetState("some title"),2) Then Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
supadodger Posted April 28, 2008 Author Posted April 28, 2008 it always exists and winexists finds it hidden. its hidden mostly i just need to know if its not hidden.so actually neither code is working right since both find it hidden.thats why im here. i wanna see it only if its not hidden.maybe i can do winacttivate and then winactive and see if its active to tell if its hidden.i got it. thanks guys.
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