Command Reference - Action Examples
|
Actions used: |
In this example, we'll show you how to verify a password (typed into an Edit Field Object by the user) against a list of passwords stored in a Global List.
Here's what the action list looks like:

First, we use an "Edit Field Object - Get Text" action to get the text that the user typed into the Edit Field Object (which we named "Password Field").

This will store the whatever the user typed in a variable called %password%.
Next, we use a "Global List - Find" action to search through our Global List (which we named "Passwords") for an item that matches the text that the user typed. (We set up this Global List in advance, with a single password in it just for this example.)

If a matching item is found in our list of passwords, the "Global List - Find" action will return the index of the matching item. If no matching item is found, the action will return "-1" instead.
All we need to do to find out if the user entered a valid password is to compare the index with "-1". If it's -1, their password didn't match any of the ones in our list, and it isn't a valid password.
So, we start an IF block with a simple "Control Structure - IF" action that compares the value stored in %index% (by the "Global List - Find" action) with "-1".

If this expression is true—if %index% is indeed equal to -1—then the user entered an invalid password.
You could put all sorts of actions in this IF block, to do anything from jumping to another page (with a video sales presentation enticing the user to purchase a password), to logging the user's information in an online database with an "Internet - Submit to Web" action.
For this example, we just use a "Dialog - Message Box" action to tell the user that their password failed:

...and then we use an "Application - Exit" action to exit from the AutoPlay application.
That's it for our "password failed" test...so we end the IF block with a "Control Structure - END IF" action.
The rest of the action list will only be performed if the password was valid (since our "Application - Exit" action would immediately close the program if it wasn't). For this example, we'll just use a "Dialog - Message Box" action to tell the user that their password was a good one.

Here's a link to the finished example, as an AutoPlay Media Studio 4.0 project:
(See if you can figure out what the password is :)