• How to make Autohotkey GUI show on Monitor 2?
    3 replies, posted
I have an autohotkey script that lets me adjust system volume with keyboard shortcuts (my keyboard does not have volume controls). I found this script that works great and briefly shows this little red and blue volume bar in the corner of my display https://files.facepunch.com/forum/upload/110042/f3edb1ed-e646-423b-9966-d83369e0bde1/2019-06-06_14-49-47.jpg But my computer has 2 monitors and I would prefer this little guy to be on monitor 2 instead of monitor 1. How do I do this? here's the autohotkey script in its entirety: ;_________________________________________________  ;_______User Settings_____________________________  ; Make customisation only in this area or hotkey area only!!  ; The percentage by which to raise or lower the volume each time: vol_Step = 3 ; How long to display the volume level bar graphs: vol_DisplayTime = 1000 ; Master Volume Bar color (see the help file to use more ; precise shades): vol_CBM = Red ; Wave Volume Bar color vol_CBW = Blue ; Background color vol_CW = Silver ; Bar's screen position.  Use -1 to center the bar in that dimension: vol_PosX = 100 vol_PosY = 100 vol_Width = 150  ; width of bar vol_Thick = 12   ; thickness of bar ; If your keyboard has multimedia buttons for Volume, you can ; try changing the below hotkeys to use them by specifying ; Volume_Up, ^Volume_Up, Volume_Down, and ^Volume_Down: Hotkey, +Up, vol_MasterUp      ; Win+UpArrow Hotkey, +Down, vol_MasterDown Hotkey, +^Up, vol_WaveUp       ; Shift+Win+UpArrow Hotkey, +^Down, vol_WaveDown ;___________________________________________  ;_____Auto Execute Section__________________  ; DON'T CHANGE ANYTHING HERE (unless you know what you're doing). vol_BarOptionsMaster = 1:B ZH%vol_Thick% ZX0 ZY0 W%vol_Width% CB%vol_CBM% CW%vol_CW% vol_BarOptionsWave   = 2:B ZH%vol_Thick% ZX0 ZY0 W%vol_Width% CB%vol_CBW% CW%vol_CW% ; If the X position has been specified, add it to the options. ; Otherwise, omit it to center the bar horizontally: if vol_PosX >= 0 { vol_BarOptionsMaster = %vol_BarOptionsMaster% X%vol_PosX% vol_BarOptionsWave   = %vol_BarOptionsWave% X%vol_PosX% } ; If the Y position has been specified, add it to the options. ; Otherwise, omit it to have it calculated later: if vol_PosY >= 0 { vol_BarOptionsMaster = %vol_BarOptionsMaster% Y%vol_PosY% vol_PosY_wave = %vol_PosY% vol_PosY_wave += %vol_Thick% vol_BarOptionsWave = %vol_BarOptionsWave% Y%vol_PosY_wave% } #SingleInstance SetBatchLines, 10ms Return ;___________________________________________  vol_WaveUp: SoundSet, +%vol_Step%, Wave Gosub, vol_ShowBars return vol_WaveDown: SoundSet, -%vol_Step%, Wave Gosub, vol_ShowBars return vol_MasterUp: SoundSet, +%vol_Step% Gosub, vol_ShowBars return vol_MasterDown: SoundSet, -%vol_Step% Gosub, vol_ShowBars return vol_ShowBars: ; To prevent the "flashing" effect, only create the bar window if it ; doesn't already exist: IfWinNotExist, vol_Wave Progress, %vol_BarOptionsWave%, , , vol_Wave IfWinNotExist, vol_Master { ; Calculate position here in case screen resolution changes while ; the script is running: if vol_PosY < 0 { ; Create the Wave bar just above the Master bar: WinGetPos, , vol_Wave_Posy, , , vol_Wave vol_Wave_Posy -= %vol_Thick% Progress, %vol_BarOptionsMaster% Y%vol_Wave_Posy%, , , vol_Master } else Progress, %vol_BarOptionsMaster%, , , vol_Master } ; Get both volumes in case the user or an external program changed them: SoundGet, vol_Master, Master SoundGet, vol_Wave, Wave Progress, 1:%vol_Master% Progress, 2:%vol_Wave% SetTimer, vol_BarOff, %vol_DisplayTime% return vol_BarOff: SetTimer, vol_BarOff, Off Progress, 1:Off Progress, 2:Off return
No offense but did you try reading through the script? I think tweaking these numbers should do it, just make your X position way higher, will probably take some trial and error vol_PosX = 100 vol_PosY = 100
tried that, but that just sends it off screen and the code doesn't accept negative numbers for vol_PosX or Y (negative numbers just center the volume bar) here's how my monitors are set up: https://files.facepunch.com/forum/upload/110042/47be8fc0-20f5-4e81-b273-344fdebfe353/image.png if I move monitor 2 to the other side in windows settings then I can move the volume bar to monitor 2 by setting vol_PosX to around 6000, but I can't physically move my second monitor to the right side of my main one.
Awesome glad you got it sorted. you can just remove those if checks entirely, because now the script doesn't support positive numbers. But no sweat if it works it works
Sorry, you need to Log In to post a reply to this thread.