mininja Posted February 18, 2022 Share Posted February 18, 2022 Ok I know I am new at this and it is silly. But I have been able to figure out how to make a script do what I want. But the issue is that when a program I am using gets updated from the author the title of the window changes due to the name of the window is the file directory. This means that version 1 will be X:\xxx\xxxx\xxx.exe (and yes they have the window called the path to the file) and next update may be like X:/xxx/xx2-19-2022/xxx.exe. So unless I can deleting the folder every time and making the exact same folder name I have to edit my script every time. Any ideas on how to make it get part of the windows name? Opt("WinTitleMatchMode", 1) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase Opt("WinSearchChildren", 1) ;0=no, 1=search children also $WinName = "X:\xxx\xxxx\xxx.exe"- this is the part that changes when they update and I unzip the new update. The xxx.exe part never changes, just the rest of it before that. $oToy = WinGetHandle($WinName) If WinExists($oToy) Then WinActivate($oToy) WinMove($oToy, "", -1203, 829, 993, 192) EndIf Link to comment Share on other sites More sharing options...
Solution SOLVE-SMART Posted February 18, 2022 Solution Share Posted February 18, 2022 (edited) Hi @mininja, you already use the option WinTitleMatchMode, so just set that option to 2 😉 . Opt("WinTitleMatchMode", 2) ; 1 = start, 2 = subStr, 3 = exact, 4 = advanced, -1 to -4 = Nocase "2 = Match any substring in the title" This is just one approach, but I am sure there are better ways to handle this. But maybe it's already enough for fitting your requirements? ---------------------------------By the way: Are you sure you want to set the found window to a negative X position? Why? In case you want to hide the window, you could do it differently 😀 . Best regards Sven ________________Stay innovative! Edited February 18, 2022 by SOLVE-SMART mininja 1 Stay innovative! Spoiler 🌍 Au3Forums 🎲 AutoIt (en) Cheat Sheet 📊 AutoIt limits/defaults 💎 Code Katas: [...] (comming soon) 🎭 Collection of GitHub users with AutoIt projects 🐞 False-Positives 🔮 Me on GitHub 💬 Opinion about new forum sub category 📑 UDF wiki list ✂ VSCode-AutoItSnippets 📑 WebDriver FAQs 👨🏫 WebDriver Tutorial (coming soon) Link to comment Share on other sites More sharing options...
Musashi Posted February 18, 2022 Share Posted February 18, 2022 @mininja : Your description is a bit vague. What will be displayed when you run the following test script ? (Replace xxx.exe with the real program name) #include <Array.au3> Local $aWinList = WinList("[REGEXPTITLE:(?i)(.*xxx.exe.*)]") _ArrayDisplay($aWinList) "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
mininja Posted February 18, 2022 Author Share Posted February 18, 2022 OMG......... Ill just go back in my hole now lol. Thank you!!! 32 minutes ago, SOLVE-SMART said: Hi @mininja, you already use the option WinTitleMatchMode, so just set that option to 2 😉 . Opt("WinTitleMatchMode", 2) ; 1 = start, 2 = subStr, 3 = exact, 4 = advanced, -1 to -4 = Nocase "2 = Match any substring in the title" This is just one approach, but I am sure there are better ways to handle this. But maybe it's already enough for fitting your requirements? ---------------------------------By the way: Are you sure you want to set the found window to a negative X position? Why? In case you want to hide the window, you could do it differently 😀 . Best regards Sven ________________Stay innovative! SOLVE-SMART 1 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