Command Reference - Action Examples
|
Actions used: |
In this example, we'll update a readme.txt file so it includes the current date and time.
Here's what the action list looks like:

First, we use a "Text File - Find Line" action to find a line with the text "Installed on" on it. Including this text in our readme.txt file gives our actions something to use as a target; that way, even if we later change our readme.txt file so the "Installed on" text appears somewhere else, the actions will still work.

If a match is found (and we've prepared the readme.txt file so there will be), the line number with our target text will be stored in a variable called %LineNumber%.
Next, we use a "Text File - Delete Line" action to delete that line, since we want to replace it with a new one.

Next, we use a "System - Get Date Time" action to get the current date and store it in %CurrentDate%...

...and another "System - Get Date Time" action to get the current time and store it in %CurrentTime%.

Finally, we use a "Text File - Insert Line" action to insert a new line into the readme.txt file, at the same place where the old line was (whose line number was stored in the variable %LineNumber%). Note that we usd our %CurrentDate% and %CurrentTime% variables right in the text that gets inserted.

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