youtuber Posted August 17, 2019 Posted August 17, 2019 (edited) There is an interesting situation This code does not work alone, my operating system is Windows 10. #RequireAdmin If ProcessExists("IDMan.exe") Then ProcessClose("IDMan.exe") ShellExecute(@ProgramFilesDir & "\Internet Download Manager\IDMan.exe") If ProcessWait("IDMan.exe") Then Local $aWinList = WinList("[REGEXPTITLE:(?i)(.*Internet Download Manager*)]") For $i = 1 To $aWinList[0][0] $title = $aWinList[$i][0] ;Sleep(100);Trying to sleep here still doesn't work WinSetState($title, "", @SW_HIDE) Next EndIf EndIf But if I use it with that code, then it's no problem. #RequireAdmin #include <WinAPISysWin.au3> If ProcessExists("IDMan.exe") Then ProcessClose("IDMan.exe") ShellExecute(@ProgramFilesDir & "\Internet Download Manager\IDMan.exe") If ProcessWait("IDMan.exe") Then Local $aWinList = WinList("[REGEXPTITLE:(?i)(.*Internet Download Manager*)]") For $i = 1 To $aWinList[0][0] $title = $aWinList[$i][0] ;Sleep(100);Trying to sleep here still doesn't work WinSetState($title, "", @SW_HIDE) Next EndIf EndIf _WinAndParentSetState("Internet Download Manager", @SW_HIDE) Func _WinAndParentSetState($title, $state) $childHandle = WinGetHandle($title) $parentLong = _WinAPI_GetWindowLong($childHandle, $GWL_HWNDPARENT) $parentHandle = HWnd($parentLong) WinSetState($parentHandle, '', $state) WinSetState($childHandle, '', $state) EndFunc ;==>_WinAndParentSetState Can't the program window be closed in a shorter and simpler way? Or my codes are wrong https://prnt.sc/otqpzk Edited August 17, 2019 by youtuber
Danp2 Posted August 17, 2019 Posted August 17, 2019 You should check the contents of $aWinList after the call to WinList. Perhaps your regex is wrong. 🤷♂️ Latest Webdriver UDF Release Webdriver Wiki FAQs
Nine Posted August 17, 2019 Posted August 17, 2019 Your regexp is definitely wrong it is missing a "." It should be : Local $aWinList = WinList("[REGEXPTITLE:(?i)(.*Internet Download Manager.*)]") “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
youtuber Posted August 17, 2019 Author Posted August 17, 2019 (edited) @Nine Not exactly regex I think. I tried windows 7 too smoothly but windows 10 failed because now I've tried with Sleep(2000) is working. This is exactly the code that works, but isn't Sleep(2000) standby time too much? #RequireAdmin If ProcessExists("IDMan.exe") Then ProcessClose("IDMan.exe") ShellExecute(@ProgramFilesDir & "\Internet Download Manager\IDMan.exe") If ProcessWait("IDMan.exe") Then Local $aWinList = WinList("[REGEXPTITLE:(?i)(.*Internet Download Manager*)]") ;$aWinList = WinList("[REGEXPTITLE:(?i)(.*Internet Download Manager.*)]") For $i = 1 To $aWinList[0][0] $title = $aWinList[$i][0] If @OSVersion = "WIN_10" Then Sleep(2000) EndIf WinSetState($title, "", @SW_HIDE) Next EndIf EndIf Edited August 17, 2019 by youtuber
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