Home > Creating a Script > Adding Functionality to Existing Scripts

Adding Functionality to Existing Scripts

Automation scripts require general maintenance and updating, as does all software. A script may need to be updated in response to a new release of the target application or changes to the target web page. You may need to take advantage of new features in the application. Or you may be trying to debug a new script that fails to execute to completion.

Recording mode can be used to quickly generate only the required changes instead re-recording the entire process from beginning to end. The following steps illustrate how you can add functionality to an existing script.

  1. Start WinTask x64. If the "Your First Script Wizard" dialog box is displayed, click the Close button. The WinTask x64 Editor window should now be active.
  2. Open the script to be modified in the WinTask x64 Editor.
  3. Manually type in the Stop statement at the location where the new functionality is to be added. If debugging a script, you may want to place the Stop either before or after the statement that fails during playback. Generally, if the failing statement provides synchronization (UseWindow, UsePage), place the Stop before the statement. If the statement performs an action (SendKeys, ClickHTMLElement), place the Stop after the statement.
  4. From the WinTask x64 toolbar, click the Play button  . You are prompted to save the script. The Compiler is launched, and if no compilation errors are detected, your script starts running.
  5. The script will continue to execute until the Stop statement is reached. The script terminates and leaves the target application or web page in the correct state to start recording the required changes.
  6. Return to the WinTask x64 Editor. Insert a blank line above the Stop statement inserted by Step 3. Leave the insertion cursor at the beginning of the line.
  7. From the WinTask x64 toolbar, click the Rec button   to start recording your actions.
  8. The "Start Recording Mode" dialog box will appear asking "What do you want to start before recording?". Select the Nothing radio button and click the OK button.
  9. Restore focus to the target application. Manually execute the new process or corrections to be inserted into the script. Use the Spy Tool to help identify internal window names or HTML Elements.
  10. Stop Recording Mode by clicking the Stop button  on the floating WinTask x64 toolbar. The Stop button is the first button on the left side of the toolbar with the "X and rectangle" icon.
  11. The generated script statements are inserted into the existing script above the Stop statement. Review the new statements and remove any unneeded actions or actions that were made in error. Comment out the Stop statement for now.
  12. From the WinTask x64 toolbar, click the Play button. The script is saved and re-compiled and starts running.
  13. If the new functionality was added correctly, the script should run to completion performing all of its original tasks plus the new task(s).
  14. If the script still has problems, determine if any of the new script statements fail and need correction. Uncomment and reposition the Stop statement as needed. Repeat Steps 4 through 13 until the script performs all of its required tasks correctly.
  15. Once the script is fully functional, delete the Stop statement and re-compile the script. The script is now ready for production!

See also

Using Script Wizard
Using Editor
More Recording Features