Jump to content
Sign in to follow this  
Kiti

Include .wav in compiled script

Recommended Posts

Kiti

Ok, so I right-click my .au3 file, and I click "Compile with options". I go on the "res add files", but I don't really get the format. It says "Filename[section[ResName]]", but what's "Section" and what's "ResName" ? And what should I put at path in my script when I want to play that sound (I don't want to extract it) ?

Some concrete examples, please!muttley

Share this post


Link to post
Share on other sites
pete1234

Something like this should do the trick

$SoundFile = @TempDir & "\Sound.wav"
FileInstall("Sound.wav", $SoundFile)
SoundPlay($SoundFile)
Edited by pete1234

Share this post


Link to post
Share on other sites
Kiti
pete1234

FileInstall does it for you.

FileInstall

--------------------------------------------------------------------------------

Include and install a file with the compiled script.

FileInstall ( "source", "dest" [, flag] )

Parameters

source The source path of the file to compile. This must be a literal string; it cannot be a variable.

dest The destination path of the file with trailing backslash if only the directory is used. This can be a variable.

flag [optional] this flag determines whether to overwrite files if they already exist:

0 = (default) do not overwrite existing files

1 = overwrite existing files

Return Value

Success: Returns 1.

Failure: Returns 0.

Remarks

The FileInstall function is designed to include files into a compiled AutoIt script. These included files can then be "extracted" during execution of the compiled script if the statement is executed. Keep in mind that files such as images can greatly increase the size of a compiled script.

The source file must be a string and not a variable so that the compiler can extract the filename to include. The source cannot contain wildcards.

When this function is used from a non-compiled script, a copy operation is performed instead (to allow for easy testing pre-compilation).

Files maintain their original creation/modification timestamps when installed.

Share this post


Link to post
Share on other sites
Kiti

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.