Jump to content

Changing the directory


Recommended Posts

If anyone is familiar with FamiTracker, a music creation tracker software for the NES, that would be great, but probably not required.  I want to save a project as stems for mixing, but I'm not sure how to make the "Save As" window's directory change so that I can put the saved files in a specific folder.

The code as a whole looks like this

Dim $ChannelNames[8] = ["Pulse 1", "Pulse 2", "Triangle", "Noise", "DPCM", "VRC6 Pulse 1", "VRC6 Pulse 2", "Sawtooth"]
$numLoops = 3
$PromptForOutputDirectory = False
$OutputDir = "C:\Users\ysamu\Desktop\SAM\Audio\Famitracker\Exports(WAV)\Export Stems"

Opt ("WinTitleMatchMode", 2)

If $PromptForOutputDirectory == True Then
   $OutputDir = FileSelectFolder("Choose Output Directory", "")
EndIf

WinWaitActive("FamiTracker")
$ComboBox = ControlGetHandle ("FamiTracker", "", 1127)


For $p = 51 To 51
   If $p > 0 Then
      ;ControlSend("FamiTracker", "", 1127, "{DOWN}")
   EndIf
   $FileBase = ControlCommand("FamiTracker", "", 1127, "GetCurrentSelection", "")
   ExportSong()

   WinWaitActive("FamiTracker")

Next

Func ExportSong()
   For $j = 0 To (Ubound($ChannelNames))
      WinWaitActive("FamiTracker")
      ExportChannel($j)
   Next
EndFunc

Func ExportChannel($CurChannel)
   WinWaitActive("FamiTracker")
   ;WinMenuSelectItem("FamiTracker", "", "&File", "Create Wav...")
   Send("{LALT}")
   Sleep(200)
   Send("f")
   Sleep(200)
   Send("v")
   Sleep(200)
   WinWaitActive("FamiTracker")
   ControlSetText("Create wave file", "", 1155, $numLoops)
   SoloChannel($curChannel)
   Sleep(200)
   ControlClick("Create wave file", "", "[CLASS:Button; TEXT:Begin; INSTANCE:1]")
   WinWaitActive("Save As")
   Sleep(200)
   ;ControlClick("Save As", "Address: C:\Users\ysamu\Desktop\SAM\Audio\Famitracker\Exports(WAV)", "", 1, 508, 10 )
   ControlSend("Save As", "Address: C:\Users\ysamu\Desktop\SAM\Audio\Famitracker\Exports(WAV)", 1001, $OutputDir)
   Sleep(1000)
   ;Send("{ENTER}")
   Sleep(200)
   ControlSend("Save As", "", 1001, $fileBase & "_" & $ChannelNames[$curChannel])
   Sleep(500)
   ;Send("{ENTER}")
   WinWaitActive("Creating WAV... finished")
   ControlSend("Creating WAV... finished", "", 1160, "{ENTER}")
EndFunc

Func SoloChannel($curChannel)
   WinWaitActive("Create wave file")
   ControlSend("Create wave file", "", 1250, "{TAB}")
   ControlSend("Create wave file", "", 1250, "{TAB}")
   ControlSend("Create wave file", "", 1250, "{TAB}")
   ControlSend("Create wave file", "", 1250, "{TAB}")
   ControlSend("Create wave file", "", 1250, "{TAB}")
   ControlSend("Create wave file", "", 1250, "{DOWN}")
   For $m = 0 To (Ubound($ChannelNames) - 1)
      If $curChannel <> $m Then
         ControlSend("Create wave file", "", 1250, "{SPACE}")
      EndIf
      ControlSend("Create wave file", "", 1250, "{DOWN}")

   Next
EndFunc

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...