Use autokey to play audio for set periods of time

40 views
Skip to first unread message

Perrin Aybara

unread,
Nov 11, 2022, 10:19:20 AM11/11/22
to autokey-users
Hi folks...Hope someone can assist me - I use mpv as an audiobook player on my pc, it works perfectly as when I use "shift+q" it saves my play position and exits the app. So next time I start it, it resumes play where I stopped. 
So, I thought, if I use autokey, I could preset times, like 10 mins, 20 mins 30 mins etc. but I cannot get autokey to (focus) on the mpv that's open so when it sends the "shift+q" it saves and closes the program.

I hope that explains what I need. Here's the code I have so far, it's all good except the timer part doesn't work, need some help please?


#SingleInstance, Force


; GUI Layout
; ............
; .....................
GUI, +AlwaysOnTop

Gui, Font, cWhite

Gui, Add, Text,, Server Logins via ssh

GUI, Color, Black

GUI, Add, Button, w200 h30 gOpen_current, Open current book
GUI, Add, Button, w200 h30 gTimer_10m, Timer set to read 10 minutes
GUI, Add, Button, w200 h30 gTimer_20m, Timer set to read 20 minutes
GUI, Add, Button, w200 h30 gTimer_30m, Timer set to read 30 minutes

GUI, Show,x800 y50 w500 h500, The Gui
return


; Labels
; ............
; .....................
GuiClose:
ExitApp
return

Open_current:
Run, cmd
Sleep 500
Send {Text} cd C:\Users\Public\Downloads\mkv\
Sleep 1000
Send {Enter}
Send {Text} mpv "C:\Users\Perrin Aybara\Music\Audiobooks\Simon Haynes - Hal Spacejock Omnibus One Hal Spacejock Books 1-3, Plus Visit\Hal Spacejock Omnibus One Hal Spacejock Books 1-3, Plus Visit.mp3"
Send {Enter}
return

; set to 6000 atm for testing, will use correct value once it works
Timer_10m:
Sleep 6000 
Send +q
Sleep 1000
Send {Enter}
return

^x::ExitApp


Sebastian Lauffer

unread,
Nov 14, 2022, 1:27:50 AM11/14/22
to autokey-users
this is not a autoKey script. its autoHotKey

jos...@main.nc.us

unread,
Nov 14, 2022, 2:22:14 AM11/14/22
to autoke...@googlegroups.com
That's what I thought.

In my previous post I outlined how to accomplish what you want in AutoKey.
What further assistance would you like?

Just in case it's not clear, AutoKey does not support AutoHotKey scripts.
It has its own scripting facility with scripts written in Python which use
AutoKey API calls to interact with application windows. There is no tool
to convert a script from AutoHotKey to an AutoKey script.

Joe
> --
> You received this message because you are subscribed to the Google Groups
> "autokey-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to autokey-user...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autokey-users/8dba2122-5cc5-44c0-be31-c5ed5d3ff6e0n%40googlegroups.com.
>

Perrin Aybara

unread,
Nov 14, 2022, 3:49:55 AM11/14/22
to autoke...@googlegroups.com
oh my I'm sorry, I run both autokey and autohotkey as I have Linux and Windows systems, I got mixed up, so sorry to bug you guys. 

Perrin Aybara

unread,
Nov 14, 2022, 3:51:37 AM11/14/22
to autoke...@googlegroups.com
Oh and you say " In my previous post I outlined how to accomplish what you want in AutoKey." -- what previous post, sorry?

jos...@main.nc.us

unread,
Nov 15, 2022, 6:21:58 AM11/15/22
to autoke...@googlegroups.com
Well, I posted it somewhere, LOL. If I find it, I'll post it here.

Joe
>>> https://groups.google.com/d/msgid/autokey-users/bfe4c9a7758c92a20339c3dcf75cdc2e.squirrel%40www.main.nc.us
.
> --
> You received this message because you are subscribed to the Google
Groups
> "autokey-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
an
> email to autokey-user...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autokey-users/CACiRkmYcGcavrhj%3DeHTaKhQuP4Jzc6VtcCfb8rfT87j2KRmjFw%40mail.gmail.com.



Kreezxil

unread,
Nov 15, 2022, 7:02:14 AM11/15/22
to autokey-users
At the risk of being shunned by the other penguins, I found this interesting competitor to AK and AHK that bridges the gap. I am not personally using it, but it looks like it is closer to AHK than AK. However, from perusing it, I do realize one could easily convert from AHK or AK to it.

Check out https://espanso.org/ which runs on Linux, Mac, and Windows.

Stephen Meech

unread,
Nov 15, 2022, 7:11:52 AM11/15/22
to autoke...@googlegroups.com, Kreezxil

That looks very interesting.

There's even a .AHK to Espanso convertor at https://ahk-to-espanso.as93.net/ and some work towards reproducing AutoHotKey's excellent auto-correct script at https://notes.aliciasykes.com/22944/spelling-auto-correct-system.

jack

unread,
Nov 15, 2022, 1:58:05 PM11/15/22
to autoke...@googlegroups.com
I use espanso on Linux, a little. Is very nice.

Jack

Stephen Meech

unread,
Nov 16, 2022, 10:00:50 AM11/16/22
to autokey-users
I've been looking for a replacement for AutoHotKey for years and that's the main reason I experimented with AutoKey (to get slightly back on topic!). AutoKey can do a lot more but is not suited to trivial text expansion.

Kreezxil

unread,
Nov 17, 2022, 7:38:44 AM11/17/22
to autokey-users
Truly agree, I've been with the program a long, long time now, across three handles no less as proven by the wiki. Hypershock, Itscool, and now Kreezxil. I've contributed heavily with multiple examples of scripting tools.

Perrin Aybara

unread,
Nov 17, 2022, 6:37:54 PM11/17/22
to autokey-users
Since this thread has been hijacked and is now COMPLETELY off the original topic, can I ask ADMIN TO CLOSE THIS please? I can't understand why people do this but hey whatever.
Reply all
Reply to author
Forward
0 new messages