Timers, movement and sound

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
PuzzledGreatly
Posts: 1303
Joined: 29 Sep 2013, 22:18

Timers, movement and sound

Post by PuzzledGreatly » 26 Nov 2022, 17:01

Is there a way to move a control and not have the movement paused by other actions such as playing sounds? In the sample code below the progress pauses slightly when the mp3 is played and more so when soundbeep is used. How to keep the movement smooth? Thanks.

Code: Select all

SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
SetBatchLines, -1

#SingleInstance force

Gui, test:New, -caption border Toolwindow -dpiscale +E0x02000000 +E0x00080000
Gui,color, white
Gui, margin, 0,0
Gui, add, progress, x0 y100 h120 w120 c165c9e Background165c9e disabled -E0x0200 vmover, 
gui, show, w%A_screenwidth% h%A_screenheight% maximize, test
SetTimer, go, 10

return

go:

guicontrolget, mover, test:pos
guicontrol, test:move, mover, % moverx > 1920 ?  "x" 0 : "x" moverx + 5

return

escape::
exitapp

@:: soundplay, ding.mp3, wait

space:: soundbeep
return

User avatar
mikeyww
Posts: 26891
Joined: 09 Sep 2014, 18:38

Re: Timers, movement and sound

Post by mikeyww » 26 Nov 2022, 18:21

I have not tried this, just thinking of ideas to try:

1. Separate script
2. AHK v2
3. Adjust thread priority or script priority
4. GUI player?

OK, now your work is cut out for you!

Post Reply

Return to “Ask for Help (v1)”