trynhyty Posted August 20, 2015 Share Posted August 20, 2015 Hi everybody, As I explained in a previous topic, I'm trying to make a program that will be a Window with a text input field.If I write "chrome" and press enter in that field, it should open chrome.exeWhat I'm trying to do is to check when the window of Chrome is on top of screen. I used pixelsearch, but I find it really inadequate.Is there a way to mess around with WinAPI.au3 to retrieve the name of the current top window ? Thanks by advance. Link to comment Share on other sites More sharing options...
MikahS Posted August 20, 2015 Share Posted August 20, 2015 Have a look at:WinList Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
trynhyty Posted August 20, 2015 Author Share Posted August 20, 2015 Have a look at:WinList As usual, thanks MikahS By the way, I finally made a function to erase last char in my historic txtfile, works like a charm, thank you Link to comment Share on other sites More sharing options...
junkew Posted August 20, 2015 Share Posted August 20, 2015 isnt it getActiveWindow? FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
trynhyty Posted August 20, 2015 Author Share Posted August 20, 2015 If you could help me with WinList, that'd be cool I'm trying to understand the function, and I don't two things : I don't achieve to interprete " For $i = 1 To $aList[0][0] " I understand this as it was a cursor that went from the last window to the first ($aList[0][0] if I understand correctly) With the example I achieve to get the name of all the windows open on my computer, but if I just write MsgBox (0, "", "Title : " & $aList[1][0]), I have no value shown And I don't get why yet.The second problem is linked to the fist, I need to know how to get only the first title of the array that WinList make for me Thanks in advance Link to comment Share on other sites More sharing options...
guinness Posted August 20, 2015 Share Posted August 20, 2015 It's hard to help when you lack basic understanding. You can expect expect people to start re-hashing tutorials on something that you yourself should read about e.g. arrays, loops etc. My suggestion, get the fundamentals understood and then start building something. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
mikell Posted August 20, 2015 Share Posted August 20, 2015 Winlist lists all windows including these without a titleExample #1 in the helpfile shows exactly how to get "only visible windows with a title"Then you could use it like this#include <MsgBoxConstants.au3> Local $aList = WinList() ; Loop through the array displaying only visible windows with a title. For $i = 1 To $aList[0][0] If $aList[$i][0] <> "" And BitAND(WinGetState($aList[$i][1]), 2) Then $title = $aList[$i][0] $handle = $aList[$i][1] Exitloop EndIf Next MsgBox($MB_SYSTEMMODAL, "", "Title: " & $title & @CRLF & "Handle: " & $handle) Link to comment Share on other sites More sharing options...
jguinch Posted August 20, 2015 Share Posted August 20, 2015 What I'm trying to do is to check when the window of Chrome is on top of screen. WinWaitActive ? Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
trynhyty Posted August 20, 2015 Author Share Posted August 20, 2015 (edited) WinWaitActive ?I tried it, and works like a charm. But I find the WinList() option more fun to apply, atleast it learns me some things about programmation At the moment, I wrote this : $x = 0 global $array[1] For $i = 1 To $aList [0][0] If $aList[$i][0] <> "" And BitAND(WinGetState($aList[$i][1]), 2) Then MsgBox($MB_SYSTEMMODAL, "", "Title: " & $aList [$i][0] & @CRLF) $array[$x] = $aList[$i][0] $x = $x+1 ReDim $value[UBound($array) + 1] EndIf Next ReDim $array[UBound($array) - 1] _ArrayDisplay ($array) And I get an array with only windows that have a title.I'm trying to get the first row of the array, I've not looked for it yet, don't spoil me Edited August 20, 2015 by trynhyty Link to comment Share on other sites More sharing options...
MikahS Posted August 25, 2015 Share Posted August 25, 2015 As usual, thanks MikahS By the way, I finally made a function to erase last char in my historic txtfile, works like a charm, thank you My pleasure, as always. Glad you got a solution figured out to your other problem as well! Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ 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