mr-es335 Posted yesterday at 12:19 AM Posted yesterday at 12:19 AM Good day, 1) I launch the main application. 2) I then launch two scripts - both scripts with WinSetOnTop enabled. 3) However, both scripts do not main WinSetOnTop status. • What am I doing wrong? Is this WinSetOnTop status even possible? Any assistance in this matter would be greatly appreciated! Here are the two scripts: expandcollapse popup; EnableP7HotKeyLabel.au3 ; ----------------------------------------------- #RequireAdmin ; ----------------------------------------------- #include <AutoItConstants.au3> #include <FontConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- Global $sFontName = "Corbel Bold", $iFontSize = 16, $iFontWt = 800, $GUI_FONTNORMAL = 0 ; ----------------------------------------------- EnableP7HotKeyLabel() ; ----------------------------------------------- Func EnableP7HotKeyLabel() Local $iFontSize = 11 ; ----------------- Local $sEnableP7HotKeyLabel = GUICreate(" ", 117, 16, 200, 90, $WS_POPUP, $WS_EX_TOPMOST) ;~ WinSetOnTop(" ", "", $WINDOWS_ONTOP) ; ----------------- GUISetFont($iFontSize, $iFontWt, $GUI_FONTNORMAL, $sFontName) GUISetBkColor(0x4A4A4A) ; ----------------- Local $sP7LabelPosition = GUICtrlCreateLabel(" Enable HotKey", 0, 0, 117, 18, $SS_CENTER) WinSetOnTop(" Enable HotKey", "", $WINDOWS_ONTOP) GUICtrlSetColor(-1, 0xFFFFFF) ; ----------------------------------------------- GUISetState(@SW_SHOW) ; ----------------------------------------------- While 1 Switch GUIGetMsg() Case $sP7LabelPosition Local $hbP7HotKeyEnabled = EnableDisableP7HotKey($sEnableP7HotKeyLabel, $sP7LabelPosition) If $hbP7HotKeyEnabled = True Then ExitLoop EndSwitch WEnd EndFunc ;==>EnableP7HotKeyLabel ; ----------------------------------------------- Func EnableDisableP7HotKey($sEnableP7HotKeyLabel, $sP7LabelPosition) Local Static $hbP7HotKeyEnabled = True ; ----------------------------------------------- If $hbP7HotKeyEnabled = True Then HotKeySet("{NUMPADSUB}", "UpdateScenes") ; The script that is to be executed! GUICtrlSetData($sP7LabelPosition, "Disable HotKey") $hbP7HotKeyEnabled = False Else HotKeySet("{NUMPADSUB}") GUICtrlSetData($sP7LabelPosition, "Enable HotKey") GUIDelete($sEnableP7HotKeyLabel) $hbP7HotKeyEnabled = True EndIf Return $hbP7HotKeyEnabled EndFunc ;==>EnableDisableP7HotKey ; ----------------------------------------------- Func UpdateScenes() Local $hWnd = "[CLASS:SAC_SCENEPROPERTIES]" ; ----------------------------------------------- ; F Mixer Number Zone[s] is|are [manually] selected ; ----------------- WinActivate("[CLASS:metapad]", "") ; P7Text is selected. Send("{LSHIFT down}+{END}") ; The first line of P7Text is selected via [Shift UP] + [END]. Send("^x") ; The first line of P7Text is cut - LIFO is executed. Send("{LSHIFT up}") ; [Shift UP] is disabled. ; ----------------------------------------------- WinActivate("[CLASS:SAC_SCENES]", "") MouseClick($MOUSE_CLICK_LEFT, 254, 313, 1, 1) ; The Scenes View is selected, x y clicks speed Sleep(100) MouseClick($MOUSE_CLICK_LEFT, 133, 165, 1, 1) ; The first line of Scenes View is selected. Sleep(100) Send("{End}") ; The [End Of List] is selected via the [End] key. MouseClick($MOUSE_CLICK_LEFT, 188, 118, 1, 1) ; The [New] button is selected. Sleep(100) Send("^v") ; The previously cut text is then pasted. Send("{ENTER}") ; [Enter] is selected, for [Ok] - with the [Enter Scene Name...] dialog being summarily exited. ; ----------------------------------------------- Sleep(100) WinMove($hWnd, "", 960, 210) ; The Scene Properties window is displayed and is then moved. ; ----------------- ; The Scene Properties are [manually] selected. ; [OK] is [manually] selected. ; The [Start] scene is [manually] selected. EndFunc ;==>UpdateScenes ; ----------------------------------------------- expandcollapse popup; EnableF10Label ; ----------------------------------------------- #RequireAdmin ; ----------------------------------------------- #include <AutoItConstants.au3> #include <FontConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- Global $sFontName = "Corbel Bold", $iFontSize = 16, $iFontWt = 800, $GUI_FONTNORMAL = 0 ; ----------------------------------------------- EnableF10Label() ; ----------------------------------------------- Func EnableF10Label() Local $iFontSize = 12 ; ----------------- Local $sLabelF10 = GUICreate(" ", 85, 23, 620, 51, $WS_POPUP, $WS_EX_TOPMOST) WinSetOnTop(" ", "", $WINDOWS_ONTOP) ; ----------------- GUISetFont($iFontSize, $iFontWt, $GUI_FONTNORMAL, $sFontName) GUISetBkColor(0x3D3D3D) ; ----------------- Local $sLabelPositionF10 = GUICtrlCreateLabel(" For F10", 0, 0, 75, 23, $SS_CENTER) ; ----------------- GUICtrlSetColor(-1, 0xFFFFFF) ; ----------------------------------------------- GUISetState(@SW_SHOW) ; ----------------------------------------------- While 1 Switch GUIGetMsg() Case $sLabelPositionF10 GUIDelete($sLabelF10) MoveP7Text() EnableF12() Exit EndSwitch WEnd EndFunc ;==>EnableF10Label ; ----------------------------------------------- Func MoveP7Text() Local $sSrcPath = "E:\Desktop\Working\P7Text.txt - metapad" ; ----------------------------------------------- WinActivate("[CLASS:SAC_MAIN]", "") Sleep(100) Send("{F10}") ; Select: F10 ; ----------------------------------------------- WinMove($sSrcPath, "", 477, 86, 218, 390) WinSetOnTop($sSrcPath, "", $WINDOWS_ONTOP) ; ----------------------------------------------- MouseClick($MOUSE_CLICK_LEFT, 156, 626, 2, 0) ; Launch and position Ampsim plug-in Sleep(100) Local $hWnd = WinWait("[CLASS:Studio_VstPropertyPage]", "") WinMove($hWnd, "", 704, 86) MouseClick($MOUSE_CLICK_LEFT, 142, 170, 2, 0) ; Launch Start Sleep(100) MouseClick($MOUSE_CLICK_LEFT, 768, 291, 1, 0) ; Select Session_Master Sleep(100) MouseClick($MOUSE_CLICK_LEFT, 773, 529, 2, 0) ; Launch Preset 001 Sleep(100) EndFunc ;==>MoveP7Text ; ----------------------------------------------- Func EnableF12() Local $iFontSize = 12 ; ----------------- Local $sLabelF12 = GUICreate(" ", 85, 23, 620, 51, $WS_POPUP, $WS_EX_TOPMOST) WinSetOnTop(" ", "", $WINDOWS_ONTOP) ; ----------------- GUISetFont($iFontSize, $iFontWt, $GUI_FONTNORMAL, $sFontName) GUISetBkColor(0x3D3D3D) ; ----------------- Local $sLabelPositionF12 = GUICtrlCreateLabel(" For F12", 0, 0, 75, 23, $SS_CENTER) ; ----------------- GUICtrlSetColor(-1, 0xFFFFFF) ; ----------------------------------------------- GUISetState(@SW_SHOW) ; ----------------------------------------------- While 1 Switch GUIGetMsg() Case $sLabelPositionF12 GUIDelete($sLabelF12) ReturnMe() Exit EndSwitch WEnd EndFunc ;==>EnableF12 ; ----------------------------------------------- Func ReturnMe() MouseClick($MOUSE_CLICK_LEFT, 1413, 98, 1, 0) ; Exit Ampsim ; ----------------------------------------------- WinActivate("[CLASS:metapad]", "") ; P7Text is selected. Send("^s") ; Send CtrlS Sleep(100) WinClose("[CLASS:metapad]", "") ; ----------------------------------------------- Sleep(100) Send("{F12}") ; Select: F12 ; ----------------------------------------------- MouseMove(959, 576, 0) EndFunc ;==>ReturnMe ; ----------------------------------------------- PS: The main application is: Software Audio Console mr-es335 Sentinel Music Studios
ioa747 Posted yesterday at 01:14 AM Posted yesterday at 01:14 AM Two things I will tell you when you have $WS_EX_TOPMOST in your GUI, as exStyle you don't need to do it again with WinSetOnTop when you use WinSetOnTop => WinSetOnTop ( "title", "text", flag ) WinSetOnTop(" ", "", $WINDOWS_ONTOP) is very vague. better to set the hWnd/class of the window when you don't have a title e.g. WinSetOnTop($sEnableP7HotKeyLabel, "", $WINDOWS_ONTOP) or WinSetOnTop("[CLASS:metapad]", "", $WINDOWS_ONTOP) (I see that you didn't adopt OnEvent Mode after all) I know that I know nothing
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