I’m working on a program in AutoHotKey that automates the process for mass converting .FTM (FamiTracker) files to .WAV. The problem is that I want it to increment the value of the “send {down}” statement +1 each loop (to select the next song in the folder).
edit I’ve updated the code. The increment statement works, I just need to find a way to make the whole program loop as many times as needed to convert all the files in the folder (adding +1 to send {down} each loop). The problem right now is it’s not looping the whole program. Any help is appreciated!
Here’s an excerpt of how the program looks after launching the FamiTracker music application:
Sleep, 800 ; I want the program to loop back to here when it reaches the last line
click 20,30 ; clicks "file"
Sleep, 500
Send {down 2} ; clicks "open"
send {enter}
Sleep, 1200
click 211,128 ; clicks first filename in folder
Sleep, 1200
send {enter}
Sleep, 1000
click 20,30 ; clicks "file"
send {down 6}
send {enter} ; clicks "create wav"
Sleep, 1000
click 157,57 ; increase playcount to 2
Sleep, 500
send {enter}
Sleep, 1000
send {enter}
Sleep, 2500
send {enter}
click 20,30 ; clicks "file"
Sleep, 500
Send {down 2} ; clicks "open"
send {enter}
Sleep, 1200
click 211,128 ; clicks first filename in folder
Sleep, 1000
Jmp:=1
Loop
{
Send, {Down %Jmp%}
Jmp+=1
return
}
sleep, 100
send {enter}
Sleep, 1000
click 20,30 ; clicks "file"
send {down 6}
send {enter} ; clicks "create wav"
Sleep, 1000
click 157,57 ; increase playcount to 2
Sleep, 500
send {enter}
Sleep, 1000
send {enter}
Sleep, 2500
send {enter}
Sleep, 1000 ; final line of code, want it to loop back to line 1 to repeat process till all files in folder are converted
I’ve been stuck for quite some time, any ideas? I essentially want the cursor to move onto the next song after each loop of the program. The first time the program runs, it loads song1, then once song1 is finished, it’ll repeat the process but go on and click song2, and so forth.
Thanks a lot
f you want to skip one more file in a loop, you could use something like this.
You should add a test to compare the last file name with the current filename, to exit this loop at the end of the list.
I have updated your code to show how to use the Loop. The curly brackets define what will be executed inside the loop.
Your original code will run until the end of the file list and then continue to perform the same action on the last file over and over again. Therefore I added a filename comparison inside the code. On file open, you probably have the filename available in text form, this is what you copy onto your ClipBoard and compare the ClipBoard with the previous filename. By adding a starting number you can restart at a certain file.
I see that your code uses a lot of mouseclicks. This is no problem if you only run this once, but if you want to run this reliably, there are other methods.
Overall checking:
Check EVERY window that is opened during this process and verify that the right window is open. In this example I check to see if the window with the title “File Open” is indeed opened and active (an other process or program [chat, updates, etc.] can take over the focus and your script would execute the code in this other program…).
Also try to use keyboard shortcuts when possible or (more advanced) use the
AutoHotKey Windows Spyand check the ClassNN: at the section “Now under Mouse Cursor” then use this to directly activate these buttons unstead of through the mouse coordinates.Good luck!