Command Reference - Action Examples
|
Actions used: |
In this example, we'll get the text that the user typed into an Edit Field Object, replace all the spaces in that text with underscores, and then put the new "underscored" text into the Edit Field Object instead. (In other words, we'll replace all the spaces in an edit field with underscores.)
Here's what the action list looks like:

First, we check to see if the edit field is visible. (Technically speaking, this usually isn't necessary, but we needed an example that used an "Edit Field Object - Is Visible" action, so we'll pretend that the page has a "hide edit field" button on it, just for kicks.)
To spice things up a bit, we'll store this true/false visibility info in a variable named %EditFieldCanBeSeen%.

Next, we use a simple "Control Structure - IF" action to test the value that "Edit Field Object - Is Visible" returned.

All of the actions between this IF action and the END IF action at the end of our action list will only be performed if %EditFieldCanBeSeen% contains a true value.
Next, we use an "Edit Field Object - Get Text" action to get the text that the user entered into the Edit Field Object (which we so wonderfully named "EditField1"). We'll store this text in a variable named %original_text%.

Next we use the very, very powerful "String - Replace" action to replace all of the spaces in the original text (which we've just copied into %original_text%) with underscores. We'll store this modified text in a variable called %new_text%.

Note that although the Search for field looks empty, it actually contains a single space character (" ").
Finally, we use an "Edit Field Object - Set Text" action to replace the current contents of the edit field with the new, fully "underscorified" text.

Here's a link to the finished example, as an AutoPlay Media Studio 4.0 page that you can import into your own project: