Hi,
I learned about variables yesterday and created this script. I'm using it to write text in Notepad, where each time, a new song title is erased and replaced by the next one after 1 second. I'm going to take a screen capture (Mp4) of this with ShareX and then import into a video editor (cropping out the edges) to create video captions.
Code: Select all
SetKeyDelay, 40
SetNumLockState , on
#SingleInstance Force
^q::suspend
^w::exitapp
^1::
a=40 ;key delay for typing text
b=0 ;key delay for erasing text
x=1000 ;duration text stays on screen before being erased
y=50 ; how many characters for BackSpace
z=1 ; starting increment
num=z++ ;increment by 1
1 = A Glorious Life
2 = A Jolly Warm-up for Flute
3 = A Medley of Three Christmas Carols
4 = A Pause for Thought
SetKeyDelay, %a%
send, Piece %num% : %1%
sleep, %x%
SetKeyDelay, %b%
send, {BackSpace %y%}
SetKeyDelay, %a%
send, Piece %num% : %2%
sleep, %x%
SetKeyDelay, %b%
send, {BackSpace %y%}
SetKeyDelay, %a%
send, Piece %num% : %3%
sleep, %x%
SetKeyDelay, %b%
send, {BackSpace %y%}
SetKeyDelay, %a%
send, Piece 4 : %4%
sleep, %x%
SetKeyDelay, %b%
send, {BackSpace %y%}
SetKeyDelay, %a%
return
It all worked well, except I'd like to make the number after the word "Piece" increment by 1 each time automatically.
Like this:
Piece 1 : A Glorious Life
Piece 2 : A Jolly Warm-up for Flute
Piece 3 : A Medley of Three Christmas Carols
Piece 4 : A Pause for Thought.
Obviously there's something wrong with my incremental variables.
Code: Select all
z=1 ; starting increment
num=z++ ;increment by 1
https://www.autohotkey.com/docs/v1/Variables.htm and Googled it extensively, and tried using
Code: Select all
:=
How can I achieve this please? Am I on the right lines? My final script will have 42 musical pieces, not 4 as in the example. Thank you for any assistance.