Gambler71 Posted November 27, 2016 Share Posted November 27, 2016 (edited) Hi, I have been unable to get a fullscreen program to restore (maximise from taskbar) without it making the windows default ding sound when ever I press a button after it restores. The basic code is: While 1 If (ProcessExists("program.exe")) Then If BitAND(WinGetState("Program Title", ""), 16) Then WinSetState("Program Title", "", @SW_RESTORE) Else Sleep(500) EndIf Else Exit EndIf WEnd Also tried @SW_MAXIMIZE, and WINACTIVATE. Sadly I have to minimize and maximize the "program" if I use this script, using the mouse to stop the windows ding sound from happening each time I try to move etc (i.e. press any key). The reason I want an auto script is because I have 2 multiple monitors and if I accidentally click outside the "program" it minimizes it, and stops the "program", and makes the computer think for ages, so I am trying to avoid it if possible. Also tried to click the "program" from the taskbar (Windows 10) but I have no idea how to find which button/icon I need to click (move the mouse to). So what is a simple way to restore my "program", or what are the taskbar command names to find the position to send the mouse to click on it to restore? Edited November 27, 2016 by Gambler71 Link to comment Share on other sites More sharing options...
j0kky Posted November 28, 2016 Share Posted November 28, 2016 (edited) Use WinActivate("Program Title") after WinSetState Edited November 28, 2016 by j0kky Spoiler Some UDFs I created: Winsock UDF STUN UDF WinApi_GetAdaptersAddresses _WinApi_GetLogicalProcessorInformation Bitwise with 64 bit integers An useful collection of zipping file UDFs Link to comment Share on other sites More sharing options...
Gambler71 Posted November 29, 2016 Author Share Posted November 29, 2016 On 28/11/2016 at 7:39 PM, j0kky said: Use WinActivate("Program Title") after WinSetState Tried it. Sadly still makes the default ding sound. Link to comment Share on other sites More sharing options...
j0kky Posted November 30, 2016 Share Posted November 30, 2016 (edited) EDIT: wait, maybe _winapi_setforegroundwindow could help! Edited November 30, 2016 by j0kky Spoiler Some UDFs I created: Winsock UDF STUN UDF WinApi_GetAdaptersAddresses _WinApi_GetLogicalProcessorInformation Bitwise with 64 bit integers An useful collection of zipping file UDFs Link to comment Share on other sites More sharing options...
Gambler71 Posted November 30, 2016 Author Share Posted November 30, 2016 (edited) 23 hours ago, j0kky said: EDIT: wait, maybe _winapi_setforegroundwindow could help! #include <WinAPISys.au3> $hTray = WinGetHandle("Program Name", "") WinSetState("Program Name", "", @SW_RESTORE) WinActivate("Program Name", "") _winapi_setforegroundwindow($hTray) Sadly still makes the default ding sound. Tried without WinSetState, and then without WinActivate, same sound. The only solution I could think of is: Local $aPos = MouseGetPos() MouseClick("main", 178, 1063, 1, 1) MouseMove($aPos[0], $aPos[1], 1) which gets the current mouse position, clicks on where the first program should be on the windows taskbar, and then moves the mouse back to where is was. Problem is sometimes after I save within the program, it moves the taskbar button to the end. So, I thought that I could use "_GUICtrlToolbar_ButtonCount" but it always results in nil (0) finds. The test code was: #include <GuiToolbar.au3> $hTray = WinGetHandle("[CLASS:Shell_TrayWnd]") $hToolbar = ControlGetHandle($hTray, "", "[CLASSNN:MSTaskListWClass]") $iCnt = _GUICtrlToolbar_ButtonCount($hToolbar) MsgBox(0,'',$iCnt) I thought that this would find the number of buttons on the Win10 taskbar (main screen). From internet search I think it is impossible to see what the windows taskbar list is on Win10. Even the following script returns only in the answer of "running applications": For $i = 1 To 10 $sText = ControlGetText("[CLASS:Shell_TrayWnd]", "", "[CLASS:MSTaskListWClass; INSTANCE:" & $i & "]") If $sText = "" Then ExitLoop ConsoleWrite($i & " : " &$sText & @CRLF) Next Thanks for the help @j0kky Edited November 30, 2016 by Gambler71 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