litlmike Posted April 3, 2006 Share Posted April 3, 2006 I want my script to return to the window that it was at previously, when it finishes a function. I had to set Opt("WinTitleMatchMode",4) for the pixel searches, and now $current_window_title = WinGetTitle ("") only returns the value "0". It looks like in the help file that I have to use "active" when using Opt("WinTitleMatchMode",4), but I don't know how the syntax should look? Can you tell me how it should look different? expandcollapse popup#include <IE.au3> #include <Date.au3> #include <GUIConstants.au3> Global $Paused, $cat_1, $date_a, $email, $contact, $company, $email, $title, $SysTrayPixel = 0xFF0000, $DLI_Position_X = 974 Global $DLI_Position_y = 749 , $i, $Check = 0 ;;;;;;;; Body of program would go here;;;;;;;; While 1 Opt("WinTitleMatchMode",4) Sleep(100) $coord = PixelSearch ( $DLI_Position_X - 1 , $DLI_Position_y - 1, _ $DLI_Position_X, $DLI_Position_y, $SysTrayPixel ) If Not @error And $Check = 0 Then $current_window_title = WinGetTitle ("") ToolTip($current_window_title) Sleep (10000) Click_Time_Left_Start (); If it is not the case that the color is not Found, then Start Sleep (200) WinActivate ($current_window_title) $Check = 1 ElseIf @error And $Check = 1 Then $current_window_title = WinGetTitle ("") Click_Time_Left_Pause (); If it is the case that the color is not Found, then Pause Sleep (200) WinActivate ($current_window_title) $Check = 0 EndIf WEnd ;;;;;;;; Func Click_Time_Left_Start () WinWait("TimeLeft Stopwatch","") If Not WinActive("TimeLeft Stopwatch","") Then WinActivate("TimeLeft Stopwatch","") WinWaitActive("TimeLeft Stopwatch","") Sleep (200) Send ("^s");^s Start Return EndFunc Func Click_Time_Left_Pause () WinActivate ("TimeLeft Stopwatch") Send ("^p");^p pause Return EndFunc _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
cdkid Posted April 3, 2006 Share Posted April 3, 2006 (edited) Straight from the helpfile in the "Advanced Window titles & text" sectionMode 4Advanced mode.In this mode special sequences are used in the title parameter so that window classnames and handles can be used. The text parameter remains the same.The special sequences must contain no whitespace. They are: "classname=CLASSNAME" "regexp=REGEXP" "active" "last" or "" "classname=" matches a window based on its classname. For example to identify a window that has the classname "MYCLASS1" then you would use "classname=MYCLASS1" for the title parameter. "regexp=" matches a window matching REGEXP pattern."active" matches the currently active window (same as "" in the default WinTitleMatchMode)."last" uses the last successful window match so you don't have to keep specifying the title and text again and again. e.g. AutoItSetOption("WinTitleMatchMode", 4) WinWaitActive("Untitled - Notepad") WinClose("last") ; Closes the previously matched notepad windowNote: If "classname=", "regexp=", "active", "last" or "" are not used as the title then the window matching takes place as in Mode 1 making this a good mode for general use.~cdkid Edited April 3, 2006 by cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide! Link to comment Share on other sites More sharing options...
litlmike Posted April 3, 2006 Author Share Posted April 3, 2006 Straight from the helpfile in the "Advanced Window titles & text" section~cdkidThank you. I am fully aware of the Help File and read it thouroughly before ever posting on the Forums. The problem is, I don't know what the heck it is saying. It looks to me that I need to add "active" somewhere in my script, but I don't know where.Can you please elaborate? _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
cdkid Posted April 3, 2006 Share Posted April 3, 2006 (edited) it's saying WinGetTitle("active") Will return the current active window where-as WinGetTitle("") Will return the LAST window I thought it was pretty straight-forward ~cdkid Edited April 3, 2006 by cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide! Link to comment Share on other sites More sharing options...
litlmike Posted April 3, 2006 Author Share Posted April 3, 2006 it's saying WinGetTitle("active") Will return the current active window where-as WinGetTitle("") Will return the LAST window I thought it was pretty straight-forward ~cdkid Maybe it was straight-forward, but I didn't understand it. Thanks for clarifying. _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now