Jump to content

Can we do this with autoIt ?


Tukata
 Share

Recommended Posts

Hi,

Being new to AutoIt and to this forum I wonder if we can make the following things with AutoIt.

1). Record a sound using mic and save it.

2). Record a sound while it is played by another application and save it.

Thank you

Tukata

Keep in mind that AutoIT is a scripting language, not a full operating system environment. AutoIT scripts the things you can do in Windows. If you can do it in Windows, natively or with another application, then you can script the doing of it. But the script will still call the native Windows function or application. The application Windows 2000 provides for recording is sndrec32.exe. AutoIT won't replace sndrec32.exe, but it can script the use of it.

You can certainly write an AutoIT script to automate using the sndrec32.exe tool.

:o

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Thanks a lot guys.

I found "Media.au3" and I hope to understand how to do it.

About using "sndrec32.exe", how do I automate it (Record, Pause, Stop, Play) and can I hide its window and how I record more than one minute ?

Thak you

Tuk

Edited by Tukata
Link to comment
Share on other sites

Thanks, I found it. There is one problem with "Media_Example_RecordSound.au3" it does not save the file if the path selected (in the Save Dialog) has spaces. What should I change in the script ?

Thank you

Tuk

Edited by Tukata
Link to comment
Share on other sites

look at FileGetShortName in the helpfile, that should be what ur lookin for

AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
Link to comment
Share on other sites

CDkid

I tried this but didn't work:

$File=FileSaveDialog("","","Wave files (*.wav)")&".wav"
$File = FileGetShortName($File)

Where is my mistake ?

(As a temporary solution I save the file to "Temp" and copy to $File.)

Thank you

Tuk

Link to comment
Share on other sites

herewasplato,

Sorry I can't make it work.

I replaced in "Media_Example_RecordSound.au3" this line:

$File=FileSaveDialog("","","Wave files (*.wav)")&".wav"

with this:

$File = FileGetShortName(FileSaveDialog("","","Wave files (*.wav)"))

Am I doing wrong again ?

Thank you

Tuk

Edited by Tukata
Link to comment
Share on other sites

  • Moderators

Why don't you show everything you have, that way some one might be able to piece it together for you.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Good idea.

I took the original "Media_Example_RecordSound.au3" and made small changes:

1). First save to TEMP (no spaces in path) and then copy to the path with spaces selected by "SaveDialog".

2). I add also a SLEEP because otherwise it does not record all.

3). I add delete file from TEMP.

This code works perfect:

#include <Media.au3>
HotKeySet("{ESC}","StopRecording")
$Stop=1
Func StopRecording()
    $Stop=0
EndFunc
$Media=_MediaCreate(6)
_MediaRecord($Media)
While $Stop
WEnd
_MediaStop($Media)
$File=FileSaveDialog("","","Wave files (*.wav)")&".wav"
If @error Then
    _MediaClose($Media)
    Exit
EndIf

_MediaSave($Media,"C:\Temp\Temp.wav")
_MediaClose($Media)

Sleep(1500)
FileCopy("C:\Temp\Temp.wav", $File)
Sleep(500)
FileDelete ("C:\Temp\Temp.wav")

What I want to do is overcome the problem of spaces in path selected by "SaveDialog" without the need to save to TEMP and copy.

Another thing I still want to do is using this script (or another) to copy a sound played by another application (not a sound file but a sound embedded in exe like slideshow).

BTW, what does this mean in "Media.au3" ?

; 0 = CD Audio

; 1 = Digital video

; 2 = Overlay

; 3 = sequencer

; 4 = Vcr

; 5 = Video disc

; 6 = Wave Audio

Thank you all for your help

Tuk

Edited by Tukata
Link to comment
Share on other sites

Sorry about that rather short post. I was attempting to point out that you might not want the &".wav" part of that line of code. Now that I see more of your code, I see why you added it. I don't know of a solution for you right now... I'll leave it to others in the forum.

...hope that I did not waste too much of your time...

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

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