Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a way to write and run a script that will enable me to:

  1. Run an app with a username/password
  2. Have that script carry out a few simple shortcut commands (ie connecting to and receiving from a database)
  3. Then shut the program down;
  4. Repeat for 10 other apps with the same set of shortcut commands in sequence?

I spend about 20 mins doing this manually. I open up application "A", log in, execute a few simple shortcut commands or click on file>connect>ok; which entails connecting to and receiving from a separate database, then log off and do the same with with application "B". I have to do this for 10 separate applications.

share|improve this question
    
assuming windows operating system? –  James Jul 12 '12 at 20:56
    

4 Answers 4

Look into using CMD/BAT files, and using the START /w command (starts a program, waits for it to exit), then finally running it with RUNAS to run as a separate user. Another alternative, as posted by your tag, is to use VBS scripting.

share|improve this answer

I'd take a look at auto-hotkey for this. Have used it extensively in the past for interacting with applications which, for one reason or another, did not allow direct manipulation with scripts.

Once the script has been written you could convert to an .exe and run it as a scheduled task or on startup etc.

share|improve this answer

I use AutoIt for these types of things.

From the site:

AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks in a way not possible or reliable with other languages (e.g. VBScript and SendKeys). AutoIt is also very small, self-contained and will run on all versions of Windows out-of-the-box with no annoying “runtimes” required!

AutoIt was initially designed for PC “roll out” situations to reliably automate and configure thousands of PCs. Over time it has become a powerful language that supports complex expressions, user functions, loops and everything else that veteran scripters would expect.

Features:

Easy to learn BASIC-like syntax
Simulate keystrokes and mouse movements
Manipulate windows and processes
Interact with all standard windows controls
Scripts can be compiled into standalone executables
Create Graphical User Interfaces (GUIs)
COM support
Regular expressions
Directly call external DLL and Windows API functions
Scriptable RunAs functions
Detailed helpfile and large community-based support forums
Compatible with Windows 2000 / XP / 2003 / Vista / 2008 / Windows 7 / 2008 R2
Unicode and x64 support
Digitally signed for peace of mind
Works with Windows Vista’s User Account Control (UAC)
share|improve this answer

Assumptions:

There are multiple ways to accomplish automation. From the vbscript tag I assume you're running windows, so you must be either using putty/kitty or SecureCRT (please add OS/Application in question if other).

Terminal solution:

Each of the above has a scripting engine that enables you to run any commands on remote systems and retrieve the output. For help on these see for example SecureCRT FAQ on the subject.

Generalization:

For a more general solution (if your applications are more diverse), you can use a simple automation engine that can "click", "type" and "receive output" for you. One such engine (which I personally had great success with) is AutoIt - see this quick tutorial for script example and guide.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.