Sign in to follow this  
Followers 0
Fl4m3Ph03n1x

Ways to focus windows

3 posts in this topic

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:

;
; 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!

Share this post


Link to post
Share on other sites




My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0