How do I... ?
AnswerList of Questions
Determine the Drive Letter of the Primary Hard Drive
To determine the user's main hard drive in AutoPlay Media Studio, use the Drive.Enumerate action, and take note of the first fixed drive (this is the main hard drive):
-- Get a list of all drives in the user's system drives = Drive.Enumerate();
-- Step through the returned list for j in pairs(drives) do
-- Get the type of the drive
type = Drive.GetType(drives[j]);
end
-- Check if the type of drive is fixed if type == 3 then
-- It is fixed, note the drive letter and break out of the loop first_hdd = drives[j];
break; end
-- Output result to the user
Dialog.Message("", "The user's main HDD is "..first_hdd);
How do I... ?
AnswerList of Questions
Determine the Operating System (OS) Language
In AutoPlay Media Studio, to determine what language the user's OS is set to and store it in a variable user_language:
1. Insert the following code into an event in your application:
user_language = System.GetDefaultLangID;
Note: user_language is a table, and can be referenced by calling user_language.Primary
and user_language.Secondary
How do I... ?
AnswerList of Questions
Determine When a Video has Finished Playing
In AutoPlay Media Studio, it is possible to perform an action once your video has completed playing. Some uses for this include sending the user to your website after the video is finished, or loading up another video.
1. To launch your website when a video finishes playing, place the following script in the On Finish event of the video object:
File.OpenURL("http://www.indigorose.com/", SW_SHOWNORMAL);
How do I... ?
AnswerList of Questions
Display a Save As Dialog
A Save As dialog is often presented to allow a user to select a location to save a file to. To display a Save As dialog using AutoPlay Media Studio:
1. Create a Dialog.FileBrowse action. Set the FileOpen property to false:
file=Dialog.FileBrowse(false, "Save As", "c:\\", "All Files (*.*)|*.*|", "", "", false, true);
Note: File is a table. In the above example, multiple file select is not allowed. To access the path returned by the FileBrowse action, use file[1] as a variable. This gets the value from the first position of the table.
2. If you are using the Save As dialog to copy a file from your cd to the user's system, you must use a File.Copy command after the Save As dialog has been displayed:
File.Copy("c:\\example.exe", file[1], false, false, false, false, nil);
How do I... ?
AnswerList of Questions
Display Text and/or Images with MouseOver Events
Most objects in AutoPlay Media Studio have two events useful for mouseover effects: On Enter and On Leave.
As an example, we will create a button that on mouseover will display an image, and on mouseout will hide the image:
1. Create an image object
2. Set its default visible state to false.
3. Create a button object.
4. In the On Enter event of the button, enter the following script:
Image.SetVisible("Image1", true);
4. In the On Leave event of the button, enter the following script:
Image.SetVisible("Image1", false);
Note: When the user's mouse is over the button, the image object will appear. When the user's mouse leaves the button, the Image Object will disappear.
Tip: To make text appear on a mouseover, follow the above steps, but with a paragraph object instead of an Image Object.