Jump to content

Automated Program Timer


Recommended Posts

I'm making a script for my job that opens up "Pinnacle Studio 9", selects a .avi file, and then times how long it takes to render it to a mpeg. I have teh script all finished, but i ahve a few things i need done still. (keep in mind i first touched this program yesterday at 8 AM)

here is my main script to run the actions.

Run("studio.exe");opens Pinnacle Studio 9
WinSetState("Pinnacle Studios", "", @SW_MAXIMIZE);maximizes window to make sure coordinates for mouse are correct
WiNWaitActive("Pinnacle Studio - Untitled")
Sleep(5000)
Send("{ENTER}")


    MouseClick ( "left", 226, 65, 1, 10);opens 'Create' tab
    MouseClick ( "left", 280, 100, 1, 10);opens drop down menu
    MouseClick ( "left", 118, 134, 1, 10);selects "oranges_dv.avi"
    Sleep(500)
    MouseClick ( "left", 100, 238, 1, 10);selects one scene
    Send("^a")
    Send("^c");selects and copies all scenes
    MouseClick ( "left", 210, 477, 1, 10)
    Send("^v");clicks on slide area and pastes scenes there
    Sleep(2000)
    MouseClick ( "left", 371, 67, 1, 10);opens 'Make Movie' tab
    Sleep(2000)
    MouseClick ("left", 160, 344, 1, 10);selects 'render'
    Send("Test.mpg")
    Send("{ENTER}")
    Sleep(700)
    If WinActive("Pinnacle Studio", "file already exists") then
    Send("!y");enters movie name, and prompts to overwrite if applicable
    EndIf
    $begin = timerInit();begins timer after file name selection
    WinWaitActive("Pinnacle Studio", "Create MPEG file...")
    $dif = TimerDiff($begin);ends timer after rendering period
    Send("!f")
    Send("nn")
MsgBox(0, "", $dif)

it isnt important to know what easch movement does. My problems are as follows:

I want to script the program to loop 5 times, then show a message box displaying the five rendering times. Imaging teh above script, without the program opening and the final message box. I used "$begin2, $dif2", etc. as the script goes on then this is the final line:

MsgBox(0, "Time", $dif $dif2 $dif3 $dif4 $dif5)

I can't get it to work, it keeps reporting an error, which is really frustrating as I have to sit and watch stuff render for 10 minutes to watch it not work. I also wanted to put each one on seperate lines, but the "_" never works when i put it inbetween things, hell I even saved the example underscore script and ran it and THAT didnt work. I dont know what is up with that.

My other idea was to have an input box execute on the command, and you would be able to type how many times you wanted to run the program. I did:

$I_Var = ImputBox("", "How many times would you like to run the operation?", "1", "", "-1", "-1")
$I_Var = $x
$i = 0
Do
....Insert Script.....
$i = $i + 1
Until $i = $x

I thought that might work, but no. Any help would be greatly appriciated.

Mike

Amp Energy Drink: the official sponsor of me scripting at 2AM.

Link to comment
Share on other sites

I want to script the program to loop 5 times, then show a message box displaying the five rendering times.

something like this ??

const $N_RUNS = 5

StartPinacle()
$msg = ""
for $i = 1 to $N_RUNS 
   $msg = $msg & " " & Time_RenderMovie()
next
msgbox(0,"", "Render Times: " & $msg)


func StartPinacle()
    Run("studio.exe");opens Pinnacle Studio 9
    WinSetState("Pinnacle Studios", "", @SW_MAXIMIZE);maximizes window to make  sure coordinates for mouse are correct
    WiNWaitActive("Pinnacle Studio - Untitled")
    Sleep(5000)
    Send("{ENTER}")
endfunc

func Time_RenderMovie()
    MouseClick ( "left", 226, 65, 1, 10);opens 'Create' tab
    MouseClick ( "left", 280, 100, 1, 10);opens drop down menu
    MouseClick ( "left", 118, 134, 1, 10);selects "oranges_dv.avi"
    Sleep(500)
    MouseClick ( "left", 100, 238, 1, 10);selects one scene
    Send("^a")
    Send("^c");selects and copies all scenes
    MouseClick ( "left", 210, 477, 1, 10)
    Send("^v");clicks on slide area and pastes scenes there
    Sleep(2000)
    MouseClick ( "left", 371, 67, 1, 10);opens 'Make Movie' tab
    Sleep(2000)
    MouseClick ("left", 160, 344, 1, 10);selects 'render'
    Send("Test.mpg")
    Send("{ENTER}")
    Sleep(700)
    If WinActive("Pinnacle Studio", "file already exists") then
    Send("!y");enters movie name, and prompts to overwrite if applicable
    EndIf
    $begin = timerInit();begins timer after file name selection
    WinWaitActive("Pinnacle Studio", "Create MPEG file...")
    $dif = TimerDiff($begin);ends timer after rendering period
    Send("!f")
    Send("nn")

    return $dif
endfunc

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

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...