#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. #SingleInstance force ; Replaces script (Reloads). #Persistent ; to make it run indefinitely #IfWinActive ahk_exe S:\MuseScore 3.6 portable\MuseScorePortable\App\MuseScore\bin\MuseScore3.exe ; Enables Hotkeys when MuseScore3 Window is Active #Include Coordinates_stripped.ahk ; All coordinates are managed in this external file ; The Include directive causes the script to behave as though ; the specified file's contents are present at this exact position ; Replace the path S:\etc. with your location of MuseScore3.exe ; ToggleCopy := 0 ; initialisation for the hotkey #LButton (toggle - copy) ; ♣==tooltips ========== SEPARATORS between Canvas and Inspector cq Palettes/Sel Filter =========== ; the tooltips show the correct width of the side panels ; (if needed: adjust the width of the text: the border of the tooltip must just touch the defined width) ; these two tooltips are automatically loaded. They belong to the autoexec section CoordMode, ToolTip, Screen ToolTip , ◄ Separator x = %Def_Insp_Width%, % Def_Insp_Width, 0, 1 ; inspector (y=0) ; ToolTip , ◄ Separator x = %Def_Insp_Width%, 608, 0, 1 ; inspector (y=0) Test to temporarily get this tooltip out of the way (x = 608) ToolTip , Separator x=%Def_Pal_Width% ►, % 0, Pal_Sep_Height, 2 ; palettes/selection filter (x=0) ; ♣================================== END OF AUTOEXEC SECTION ==================================== ; ♣===================================== RELOAD and EXIT APP ====================================== ~[ & ]:: ; reload master SendMode Event ; to make slower mouse movements possible MouseMove, A_ScreenWidth / 2, A_ScreenHeight / 2 , 20 MsgBox, 4132, Reload Master-stripped [ + ], Are you sure you want to reload? IfMsgBox, Yes Reload Return ~] & [:: ; exit master MsgBox, 4132, Exit Master ] + [, Are you sure you want to exit? IfMsgBox, Yes ExitApp Return ; ♣============================ RUN MACRO GROUPS and External Utilities =========================== ~[ & F1:: Run, F1_ColorSearchSelect_stripped.ahk, , UseErrorLevel if (ErrorLevel = "Error") MsgBox, 4112, [ + F1 - Start Search and Select, ( The macro group could not be launched. Check name and location of the file. ) Return ~[ & F2:: Run, F2_Apply_Palette_Symbols.ahk, , UseErrorLevel if (ErrorLevel = "Error") MsgBox, 4112, [ + F2 - Start Apply Palette Symbols, ( The macro group could not be launched. Check name and location of the file. ) Return ~[ & l:: Run, Learn.ahk, , UseErrorLevel if (ErrorLevel = "Error") MsgBox, 4112, Start Learn, ( 'Learn' could not be launched. Check name and location of the file. ) Return ~[ & /:: Run, PixelMousing.ahk, , UseErrorLevel if (ErrorLevel = "Error") MsgBox, 4112, Start PixelMousing, ( PixelMousing could not be launched. Check name and location of the file. ) Return ~[ & Home:: ; edit Master_stripped.ahk If WinExist("Master_stripped.ahk - Notepad") WinActivate else Edit Return ~[ & NumpadEnter:: Run, Set_Surface_Coordinates.ahk, , UseErrorLevel if (ErrorLevel = "Error") MsgBox, 4112, Set Surface Coordinates, ( The macro could not be launched. Check name and location of the file. ) Return ~[ & NumpadAdd:: ; Run SnippingTool Run, SnippingTool.exe WinActivate, ahk_class Microsoft-Windows-SnipperToolbar WinWaitActive, ahk_class Microsoft-Windows-SnipperToolbar Send, ^n ; new snip Sleep, 1000 WinActivate ahk_class Microsoft-Windows-SnipperEditor WinWaitActive, ahk_class Microsoft-Windows-SnipperEditor Return ; ♣====================================== HELP INFO (1) =========================================== ~[ & h:: MsgBox, 4096, Master General - stripped version [ + H, ( OPEN macro group * [ + F1 [ + F1 EXIT macro group ] + F1 ] + F2 Help Files voor F1, F2 [ + 1 [ + 2 * Press the same hotkey again to show the name of the macro group. Prefixes: [ = OPEN ] = EXIT Search and Select F1 Apply Palette Symbols F2 Reload Master [ + ] Edit Master [ + Home Exit Master ] + [ Load Learn [ + L Exit Learn' ] + L Edit Learn if active [ + , Load PixelMousing [ + / Exit PixelMousing ] + / Help PM (when active) / + H Set Surface and Make Image [ + NumpadEnter Run Snipping Tool [ + NumpadAdd More Hotkeys [ + M Utilities Defined State [ + U ) Return ; ♣==================================== HELP INFO (2) ============================================= ~[ & m:: MsgBox, 4096, Master - More - stripped version [ + M, ( Copy/paste range selection Win + LButton Rightclick * AppsKey Doubleclick * Alt + CapsLock Reset (Control + R) Control + CapsLock Automatic Placement toggle Shift + Capslock Escape Win + Capslock Back to last escaped element Win + Z * put mouse on element e.g. with Color Search Alt + Right → CapsLock + Z Alt + Down ↓ CapsLock + D Delete CapsLock + X Store mouse position CapsLock + Q Store mouse position CapsLock + LButton Select this position CapsLock + W Full Screen toggle CapsLock + A Shortcuts → Search CapsLock + S Empty palette search CapsLock + E Get color mouse position Z + / Master General Info [ + H Utilities Defined State [ + U ) Return ; ♣==================================== HELP INFO (3) ============================================= ~[ & u:: ; info utilities Defined State MsgBox, 4096, Master - Defined State - stripped version [ + U, ( Utilities Defined State Test image recognition 'Inspector' Z + 5 Tool palette separator Z + F1 Tool inspector separator Z + F2 Auto reset palette separator Z + 1 Auto reset inspector separator Z + 2 Reset palette separator Z + - Reset inspector separator Z + = Reset toolbars # CapsLock + 8 Expand collapsed inspector sections Z + I Get coordinates of hotspots Z + F11 Get coordinates of surfaces Z + F12 # Two versions Master General Info [ + H More Hotkeys [ + M ) Return ; ♣======================================= UTILITY ================================================ ~z & /:: ; get color mouseposition CoordMode, Mouse, Screen CoordMode, Pixel, Screen MouseGetPos, X, Y PixelGetColor, PixColor, %X%, %Y% , RGB MsgBox, 4160, Color of mousepositionpixel , --- The color is %PixColor% --- Return ; ♣ ================================ LIBERATING PREFIX KEY 'P' ==================================== ; the next hotkey shows the way in which the P-key is 'liberated'. ; in MuseScore we have redefined the shortcut for 'toggle on screen Piano Keyboard' e.g in Shift + P ; this frees the P-key for all possible combinations of P with some other key ; (we will not use the coordinates for the View menu anymore as we didi in the 'Learn' example) ; wherever possible we use standard shortcuts to minimize the number of coordinates ; so this hotkey operates without coordinates and is independent of the layout of your screen ~p & k:: ; toggles on screen Piano Keyboard - Hotkey (#5) Send !v ; as if you press Alt + V to open the menu View Send {Down 9} ; after opening menu View 'Palettes' is blue. Now 9 times arrow down Send {Enter} ; we land on 'Piano Keyboard' and activate it Return ;♣ ================================= ERGONOMICAL MsC SHORTCUTS ==================================== ; The next two commands belong together. They facilitate reselection of the note e.g. after attaching ; sticky elements like hairpins. ~CapsLock & LButton:: ; store clicked MousePosition ~CapsLock & q:: ; store MousePosition Click MouseGetPos, MousePosCapsL_Q_X, MousePosCapsL_Q_Y Return ~CapsLock & w:: ; click MousePosition stored by previous command If (MousePosCapsL_Q_X = "") and (MousePosCapsL_Q_Y = "") { MsgBox, 4144, Reselection element, ( Ignore the warning! You pressed CapsLock + W without a previous positioning command. CapsLock + W selects the position stored by CapsLock + Q or CapsLock + leftclick. For now the mouse will travel to the current selected element and this position will be stored. If nothing is selected it clicks the centre of the screen. ) MousePosCapsL_Q_X := A_ScreenWidth / 2 MousePosCapsL_Q_Y := A_ScreenHeight / 2 PixelSearch, ElementX, ElementY, % CSA_X1, % CSA_Y1, % CSA_X2, % CSA_Y2, ColorV1, , Fast RGB ; voice 1 if ErrorLevel PixelSearch, ElementX, ElementY, % CSA_X1, % CSA_Y1, % CSA_X2, % CSA_Y2, ColorV2, , Fast RGB ; voice 2 if ErrorLevel PixelSearch, ElementX, ElementY, % CSA_X1, % CSA_Y1, % CSA_X2, % CSA_Y2, ColorV3, , Fast RGB ; voice 3 if ErrorLevel PixelSearch, ElementX, ElementY, % CSA_X1, % CSA_Y1, % CSA_X2, % CSA_Y2, ColorV4, , Fast RGB ; voice 4 if ErrorLevel Click, %MousePosCapsL_Q_X%, %MousePosCapsL_Q_Y% else { MousePosCapsL_Q_X := ElementX MousePosCapsL_Q_Y := ElementY } } Click, %MousePosCapsL_Q_X%, %MousePosCapsL_Q_Y% Return ~CapsLock & e:: ; empty palette search field -> show all palettes (also in Z + U utilities) MouseGetPos, StartX, StartY Send ^{f9} ; Custom MuseScore shortcut, to Palette Search (*change*?) Sleep, 100 Send {Del} Sleep, 100 Send {Escape} Sleep, 100 MouseMove, StartX, StartY Return #CapsLock:: ; accessible escape + creation memorypoint CoordMode, Mouse, Window ; to make sure mouse gets position of element to be escaped CoordMode, Pixel, Window PixelSearch, ElementX, ElementY, % CSA_X1, % CSA_Y1, % CSA_X2, % CSA_Y2, ColorV1, , Fast RGB ; voice 1 if ErrorLevel PixelSearch, ElementX, ElementY, % CSA_X1, % CSA_Y1, % CSA_X2, % CSA_Y2, ColorV2, , Fast RGB ; voice 2 if ErrorLevel PixelSearch, ElementX, ElementY, % CSA_X1, % CSA_Y1, % CSA_X2, % CSA_Y2, ColorV3, , Fast RGB ; voice 3 if ErrorLevel PixelSearch, ElementX, ElementY, % CSA_X1, % CSA_Y1, % CSA_X2, % CSA_Y2, ColorV4, , Fast RGB ; voice 4 if ErrorLevel { MsgBox, 4144, Escape - Search for voice 1234 element, Color not found.`nProbably there is no element selected.`nOr you could try a higher zoom factor. Return } MouseMove, ElementX, ElementY Send {Escape} Sleep, 50 Send {Escape} ; escape twice to get rid of sticky doubleclicks Sleep, 50 MouseGetPos, MemPointEscapeX, MemPointEscapeY Return #MaxThreadsPerHotkey, 2 ; same hotkey can have two results #LButton:: ; toggle - copy range selection Gosub, InspectorCheck ; subroutine at end of file MouseGetPos, StartX, StartY ToggleCopy := !ToggleCopy If (ToggleCopy = 1) { ImageSearch, , , SB_X1, SB_Y1, SB_X2, SB_Y2, *40 Statusbar_Range_Selection.png If ErrorLevel { ; if no range selection ToolTip, Select a range!, StartX, StartY - 100, 10 SetTimer, FinishToolTipCopy, -1500 ; tooltip during 1.5 seconds ToggleCopy := 0 ; reset toggle Return } } If (ToggleCopy = 1) { ; after first time hotkey press Send ^c ToolTip, Win + Left Button. Ready to paste.`nSelect destination with mouse`nor arrowkeys and repeat the hotkey., StartX, StartY - 100, 10 } If (ToggleCopy = 0) { ; after second time hotkey press Send ^v ToolTip, , , , 10 } Return FinishToolTipCopy: ; timer causes tooltip to disappear ToolTip, , , , 10 Return #MaxThreadsPerHotkey, 1 ; next hotkeys will have one thread again #z:: ; back to last Escaped element If (MemPointEscapeX = "") && (MemPointEscapeY = "") { MsgBox, 4144, Back to last escaped element, There was no prior Win + CapsLock command.`n`nUse Win + CapsLock to Escape.`nWin + Z will then click the escaped element again. Return } Click, %MemPointEscapeX%, %MemPointEscapeY% Return ~^CapsLock::Send ^r ; reset = Control + R ; The next hotkey can minimize manual stress caused by frequent mousing and works well ; in combination with the hotkeys for colorsearch of selected elements. ; e.g. to move an element. ~!CapsLock:: ; doubleclick Send {Click, down} Sleep, 50 Send {Click, up} Send {Click, down} Send {Click, up} Return ~+CapsLock:: ; toggles automatic placement Send {=} Return ~CapsLock & a:: ; toggles full screen with two adjacent keys Send ^u Return ~CapsLock & d:: ; accessibility: Alt + down Send !{down} Return ~Capslock & z:: ; accessibility: next element Send !{right} Return ~Capslock & x:: ; delete Send {del} Return ; In some cases the AppsKey - between right Win logo key and right Control key - ; doesn't produce a contextual menu in MuseScore. ; This simple hotkey repairs that. ; NB: not every keyboard has got an AppsKey AppsKey::Click, right ; with the next hotkey we open the Tab Shortcuts within the window Preferences ; and activate the searchfield by clicking on it ; in order for this hotkey to work the window Preferences must be in a defined state ; in this case (as in most cases) that means: MINIMIZED ; NB: MSc remembers the last state of the window when it reopens ; the coordinates are relative to this window, so independent of the screen ; use PixelMousing and input the coordinates of TAB_SC_X, TAB_SC_Y ; resp. PREF_SEARCH_X and PREF_SEARCH_Y in Coordinates_small.ahk ; reload the master with [ + ] and test the hotkey ; NB: reloading Learn.ahk reloads Coordinates_stripped.ahk as well ~CapsLock & s:: ; Hotkey (#6) - two almost adjacent keys CoordMode, Mouse, Window ; coordinates relative to window Send !e ; opens Menu Edit Send {up} ; to Preferences Send {Enter} ; to activate Preferences Sleep, 600 ; give MSc enough time to open the window Click, %Tab_Sc_X%, %Tab_Sc_Y% ; (TAB_SC) Preferences Tab Shortcuts Sleep, 300 Click, %Pref_Search_X%, %Pref_Search_Y% ; clicks searchfield Return ; ♣===================================== DEFINED STATE ============================================ ; Test Image Recognition ; check Inspector.Inspector.png (def. state chose height - toolbars - and width of Inspector) ~z & 5:: ; Test Image Recognition IM_01_Inspector_Inspector.png ImageSearch, , , IM_01_X1, IM_01_Y1, IM_01_X2, IM_01_Y2, *40 IM_01_Inspector_Inspector.png If (ErrorLevel = 0) ; there is no error MsgBox, 4160, Test Image Recognition, The image of 'Inspector'`nis recognized. If (ErrorLevel = 1) ; there is an error of type 1 MsgBox, 4112, Test Image Recognition, ( The screen is not in the Defined State. The image of 'Inspector' is not recognized. Maybe the height is wrong. Check the toolbars. Maybe the width is wrong. Check the width of the Inspector. ) If (ErrorLevel = 2) ; there is an error of type 2 MsgBox, 4112, Test Image Recognition, ( Test of 'Inspector' image. There was a problem that prevented the command from conducting the search. E.g. failure to open the image file or a badly formatted option. Start checking name and location of the file. ) Return ; ♣=========================== RESET WIDTH PALETTES and INSPECTOR ================================= ~z & -:: ; semi-auto-reset of the Palette separator to the Defined Width ; is the same as Z + U -> RWP in full version of Master ; alternative for Hotkey Z + 1 with prior manual reset to minimum width CoordMode, Mouse, Screen MouseGetPos, StartX, StartY ; original position MsgBox, 4161, Reset Palettes to my defined width, ( Make sure that the Palettes are as narrow as possible. If not, do it now. Reset also the screen to your preferred size, maximized or full. If everything is ready: press OK and click an empty spot on the screen. ) IfMsgBox, Cancel Return Keywait, LButton, D Click, up ; MsgBox, 4096, Reset Palettes width, To get the focus right:`nclick on OK or press Enter. ; for testing - its effect is more sleeptime MouseMove, % Min_Pal_Width, % A_ScreenHeight / 2 ; to my found minimal Palettes width Sleep, 100 Click, Down ; drag enable Sleep, 50 MouseMove, % Def_Pal_Width, % A_ScreenHeight / 2 ; to my defined Palettes width at half screenheight Click, U ; drag disable Sleep, 50 Send {Escape} MouseMove, StartX, StartY Send {Home} Return ~z & =:: ; semi-auto-reset of the Inspector separator to the Defined Width ; is the same as Z + U -> RWI in full version of Master ; alternative for Hotkey Z + 2 with prior manual reset to minimum width CoordMode, Mouse, Screen MouseGetPos, StartX, StartY ; original position MsgBox, 4161, Reset Inspector to my defined width, ( Make sure that the Inspector is as narrow as possible. If not, do it now. Reset also the screen to your preferred size, maximized or full. If everything is ready: press OK and click an empty spot on the screen. ) IfMsgBox, Cancel Return Keywait, LButton, D Click, up ; MsgBox, 4096, Reset Inspector width, To get the focus right:`nclick on OK or press Enter. ; for testing - its effect is more sleeptime MouseMove, % Min_Insp_Width, % A_ScreenHeight / 2 ; to my found minimal (docked) Inspector width at half screen height Sleep, 100 Click, Down ; drag enable Sleep, 50 MouseMove, % Def_Insp_Width, % A_ScreenHeight / 2 ; to my defined Inspector width at half screen height Click, U ; drag disable Send {Escape} MouseMove, StartX, StartY Send {Home} Return ; These resets are also possible via the utility Z + U _> input RWP (Palettes) or RWI (Inspector) ; RWP and RWI don't need images but are only semi automatic, asking for user actions ; In contrast the hotkeys Z + 1 and Z +2 work fast and are fully automatic. ; But they need 3 images. ; for the hotkey Z + F1 we have to make two images: Palette_Locator_Left.png and Palette_Locator_Right.png. ; Palette_Locator_Left.png must be made when the Palettes are most left. Palette_Locator_Right.png when the Palettes are most right. ; first we have to determine their surface area which is the same for both of them and enter the coordinates in the file coordinates.ahk ; with Z + F11 you can determine the surface area ; their surface area is a ribbon across the width of the Screen when Palettes resp. Inspector are at their extreme left cq right ; we reload the Master - with [ + ] - to reload the coordinates. Next we use the hotkey Z + F1 to test these two images. are they recognized? ; are our numbers of their ribbon like surface area correct? ; if recognized we can use the hotkey Z + F1 and PixelMousing to determine two distances: ; these are called Left_Loc_Dist_X and Right_Loc_Dist_X ; we enter these distances (number of pixels) of course also in the file Coordinates.ahk ; with the hotkey Z + 1 we can now quickly reset the widt of the palettes to the defined state. ; the combi Z + F2 and Z + 2 does the same but now for the Inspector, where only one image suffices. ; NB: The search for the locators and their Offsets to the Separator is also used ; in the hotkey Ctrl + Win + Z (^#z::) in "Independent_Hotkeys.ahk" ; when the inspector is at its narrowest the word 'Inspector' will be truncated to 'Insp' ; so this image will show 'Insp' ~z & f1:: ; test images and measure distance (2x) from locators to palette separator MsgBox, 4160, Test Palette Left Locator, Make the Palettes as narrow as possible.`nPress Z when ready. KeyWait, z, d ImageSearch, X, Y, Pal_Loc_X1, Pal_Loc_Y1, Pal_Loc_X2, Pal_Loc_Y2, *80 Palette_Locator_Left.png ; nb with *80 more color shades are allowed If (Errorlevel = 0) { MsgBox, 4144, Test Palette Left Locator, Left Locator recognized MouseMove, X, Y ; to make measurement possible Tooltip, Activate PixelMousing. Press CapsLock to make the coordinates visible.`nMeasure the X-distance to the point where the Palettes separator becomes`nactive. This number is 'Left_Loc_Dist_X'. Press Z when ready, X, Y+60, 5 ; (*change*?) KeyWait, z, d Tooltip, , , , 5 ; end of tooltip (5) } If (Errorlevel = 1) { MsgBox, 4112, Test Palette Left Locator, Left Locator not recognized.`nCheck the Search Area.`n`nThe macro will exit. Return } If (Errorlevel = 2) { MsgBox, 4112, Test Palette Left Locator, Left Locator not recognized.`nThere was a problem that prevented the command from conducting the search.`nE.g. a failure to open the image file or a badly formatted option.`n`nCheck name and location of the png.`nThe macro will exit. Return } MsgBox, 4160, Test Palette Right Locator, Make the Palettes as wide as possible.`nPress Z when ready. KeyWait, z, d ImageSearch, X, Y, Pal_Loc_X1, Pal_Loc_Y1, Pal_Loc_X2, Pal_Loc_Y2, *80 Palette_Locator_Right.png ; nb with *80 more color shades are allowed If (Errorlevel = 0) { MsgBox, 4144, Test Palette Right Locator, Right Locator recognized MouseMove, X, Y ; to make measurement possible Tooltip, Activate PixelMousing. Press CapsLock to make the coordinates visible.`nMeasure the X-distance to the point where the Palettes separator becomes`nactive. This number is 'Right_Loc_Dist_X'. Press Z when ready, X, Y+60, 5 ; (*change*?) KeyWait, z, d Tooltip, , , , 5 ; end of tooltip (5) } If (Errorlevel = 1) { MsgBox, 4112, Test Palette Right Locator, Right Locator not recognized.`nCheck the Search Area.`n`nThe macro will exit. Return } If (Errorlevel = 2) { MsgBox, 4112, Test Palette Right Locator, Right Locator not recognized.`nThere was a problem that prevented the command from conducting the search.`nE.g. a failure to open the image file or a badly formatted option.`n`nCheck name and location of the png.`nThe macro will exit. Return } Return ~z & 1:: ; reset the Palette separator to the Defined Width. Use two pngs if needed CoordMode, Mouse, Screen MouseGetPos, StartX, StartY ImageSearch, X, Y, Pal_Loc_X1, Pal_Loc_Y1, Pal_Loc_X2, Pal_Loc_Y2, *80 Palette_Locator_Left.png If (Errorlevel = 0) ; { MouseMove, (X+=Left_Loc_Dist_X), A_ScreenHeight / 2 ; measured distance to separator is ... (See Coordinates file) Click, Down ; drag enable Sleep, 50 MouseMove, % Def_Pal_Width, % A_ScreenHeight / 2 ; to my defined Palettes width Click, U ; drag disable Sleep, 50 Send {Escape} Click, %StartX%, %StartY% } If (Errorlevel = 1) { ImageSearch, X, Y, Pal_Loc_X1, Pal_Loc_Y1, Pal_Loc_X2, Pal_Loc_Y2, *80 Palette_Locator_Right.png If (Errorlevel = 0) { MouseMove, (X+=Right_Loc_Dist_X), A_ScreenHeight / 2 ; measured distance to separator is ... (See Coordinates file) Click, Down ; drag enable Sleep, 50 MouseMove, % Def_Pal_Width, % A_ScreenHeight / 2 ; to my defined Palettes width Click, U ; drag disable Sleep, 50 Send {Escape} Click, %StartX%, %StartY% } If (Errorlevel = 1) MsgBox, 4144, To Defined State Palettes, Palettes Separator not found.`nTry the utility Reset Width Palettes.`nPress Z + U and enter RWP. } Return ~z & f2:: ; test image and measure distance from Insp image to inspector separator CoordMode, Mouse, Screen MouseGetPos, StartX, StartY ImageSearch, X, Y, IM_01_2_X1, IM_01_2_Y1, IM_01_2_X2, IM_01_2_Y2, *40 IM_01_2_Inspector_Displaced_Insp.png If (Errorlevel = 1) ; Inspector is not present or undocked { MsgBox, 4144, Determine 'Insp' Offset, The Inspector is not present or undocked`nor there are unwanted toolbars active. Return } If (Errorlevel = 0) { MsgBox, 4144, Determine 'Insp' Offset, The image is recognized. MouseMove, X,Y ; to make measurement possible Tooltip, Activate PixelMousing. Press CapsLock to make the coordinates visible.`nMeasure the X-distance to the point where the Inspector separator becomes`nactive.This number is 'Insp_Loc_Dist_X'. Press Z when ready, X-60, Y+60, 5 ; (*change*?) KeyWait, z, d Tooltip, , , , 5 ; end of tooltip (5) } MouseMove, StartX, StartY Return ~z & 2:: ; reset the Inspector separator to the Defined Width CoordMode, Mouse, Screen MouseGetPos, StartX, StartY ImageSearch, X, Y, IM_01_2_X1, IM_01_2_Y1, IM_01_2_X2, IM_01_2_Y2, *40 IM_01_2_Inspector_Displaced_Insp.png If (ErrorLevel =1) ; Inspector not present or undocked { MsgBox, 4144, Find Inspector Width, The Inspector is not present or undocked.`nMaybe the panel is undocked`nor there are unwanted toolbars active. Click, %StartX%, %StartY% Return } If (Errorlevel = 0) { MouseMove, (X-=Insp_Loc_Dist_X), A_ScreenHeight / 2 ; Click, down ; drag enable Sleep, 50 MouseMove, % Def_Insp_Width, % A_ScreenHeight / 2 ; to my defined Inspector width Sleep, 50 Click, U ; drag disable Send {Escape} Sleep, 50 } Click, %StartX%, %StartY% Return ; ♣================================DEFINED STATE TOOLBARS ========================================= ~CapsLock & 8:: ; all toolbars off (*change*?) NB: you could change the search area to, exclude high or low toolbars from being unticked MouseGetPos, StartX, StartY Loop { MouseMove, % ToolBarSel_X, % ToolBarSel_Y ; click Toolbar selection spot Click, right Sleep, 150 ; time to open contextual menu - dependent on system and CPU load (*change*?) ImageSearch, Tick_X, Tick_Y, CTS_X1, CTS_Y1, CTS_X2, CTS_Y2, *40 CTS_Checked_ticked_sign.png If (ErrorLevel = 0) ; if tick √ present { MouseMove, Tick_X + ToolBTickOffset_X, Tick_Y + ToolBTickOffset_Y Click ; click tick away Sleep, 50 Continue } If (ErrorLevel = 1) ; when all ticks in search area are unticked { Click, %ToolBarSel_X%, %ToolBarSel_Y% Break ; stop search loop } } MouseMove, StartX, StartY Return ; if you want to activate the alternative version you have to outcomment this version ; remove semicolon and space in the next line ; */ /* ; ALTERNATIVE VERSION. Defined State must contain Toolbars NOTE INPUT and WORKSPACES only ; this alternative version is outcommented. To activate it delete /* above and */ at the end of this alternative version ; and outcomment the MAX CANVAS version as indicated above ~CapsLock & 8:: ; switch the toolbars from 'File Operations' to 'Feedback' off if on. Switch Note Input and Workspaces on if off (*change*?) MouseGetPos, StartX, StartY Loop { MouseMove, % ToolBarSel_X, % ToolBarSel_Y ; to Toolbar selection spot Click, right Sleep, 150 ; in the meantime open contextual menu. sleeptime dependent on system and CPU load (*change*?) ImageSearch, Tick_X, Tick_Y, FoFb_X1, FoFb_Y1, FoFb_X2, FoFb_Y2, *40 CTS_Checked_ticked_sign.png If (ErrorLevel = 0) ; if tick √ present { MouseMove, Tick_X + ToolBTickOffset_X, Tick_Y + ToolBTickOffset_Y Click ; click tick away Sleep, 50 ; click closes contextual menu Continue ; execute again from first line of loop } If (ErrorLevel = 1) ; when all ticks in search area are unticked Break ; stop search loop from 'File Operations' to 'Feedback' } ; contextual menu is still open ImageSearch, Tick_X, Tick_Y, NoteInp_X1, NoteInp_Y1, NoteInp_X2, NoteInp_Y2, *40 CTS_Checked_ticked_sign.png If (ErrorLevel = 1) ; if tick √ is not present { MouseMove, NoteInp_X1 + ToolBTickOffset_X, NoteInp_Y1 + ToolBTickOffset_Y Click ; switch toolbar Note Input on Sleep, 50 ; click closes contextual menu MouseMove, % ToolBarSel_X, % ToolBarSel_Y ; to Toolbar selection spot Click, right Sleep, 150 ; in the meantime open contextual menu again Goto, CheckWorkspaces } If (ErrorLevel = 0) Goto, CheckWorkspaces CheckWorkspaces: ImageSearch, Tick_X, Tick_Y, WorkSp_X1, WorkSp_Y1, WorkSp_X2, WorkSp_Y2, *40 CTS_Checked_ticked_sign.png If (ErrorLevel = 1) ; if tick √ is not present { MouseMove, WorkSp_X1 + ToolBTickOffset_X, WorkSp_Y1 + ToolBTickOffset_Y Click ; switch toolbar Workspaces on } If (ErrorLevel = 0) ; if tick √ is present Click, %ToolBarSel_X%, %ToolBarSel_Y% Sleep, 50 ; click closes contextual menu MouseMove, StartX, StartY Return */ ; ♣================================= EXPAND COLLAPSED INSPECTOR SECTIONS ========================== ; if screen in defined state ~z & i:: ; check current inspector sections - if collapsed expand: ▼ instead of ► CoordMode, Pixel, Screen CoordMode, Mouse, Screen ImageSearch, , , IM_01_X1, IM_01_Y1, IM_01_X2, IM_01_Y2, *40 IM_01_Inspector_Inspector.png Sleep, 100 If ErrorLevel ; if 'Inspector' is not in the correct spot { MsgBox, 4112, Check Inspector Sections, The screen is not in the defined state.`nThe macro will exit. Return } PixelSearch, ElementX, ElementY, % CSA_X1, % CSA_Y1, % CSA_X2, % CSA_Y2, ColorV1, , Fast RGB ; voice 1 if ErrorLevel PixelSearch, ElementX, ElementY, % CSA_X1, % CSA_Y1, % CSA_X2, % CSA_Y2, ColorV2, , Fast RGB ; voice 2 if ErrorLevel PixelSearch, ElementX, ElementY, % CSA_X1, % CSA_Y1, % CSA_X2, % CSA_Y2, ColorV3, , Fast RGB ; voice 3 if ErrorLevel PixelSearch, ElementX, ElementY, % CSA_X1, % CSA_Y1, % CSA_X2, % CSA_Y2, ColorV4, , Fast RGB ; voice 4 if ErrorLevel { MsgBox, 4144, Search element, Nothing selected. The macro will exit. Return } Click, %ElementX%, %ElementY% Sleep, 50 Loop, 30 { ImageSearch, TrX, TrY, IM_18_X1, IM_18_Y1, IM_18_X2, IM_18_Y2, IM_18_Inspector_Triangle_Closed.png If (ErrorLevel = 0) { MouseMove, TrX + TriAngleOffset_X, TrY + TriAngleOffset_Y Click Sleep, 50 Continue } If (ErrorLevel = 1) Break } Sleep, 300 Click, %ElementX%, %ElementY% Return ; ♣============================== GET COORDINATES OF HOTSPOTS AND SURFACES ======================== ~z & f11:: ; get coordinates (GC) of hotspots DetectHiddenWindows, On SetTitleMatchMode, 2 Run, PixelMousing.ahk ; if PM is already running it will reload Sleep, 300 GC_Loop := 0 GC_LoopEnable := 0 CoordMode, Mouse, Window MsgBox, 4097, Get hotspot coordinates Z + F11, ( Loop: get the coordinates of x hotspots To get maximum precision use this macro in combination with PixelMousing which starts automatically. Help screen PM / + H Show/hide coordinates CapsLock For maximum precision when using PM: Activate storing NumpadEnter Store coordinates Num7 or Num9 Alternatively with manual mousesteering: Store coordinates Control After the last hotspot: Stop loop Shift The coordinates are written to the clipboard. At the end of the macro the text file Hotspot Coordinates will be opened. Here you can paste the coordinates with Control + V. ) IfMsgBox, Cancel Return Tooltip, With Pixelmousing: before storing press NumpadEnter.`nStore with Numpad 7 or Numpad 9.`nWithout Pixelmousing: store with Control.`nStop the loop with Shift., A_ScreenWidth / 2, 0, 6 ; (*change*?) Keywait, Enter, u clipboard := "" ; empty the clipboard Sleep, 50 Loop { Input, FindCoord, , {NumpadEnter}{LControl}{RControl}{LShift}{RShift} If (ErrorLevel = "Endkey:RShift") || (ErrorLevel = "Endkey:LShift") { Tooltip, , , , 6 ; close ToolTip (6) Break } If (ErrorLevel = "Endkey:LControl") || (ErrorLevel = "Endkey:RControl") GC_Loop := 1 If (ErrorLevel = "Endkey:NumpadEnter") { Input, PM_Use, , {Numpad7}{Numpad9} If (ErrorLevel = "Endkey:Numpad7") || (ErrorLevel = "Endkey:Numpad9") GC_LoopEnable := 1 } If (GC_Loop = 1) || (GC_LoopEnable = 1) { MouseGetPos, StartX, StartY ; MsgBox, 4160, Get Coordinates, Coordinates pair # %A_Index%.`nThe mouse position is x=%StartX% y=%StartY% ; stability delay - for testing Sleep, 50 Tooltip, Hotspot: Cordinates pair # %A_Index%.`nX = %StartX% and Y = %StartY%`nPress Shift to end the loop, StartX, StartY - 50, 3 ClipboardText = %StartX%%A_Space%%A_Space%%A_Space%%StartY% If (A_Index < 10) ClipNew = %A_Index%%A_Space%%A_Space%%A_Space%%A_Space%%A_Space%%ClipboardText% Else ClipNew = %A_Index%%A_Space%%A_Space%%A_Space%%ClipboardText% If (A_Index = 1) Clipboard = %ClipNew% If (A_Index > 1) Clipboard = %Clipboard%`n`r%ClipNew% GC_Loop := 0 GC_LoopEnable := 0 } } Tooltip, , , , 3 ; close ToolTip (3) MsgBox, 4096, Get hotspot coordinates, ( You pressed Shift to end the loop. The coordinates in the clipboard are X Y %Clipboard% After pressing OK the text file Hotspot_Coordinates.txt will be opened. Here you can paste the coordinates with Control + V. PixelMousing will exit. ) Sleep, 500 SetTitleMatchMode, 2 If WinExist("Hotspot_Coordinates") Goto, SkipRunHC Run, Hotspot_Coordinates.txt, , Min ; start minimized WinWait, Hotspot_Coordinates SkipRunHC: IfWinNotActive, Hotspot_Coordinates WinActivate, Hotspot_Coordinates WinWaitActive, Hotspot_Coordinates WinGetPos, , , Width, Height, Hotspot_Coordinates WinMove, Hotspot_Coordinates, , (A_ScreenWidth/2)-(Width/2), (A_ScreenHeight/2)-(Height/2), 800, 800 ; 800, 800 size of text window (*change*?) If WinExist("PixelMousing") ; makes PixelMousing last found window WinClose ; so no extra info needed to close it Return ~z & F12:: ; get coordinates (GC) of surfaces DetectHiddenWindows, On SetTitleMatchMode, 2 Run, PixelMousing.ahk ; if PM is already running it will reload Sleep, 300 Even := 0 GC_Loop := 0 GC_LoopEnable := 0 GC_LoopDisable := 0 CoordMode, Mouse, Window MsgBox, 4097, Get surface coordinates Z + F12, ( Loop: get the coordinates of x surfaces A surface is determined by its TopLeftCorner TLC and its BottomRightCorner BRC. Set the TLC first. To get maximum precision use this macro in combination with PixelMousing which starts automatically. Help screen PM / + H Show/hide coordinates CapsLock For maximum precision when using PM: Before storing TLC NumpadEnter Store TLC Numpad7 Before storing BRC NumpadEnter Store BRC Numpad9 Alternatively with manual mousesteering: Store TLC Control Store BRC Control After the last surface: Stop loop Shift The coordinates are written to the clipboard. At the end of the macro the text file Image Coordinates will be opened. Here you can paste the coordinates with Control + V. ) IfMsgBox, Cancel Return Tooltip, With Pixelmousing: before each storing press NumpadEnter.`nStore TLC with Numpad 7. Store BRC with Numpad 9.`nWithout Pixelmousing: store TLC with Control`, store BRC with Control.`nStop the loop with Shift., A_ScreenWidth / 2, 0, 6 ; (*change*?) Keywait, Enter, u clipboard := "" ; empty the clipboard Sleep, 50 Loop { if Mod(A_Index, 2) = 0 Even := 1 ; pass number is even else Even := 0 ; pass number is odd Input, FindCoord, , {NumpadEnter}{LControl}{RControl}{LShift}{RShift} If (ErrorLevel = "Endkey:RShift") || (ErrorLevel = "Endkey:LShift") { Tooltip, , , , 6 ; close ToolTip (6) Break } If (ErrorLevel = "Endkey:LControl") || (ErrorLevel = "Endkey:RControl") GC_Loop := 1 If (ErrorLevel = "Endkey:NumpadEnter") { ; MsgBox, You pressed NumpadEnter ; for testing Sleep, 100 Input, PM_Use, , {Numpad7}{Numpad9} ; input for Pixel Mousing If (ErrorLevel = "Endkey:Numpad7") { GC_LoopEnable := 1 ; MsgBox, You pressed Numpad7 ; for testing } If (ErrorLevel = "Endkey:Numpad9") { GC_LoopDisable := 1 ; MsgBox, You pressed Numpad9 ; for testing } } Sleep, 100 If (GC_Loop = 1) || (GC_LoopEnable = 1) || (GC_LoopDisable = 1) { If (Even = 0) || (GC_LoopEnable = 1) { ; MsgBox, 4160, Get Coordinates, TLC Coordinates pair # %A_Index%.`nThe mouse position is%A_Tab%x=%A_Tab%%X1%%A_Tab%y=%A_Tab%%Y1% ; stability delay - for testing MouseGetPos, X1, Y1 ClipboardText = X1 =%A_Tab%%X1%%A_Tab%%A_Tab%Y1 =%A_Tab%%Y1% Tooltip, , , , 4 Tooltip, Cordinates pair # %A_Index%.`nTLC: X1 = %X1% and Y1 = %Y1%`nPress Shift to end the loop, X1, Y1 - 100, 3 ; (*change*?) } If (Even = 1) || (GC_LoopDisable = 1) { ; MsgBox, 4160, Get Coordinates, BRC Cordinates pair # %A_Index%.`nThe mouse position is%A_Tab%x=%A_Tab%%X2%%A_Tab%y=%A_Tab%%Y2% ; stability delay - for testing MouseGetPos, X2, Y2 ClipboardText = X2 =%A_Tab%%X2%%A_Tab%%A_Tab%Y2 =%A_Tab%%Y2% Tooltip, , , , 3 Tooltip, Cordinates pair # %A_Index%.`nBRC: X2 = %X2% and Y2 = %Y2%`nPress Shift to end the loop, X2, Y2 - 100, 4 ; (*change*?) } If (A_Index < 10) ClipNew = %A_Index%%A_Space%%A_Space%%A_Space%%A_Space%%A_Space%%ClipboardText% Else ClipNew = %A_Index%%A_Space%%A_Space%%A_Space%%ClipboardText% If (A_Index = 1) Clipboard = %ClipNew% If (A_Index > 1) Clipboard = %Clipboard%`n`r%ClipNew% GC_Loop := 0 GC_LoopEnable := 0 GC_LoopDisable := 0 } } ToolTip, , , , 3 ; close tooltip (3) ToolTip, , , , 4 ; close tooltip (4) MsgBox, 4096, Get surface coordinates, ( You pressed Shift to end the loop. The coordinates in the clipboard are %Clipboard% After pressing OK the text file Image_Coordinates.txt will be opened. Here you can paste the coordinates with Control + V. PixelMousing will exit. ) Sleep, 500 SetTitleMatchMode, 2 If WinExist("Image_Coordinates") Goto, SkipRunIC2 Run, Image_Coordinates.txt, , Min ; start minimized WinWait, Image_Coordinates SkipRunIC2: IfWinNotActive, Image_Coordinates WinActivate, Image_Coordinates WinWaitActive, Image_Coordinates WinGetPos, , , Width, Height, Image_Coordinates WinMove, Image_Coordinates, , (A_ScreenWidth/2)-(Width/2), (A_ScreenHeight/2)-(Height/2), 800, 800 ; 800, 800 size of text window (*change*?) If WinExist("PixelMousing") ; makes PixelMousing last found window WinClose ; so no extra info needed to close it Return ; ♣====================================== SUBROUTINE ============================================== InspectorCheck: ImageSearch, , , IM_01_X1, IM_01_Y1, IM_01_X2, IM_01_Y2, *40 IM_01_Inspector_Inspector.png If ErrorLevel { Send {Click} Sleep, 100 Send {Escape} ; to suppress the contextual menu Sleep, 50 MsgBox, 4112, Inspector Check, The screen is not in the defined state.`nThe macro will exit., 1 Exit } Return ; ♣================================================================================================