zeenmakr Posted June 25, 2020 Share Posted June 25, 2020 objective: trying to minimize windows default magnify.exe but can't, any inputs? #Include <WinAPI.au3> ;~ Global $_CLASS_TITLE_MAGNIFIER = '[CLASS:MagUIIconClass; TITTLE:Magnifier]' ; <--- fails to get hWnd Global $_CLASS_TITLE_MAGNIFIER = '[CLASS:MagUIIconClass]' RunWait(@ComSpec &' /c '& 'magnify.exe', @UserProfileDir, @SW_HIDE) WinWaitActive($_CLASS_TITLE_MAGNIFIER, '', 3) Local $hWnd = WinGetHandle($_CLASS_TITLE_MAGNIFIER) Local $phWnd = WinActivate(_WinAPI_GetParent($hWnd)) ;~ MsgBox(0, @ScriptLineNumber&': Magnifier hWnd', _ ;~ '$hWnd - '& $hWnd &@CRLF& _ ;~ '$phWnd - '& $phWnd) ToolTip('1st try') WinSetState($_CLASS_TITLE_MAGNIFIER, '', @SW_MINIMIZE) sleep(3000) ToolTip('2nd try') WinSetState($hWnd, '', @SW_MINIMIZE) sleep(3000) ToolTip('3rd try') WinSetState($phWnd, '', @SW_MINIMIZE) sleep(3000) ToolTip('') Link to comment Share on other sites More sharing options...
JoHanatCent Posted June 25, 2020 Share Posted June 25, 2020 Use Run RunWait will "pauses script execution until the program finishes." Link to comment Share on other sites More sharing options...
zeenmakr Posted June 25, 2020 Author Share Posted June 25, 2020 5 hours ago, JoHanatCent said: Use Run i understand, any chance you get to try it out Link to comment Share on other sites More sharing options...
Nine Posted June 25, 2020 Share Posted June 25, 2020 use #RequireAdmin and Global $_CLASS_TITLE_MAGNIFIER = '[CLASS:MagUIClass]' Works both win7 and win10 zeenmakr 1 “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) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
zeenmakr Posted June 25, 2020 Author Share Posted June 25, 2020 @Nine cool, thanks but this won't work for me bc it's part of an automation task and uac popup break this any explanations as to why admin is required for this simple task? Link to comment Share on other sites More sharing options...
Nine Posted June 25, 2020 Share Posted June 25, 2020 Not sure why. It needs more investigation that I am not ready to do right now. Maybe, look at authorizations? It definitely means that there is a credential conflict between Autoit script and the exe. “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) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Nine Posted June 26, 2020 Share Posted June 26, 2020 (edited) Got some time to look into it, still not quite sure why WinSetState does not work with this exe, but found a solution that is doing fine for me both Win7 and Win10 : #include <SendMessage.au3> #include <MenuConstants.au3> #include <WindowsConstants.au3> Run(@ComSpec & ' /c magnify.exe', "", @SW_HIDE) $hWnd = WinWait ("[CLASS:MagUIClass]") ConsoleWrite ($hWnd & @CRLF) Sleep (2000) _SendMessage ($hWnd, $WM_SYSCOMMAND, $SC_MINIMIZE) Edited June 26, 2020 by Nine zeenmakr 1 “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) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
zeenmakr Posted June 27, 2020 Author Share Posted June 27, 2020 (edited) awesome thanks @Nine, works fine on win8 here plus didn't catch win-classes are different for default gui and floating magnifier icon I read a little into it, and it has something to do with parent instance where uac is triggered. hence only this work with #RequireAdmin ToolTip('3rd try') WinSetState($phWnd, '', @SW_MINIMIZE) Edited June 27, 2020 by zeenmakr 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