Sign in to follow this  
Followers 0
Champak

Variable Loop Construction

8 posts in this topic

I have a multitrack audio mixing program. I need to be able to mix down tracks automatically. I have most of this script running correctly, except the loop function. The loop has to end after a specific amount. This amount will change from track to track because some songs will have anywhere from 10 to 48 tracks. So here is a break down of what I need.

1/ Activate script an input box pops up.

2/ In the input you tell the script how many times to loop the "B" section. Then hit enter.

3/ The first part is "A" section, which does not loop.

4/ The second part is "B" section, which loops how many ever time you entered.

5/ The third part is "C" section, which is the final part of the script and then ends.

Here is what I have so far.

;ClipPut('');Clears the clipboard.
;Opt("SendKeyDelay", 400)


WinActivate("Audio")

;Open Mixer and bypass all eqs, sends, inserts

Send("{F3}")
Send("!+e")
Send("!+s")
Send("!+i")
Send("{F3}")

;Start Mixing Down

Send("{HOME}")              ;go to top of multitrack
    Sleep ( 1000 )

;Loop the function

    While 1
Send("s")               ;solo track
    Sleep ( 1000 )          ;time before next step 1000 = 1 second

Send("^!+s")                ;selects all on particular track
    Sleep ( 1000 )          ;time before next

Send("!1")              ;opens edit view
    Sleep ( 1000 )          ;time before next

$bull = StringTrimLeft(WinGetText(""), 15);copys title of track and deletes "Sample Editor:"    

Send("!1")              ;close edit view
    Sleep ( 1000 )          ;time before next

Send("!e")              ;opens mixdown window
    Sleep ( 3000 )          ;time before next

$Split = StringSplit($bull, @LF)    ;split off CRs
    If IsArray($Split) Then
            For $i = 1 To 1
                Send($Split[$i]);pastes track name
            Next
    EndIf
    Sleep ( 1000 )          ;time before next

Send("{ENTER}")             ;save---start mixdown
    Sleep ( 1000 )          ;time before next


If WinExists("Audio", "Do you want to replace") Then
        Send("{ENTER}")
        Sleep (1000)
    WinExists("Audio", "This file is already used in a pool")
        Send("{ENTER}")
EndIf
    Sleep ( 2000 )

;Uncomment next (4) lines if you have the import option pop up--change this to if function
;WinWait("Import Options", "", 600) ;waites for mixdown to complete then opens import options
;   Sleep ( 2000 )          ;time before next

;Send("{ENTER}")            ;import
;   Sleep ( 2000 )          ;time before next



Send("s")               ;unsolo track
    Sleep ( 1000 )          ;time before next

Send("{DOWN}")              ;moves to the next track
    Sleep ( 3000 )          ;time before next
Wend                    ;loop until end

;Open Mixer and clear bypass on all eqs, sends, inserts

Send("{F3}")
Send("!+e")
Send("!+s")
Send("!+i")
Send("{F3}")

;Reminder--Put in "Save As" function when have time

Thanks for any help

Share this post


Link to post
Share on other sites



ummm im kinda confused but check out

for and next in the help file

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I'm guessing the part you had in the While loop was part B? I placed it in a for loop, where the user determines how many times it will loop.

;ClipPut('');Clears the clipboard.
;Opt("SendKeyDelay", 400)
WinActivate("Audio")

;Open Mixer and bypass all eqs, sends, inserts

Send("{F3}")
Send("!+e")
Send("!+s")
Send("!+i")
Send("{F3}")

;Start Mixing Down

Send("{HOME}")      ;go to top of multitrack
    Sleep ( 1000 )

;I assume this is your "B" part
$var = Inputbox("Loop","Enter number of times to loop:")
    For $i = 1 to $var
Send("s")       ;solo track
    Sleep ( 1000 )  ;time before next step 1000 = 1 second

Send("^!+s")        ;selects all on particular track
    Sleep ( 1000 )  ;time before next

Send("!1")      ;opens edit view
    Sleep ( 1000 )  ;time before next

$bull = StringTrimLeft(WinGetText(""), 15);copys title of track and deletes "Sample Editor:"    

Send("!1")      ;close edit view
    Sleep ( 1000 )  ;time before next

Send("!e")      ;opens mixdown window
    Sleep ( 3000 )  ;time before next

$Split = StringSplit($bull, @LF);split off CRs
    If IsArray($Split) Then
            For $i = 1 To 1
                Send($Split[$i]);pastes track name
            Next
    EndIf
    Sleep ( 1000 )  ;time before next

Send("{ENTER}")     ;save---start mixdown
    Sleep ( 1000 )  ;time before next
If WinExists("Audio", "Do you want to replace") Then
        Send("{ENTER}")
        Sleep (1000)
    WinExists("Audio", "This file is already used in a pool")
        Send("{ENTER}")
EndIf
    Sleep ( 2000 )

;Uncomment next (4) lines if you have the import option pop up--change this to if function
;WinWait("Import Options", "", 600);waites for mixdown to complete then opens import options
;   Sleep ( 2000 )  ;time before next

;Send("{ENTER}")    ;import
;   Sleep ( 2000 )  ;time before next
Send("s")       ;unsolo track
    Sleep ( 1000 )  ;time before next

Send("{DOWN}")      ;moves to the next track
    Sleep ( 3000 )  ;time before next
Next            ;loop until number of times specified

;Open Mixer and clear bypass on all eqs, sends, inserts

Send("{F3}")
Send("!+e")
Send("!+s")
Send("!+i")
Send("{F3}")

;Reminder--Put in "Save As" function when have time
Edited by Simucal

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Use WinWaitActive if using Send Or WouseClicks, else expect some unexpected results. I mean else anything goes, like lost data.

Edit:

Champak, Could you mention the program name so someone can interact with your issue?

Edited by MHz

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thanks Simucal, your tip generally works, however, it wont work with:

$Split = StringSplit($bull, @LF);split off LFs
    If IsArray($Split) Then
            For $i = 1 To 1
                Send($Split[$i]);pastes track name
            Next
    EndIf

When that code is in, which I need, the loop justs continues as if I never specified a number. What now?

MHz, I originally used WinWaitActive, but didn't really like it, just for the sake I had to activate the program again instead of it just starting...just preference. But I changed it back as your suggestion. What I really want to do is have the script work in the background on the program, so I can do something else while everything is mixing down...if that is possible.

Thanks.

Edited by Champak

Share this post


Link to post
Share on other sites

Thanks Simucal, your tip generally works, however, it wont work with:

$Split = StringSplit($bull, @LF);split off LFs
    If IsArray($Split) Then
            For $i = 1 To 1
                Send($Split[$i]);pastes track name
            Next
    EndIf

When that code is in, which I need, the loop justs continues as if I never specified a number. What now?

MHz, I originally used WinWaitActive, but didn't really like it, just for the sake I had to activate the program again instead of it just starting...just preference. But I changed it back as your suggestion. What I really want to do is have the script work in the background on the program, so I can do something else while everything is mixing down...if that is possible. And the program I am using is Nuendo.

Thanks.

What is it you want it to do? How many times do you want it to Send the tracks name? Explain a little more please.

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

Share this post


Link to post
Share on other sites

...I originally used WinWaitActive, but didn't really like it, just for the sake I had to activate the program again instead of it just starting...just preference...

Try using WinWait followed by WinActivate, then WinWaitActive if you wish. You should not have to activate the window manually....

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Thanks for the help, I figured it out. Both the split function and the variable loop input had "For $i". So on one of them I changed the "i" to a different letter and it works.....so far.

Share this post


Link to post
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
Sign in to follow this  
Followers 0