Sign in to follow this  
Followers 0
wol

Help with file open loop Please

5 posts in this topic

I'm trying to open one file at a time with sound recorder then do some work on it and save it as the same file name plus "temp"

So far all it does is open the same file three times

Can anyone see what is wrong...Thanks :D

; AutoIt Version: 3.1.0

; Author: wol <wol6@hotmail.com>

;

; Script Function:

; Template AutoIt script.

;

; ----------------------------------------------------------------------------

; Script Start - Add your code below here

$n=1

for $n=1 to 50 step 1

Run("C:\WINDOWS\system32\sndrec32.exe")

#region --- ScriptWriter generated code Start ---

Opt("WinWaitDelay",100)

Opt("WinTitleMatchMode",4)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

WinWait("Sound - Sound Recorder","Position:")

If Not WinActive("Sound - Sound Recorder","Position:") Then WinActivate("Sound - Sound Recorder","Position:")

WinWaitActive("Sound - Sound Recorder","Position:")

Send("{ALTDOWN}{ALTUP}{DOWN}{DOWN}{ENTER}")

WinWait("Open","Files of &type:")

If Not WinActive("Open","Files of &type:") Then WinActivate("Open","Files of &type:")

WinWaitActive("Open","Files of &type:")

sleep(2000)

#region --- ScriptWriter generated code Start ---

Opt("WinWaitDelay",100)

Opt("WinTitleMatchMode",4)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

WinWait("Open","Files of &type:")

If Not WinActive("Open","Files of &type:") Then WinActivate("Open","Files of &type:")

WinWaitActive("Open","Files of &type:")

Send("{SHIFTDOWN}{TAB}{SHIFTUP}")

Send("{DOWN},$n")

$n=$n+1

Send("{enter}")

next

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Maybe this will help you out.

This is the save part only.

Opt("WinTitleMatchMode", 4)

Global $n

For $n = 1 To 50 Step 1
    Run("C:\WINDOWS\system32\sndrec32.exe")
    WinWait("Sound - Sound Recorder", "Position:")
    If Not WinActive("Sound - Sound Recorder", "Position:") Then WinActivate("Sound - Sound Recorder", "Position:")
    WinWaitActive("Sound - Sound Recorder", "Position:")

    ControlSend('Sound - Sound Recorder' , '' , 203 , "!f{s}")

    WinWait("Save As", "")
    If Not WinActive("Save As", "") Then WinActivate("Save As", "")
    WinWaitActive("Save As", "")
    Sleep( 500 )
    ControlSetText( 'Save As' , '' , 1148 , ControlGetText( 'Save As' , '' , 1148 )&'_'&$n )
    $Title = ControlGetText( 'Save As' , '' , 1148 ) & '.wav - Sound Recorder'

    ControlClick( 'Save As' , '' , 'Button2' )
    WinWait( $Title , '' , 5 )
    WinKill( $Title )
    MsgBox( 0 , "Done" , 'File Number:'& $n , 3)
Next
Edited by rbhkamal

"When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix

Share this post


Link to post
Share on other sites

rbhkamal Thank you for your help...there is plenty for me to study I have been trying to do this for 3 or 4 days now...once again thank you

Share this post


Link to post
Share on other sites

rbhkamal Thank you for your help...there is plenty for me to study I have been trying to do this for 3 or 4 days now...once again thank you

No problem! :D

RK


"When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix

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