Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Rebol/Windows Macro Maker - Autopilot.r

From: tbrownell::shaw::ca at: 31-Mar-2002 0:44

REBOL [ Title: "LFReD AutoPilot" Date: 31-Mar-2002 File: %autopilot.r Author: "Terry Brownell" Version: 1.0 Needs: ["Windows with Script Host, Rebol/Pro or /command"] Rights: "Copyright (C) Terry Brownell 2002" Note: { This script is free; you can redistribute it and/or modify it under the terms of the GNU General Public License. Instructions: 1. Create a folder and place this script inside. 2. Create a .txt file with your macro (sample below) and place inside the same folder. 3. "Do" this script, then call the function "AutoPilot" and the macro .txt file. There are four basic commands - Activate, Launch, Wait and Type. Activate - Focuses a running app. Launch - Launch a new app. Wait - Pause in milliseconds. (1000 = 1 second) Type - Enter keystrokes. } ] ;----------------AUTOMATE AutoPilot: func [inpu][Macro1: rejoin [to-file inpu ".txt"] AutoPilot: read macro1 AutoPilotCode: copy [] autopilot: parse autopilot none insert AutoPilotCode rejoin [{Set WshShell = WScript.CreateObject("WScript.Shell")} newline] AutoPilotA: {WshShell.AppActivate } AutoPilotR: {WshShell.Run } AutoPilotS: {WScript.Sleep } AutoPilotT: {WshShell.SendKeys } foreach [com att]autopilot [if com = "Activate" [append autopilotcode rejoin [AutoPilotA {"} att {"} newline ]] if com = "Launch" [append AutoPilotCode rejoin [AutoPilotR {"} att {"} newline]] if com = "Wait" [append AutoPilotCode rejoin [AutoPilotS att newline]] if com = "Type" [append AutoPilotCode rejoin [AutoPilotT {"} att {"} newline]]] write %autopilot.vbs AutoPilotCode call "autopilot.vbs" wait 3 delete %autopilot.vbs ] ;---------------------------- ;Below is a sample macro that will launch notepad, wait 3 seconds, type "Hello World, wait 1 second and type "Again"... place into a .txt file in the same folder, then run it as... Autopilot "myMacrofile.txt" ;Activate "Notepad" type "^n" Wait 3000 Type "Hello World" Wait 1000 Type " Again."