Sign in to follow this  
Followers 0
lingo124

Need help on WinGetPos()

4 posts in this topic

#1 ·  Posted (edited)

I have a game and am running 1 copy of the proram in sandboxie and 1 copy of the program by itself. Sandboxie appends its [#] thing to the title. e.g

Regular Program title:

program title

Sandboxie Program title:

[#] program title[#]

When I try to use wingetpos() on the first title, it works fine. But when I try to use wingetpos() on the sandboxie title, nothing is returned. However, if I set the sandboxie program to display the original program title, it can find the position just fine. But then I can only get the position of one of the windows because they share the same name and wingetpos() only gets the most recently active window. I thought it might have to do with escaping characters, so I tried escaping the brackets with "", and then I tried escaping the pound signs. Neither worked. It would always return an error saying subscript used with nonvariable array.

My code:

 

Global $windowinfo, $windowinfos
$windowinfo = WinGetPos("THEGAME™ ")
$x = $windowinfo[0]
$y = $windowinfo[1]
$windowinfos = WinGetPos("[#] THEGAME™ [#]")
$xs = $windowinfos[0]
$ys = $windowinfos[1]

 

Any help would be appreciated. Thanks

Edited by lingo124

Share this post


Link to post
Share on other sites



lingo124,

 

Welcome to the AutoIt forum. :)

 

To what end are you trying to identify these windows?  Please read the Forum rules (there is also a link at bottom right of each page) to see what is not permitted here. ;)

 

But please also note that this is not the correct section for general queries  - "General Help" is more suitable than "Developer Chat".  I will move the thread for you. :)

 

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

#3 ·  Posted (edited)

Sorry about that. I just saw general coding talk and put it there.

I am trying to get the position of each of the windows so I can figure out the position of window elements in relation to its position (i.e. the enter key is 300,200 from the top right of the window. I am trying to use functions like mouseclick along with a coordinate.)

Edited by lingo124

Share this post


Link to post
Share on other sites

lingo124,

I take from that reply that you did not bother to read the Forum rules to which I linked - and which clearly state that game interaction is not a permitted subject here.  Using MouseClick on game windows is interaction in my book.  Please take the time to read the rules before you post again - thread locked. :naughty:

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