TheRedTerror Posted July 25, 2012 Share Posted July 25, 2012 I wasn't sure on how to go about this as I am very new to AutoIt, but here we go. The following code below is from another member from a different site who helped me. It allows me to create variables for each program that has multiple instances running. (Example: 5 Internet Explorer Browsers) It will prompt me and ask that I hover over the window I wish to use and hit the middle mouse button. Shortly after it will tell me how many of that program is running and ask what I would like to name them. It allows me to take each instance and give them a name that I can later on call to use. My problem comes in when this is a AHK code and from what I have seen they are different, but are similar in some ways. As I said I am really new to AutoIt so I'm not sure on how I could convert this properly into a AutoIt code. Any help would be greatly appreciated. expandcollapse popupSetTitleMatchMode, 2 CoordMode, pixel, screen Coordmode, mouse, screen ; Hover over one of the windows SoundBeep, 750 tooltip, place mouse over the window you want to identify. press middle mouse button, 100, 0 ; press the middle mouse button to identify that window keywait, MButton, D keywait, MButton mousegetpos, w1mx, w1my, w1id ; then get the window title from the id wingettitle, w1title, ahk_id %w1id% msgbox,0x1020, , This window's id and title are`nId:`t%w1id%`ntitle:`t%w1title% ; with that title find all windows that match that title WinGet, winlist, List, %w1title% ; make a displayable string showing the list of ids str = loop %winlist% { thisid := winlist%A_Index% str = %str%`n%thisid% } msgbox, Number of matching windows = %winlist%%str% ; then to use any window in the list you simply activate it using it's id ;If (winlist) ;{ random, thiswin, 1, %winlist% ;<-- pick a random window from the list ; wid := winlist%thiswin% ; msgbox,0x1020,,Activating window#: %thiswin% id: %wid% ; winactivate, ahk_id %wid% ; click ;} str = Loop %winlist% ;<-- used from the example i posted earlier { thisid := winlist%A_Index% ; gets the id thisid = ahk_id %thisid% winactivate, %thisid% Inputbox, choice, ,what name do you want to give this window? If (Errorlevel) ;<-- cancel was pressed { choice = NoName%A_Index% } %choice% = %thisid% str = %str%name: %choice%`tid:%thisid%`n } Link to comment Share on other sites More sharing options...
kaotkbliss Posted July 25, 2012 Share Posted July 25, 2012 WinListRetrieves a list of windows.WinList ( ["title" [, "text"]] ) 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
TheRedTerror Posted July 25, 2012 Author Share Posted July 25, 2012 I feel silly, now I just need to find a way to take those handles and prompt me for a name so I can turn each one into a variable. Link to comment Share on other sites More sharing options...
TheRedTerror Posted July 25, 2012 Author Share Posted July 25, 2012 Figured this out. No need to reply. 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