Fl4m3Ph03n1x Posted April 21, 2012 Share Posted April 21, 2012 Hey guys, I have another newb question. So far, the only way I know of focusing a window is by using it's title. So if I have a window named "ABC" and then I want to focus a window called "AB" I have a problem, becayse substring "AB" is contained within "ABC". To fix this I tried using the command: Opt("WinTitleMatchMode", 3) API for this command can be seen here: http://www.autoitscript.com/autoit3/docs/functions/AutoItSetOption.htm However, I still get the same problem. If I focus "ABC" first, I can't focus "AB" after. Here is my script so far: expandcollapse popup; ; AutoIt Version: 1.0 ; Language: English ; Platform: Windows 7 ; Author: Fl4m3Ph03n1x ; ; Script Function: ; Opens MTGT, goes to the Auctions house and then loops infinetly to get it's data. ; ;Alters the method used to search window titles. For more info see also: ;http://www.autoitscript.com/autoit3/docs/functions/AutoItSetOption.htm Opt("WinTitleMatchMode", 3) ; Prompt the user to run the script - use a Yes/No prompt (4 - see help file) Local $answer = MsgBox(4, "MTGT looper", "This script will run MTGT and then, go to the Auctions House and then run an infinite loop actualizing the trades.dat file. Run?") ; Check the user's answer to the prompt (see the help file for MsgBox return values) ; If "No" was clicked (7) then exit the script If $answer = 7 Then MsgBox(0, "AutoIt", "OK. Bye!") Exit EndIf Local $launcherName = "Magic The Gathering Tactics" Local $gameExeName = "Magic Tactics" ; Run Launcher ShellExecute("C:\Users\Public\Sony Online Entertainment\Installed Games\Magic The Gathering Tactics\LaunchPad.exe") ; Wait for the Firefox become active WinWaitActive($launcherName) MouseMove ( 900, 600) MouseClick ( "left") WinWaitActive($gameExeName) WinActivate($gameExeName) MouseMove ( 900, 600) MouseClick ( "left") ; Finished! What am I doing wrong? Why can't I focus $gameExeName? Thanks in advance! Link to comment Share on other sites More sharing options...
water Posted April 21, 2012 Share Posted April 21, 2012 How about advanced window description? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 21, 2012 Moderators Share Posted April 21, 2012 Fl4m3Ph03n1x,The last time I looked, "Magic The Gathering Tactics" is a game. If you read the Forum Rules you will see we do not help automate games - so this thread will now be locked. Please read those rules and follow them when you post in future. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts