Command Reference - Action Examples
|
Actions used: |
In this example, we'll show how to use the "String - Parse Path" action to get different kinds of information from a string containing the full path to a file. We'll also demonstrate using a "Dialog - Message Box" action to inspect the values of a bunch of variables at run time (something that can often be helpful during testing).
Here's what the action list looks like:

First, for the purpose of this example, we'll assign a sample path string to a variable called %FullPath%.

Although the text wraps around in the above screenshot, the path was all entered together as one line:
C:\Program Files\Hella Cool Software\Super Duper Tools\Gizmo.exe
Next, we use a series of "String - Parse Path" actions to get the various parts of the path and store them in appropriately named variables. For example, we get the drive letter from the path and store it in a variable called %drive%...

...and we get the name of the last folder in the path (in this case, the name of the folder that Gizmo.exe is located in) and store it in a variable called %folder_name%.

Finally, we use a "Dialog - Message Box" action to reveal the contents of all these variables. This technique can be invaluable during testing, as it allows you to see what values are being assigned to your variables. Just remember to disable or delete the "Dialog - Message Box" action before you distribute your application if you don't want the user to see the message box.

By design, the "Dialog - Message Box" action returns the name of the button that the user clicked. This return value must be stored in a variable—in our example, we used the default variable name of %Result%. Since we're only using the message box as a way of "peeking" inside our variables during testing, we won't bother to check what value was assigned to %Result%. (Especially since we've set the message box up to have a single "Ok" button on it...it's not like the user's choice will be much of a surprise. :)
Incidentally, here's the full text of the message we used:
Drive: %drive%
Drive and folder: %drive_and_folder%
All folders: %all_folders%
Folder name: %folder_name%
Filename: %filename%
File extension: %extension%
Folder and filename: %folder_and_filename%
Note that you can easily type multiple lines of text in a dialog box, just by pressing Enter to start a new line.
Here's a link to the finished example, as an AutoPlay Media Studio 4.0 actions XML file that you can import into an action list:
(Note: save this file to your hard drive and use a tool like WinZip to extract the XML file)