Comet Scripting from Within Comet


[ Follow Ups ] [ Post Followup ] [ Signature.net Forum ]

Posted by Jon Sacks on July 02, 2007 at 11:19:06:

I came up with a simple but elegant way to run automated scripting within Comet using the /keyfile= startup paramenter, but instead of launching it from a short-cut you launch it from within Comet.

As a refresher /keyfile=[filename] at startup tells Comet to use the keystrokes from the text file as if the operator was typing them in.

First you must create a file extension that has an association with Comet (in newer versions of Comet this is .csk). In older versions the association would contain a DDE Open with a value of [Path to Comet.exe] /pn=[login name] /keyfile="%1".

Then using the following program you send in Common the script name and a program to run at the end of the launch. This will then spawn a new comet session and run the script file in that session (note you must have a configured session available).

If you want that session closed at the end of the script include in your script as the last command "DOS" and the session will close.


!S SLAUNCH.IBS
!O SLAUNCH
!L LPH,E
!R QMONITOR

LENGTH 128 & COMMON CommonMsg$
LENGTH 8 & LOCAL RunProg$
LENGTH 32 & LOCAL ScriptName$

!--------------------------------------------------------------------!
!Comet Script Launch (aka /keyfile=), Jon Sacks 2007 !
! !
!The program expects to be passed: !
! [Keyfile Name],[Program to run on exit] !
! !
!Update Line 43 with the Full Path of the directory that ontains !
!your scripts. !
!--------------------------------------------------------------------!

BANNER: FORMAT (CS);(ET)

BEGIN:
CLEARLOCAL
PRINT (0,BANNER)
PRINT (0) '[SLAUNCH 1.0] Comet Script Launch'

IF POS(',',CommonMsg$) > 0
RunProg$ = STRIP(SUB(CommonMsg$,POS(',',CommonMsg$)+1,8))
CommonMsg$ = SUB(CommonMsg$,1,POS(',',CommonMsg$)-1)
ENDIF

ScriptName$ = STRIP(CommonMsg$)
IF LEN(ScriptName$) = 0 GOTO GetScriptName
GOTO LaunchScript

GetScriptName:
PRINT (0) 'Script Name:'
INPUT (0) ScriptName$
IF ScriptName$ = '' GOTO EOJ
GOTO LaunchScript

LaunchScript:
ScriptName$ = '[Full Path to Comet Script]'+ScriptName$
PRINT (0) "LAUNCH JOB IS:";ScriptName$
PRINT (0) (LAUNCH=ScriptName$)
GOTO EOJ

EOJ:
IF RunProg$ EQ ""
RUN "QMONITOR"
ELSE
RUN RunProg$
ENDIF




Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

What is the name of the main Signature System's Product?

Comments:

Optional Link URL:
Link Title:
Optional Image URL:

You may attach up to 5 files to your followup (see below):






[ Follow Ups ] [ Post Followup ] [ Signature.net Forum ]