SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
1 VBScript many Jobs

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
1 VBScript many Jobs
Author Message
Martyn



Joined: 26 May 2004
Posts: 27

Post 1 VBScript many Jobs Reply with quote

I'm looking to build a VBS template that can be called/executed
externally or an interanal script from the scheduler. I have many scripts/jobs
that are run but the only change is the @job_name in each script.

Rather than make copies of a template with a new job name and make changes
to all jobs when i need to make a template change i want to make just the
changes to the template which is called/executed.

Example with jobname:
Job1
Job2

Job1 will call/execute a template VBS script as
Job1.
Job2 will call/execute a template VBS script as
Job2. etc.

Thu Jul 14, 2005 1:54 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7975

Post Re: 1 VBScript many Jobs Reply with quote

Consider the following options:

1. Create a job template using the Template Builder tool. You can then use the template to generate all other jobs. The pros of that method are that you write your script only once and put all common jobs settings into the template also only once. You can then create new jobs from that template by answering only a few questions. The cons are that every new job will get a copy of that script and if you need to change something you will need to change it in all places.

2. Save your script in an external file (any extension). In 24x7 jobs use @SCRIPT tag to refer to the file. A typical job script could look like
Dim my_job_name
my_job_name = "xyz"

@SCRIPT:c:\scripts\jobscript.vbs

Of course the referenced file must make use of the my_job_name variable.
The pros of that method are that you write your script only once and maintain it on one place. The cons are that the script is stored off-line and not secured. Anyone who has access to the directory can change it.

3. Create new user-defined statement in the Script Library. Script library currently supports JAL scripts only, but you can use VBScriptRun command from JAL to execute your VBScript. Every job will simple have a single line script like RunMyVBScript( "job parameter") where RunMyVBScript is the name of the user-defined statement and "job parameter" is the parameter you want to pass to the job. The pros of that method are that you write your script only once and maintain it on one place. It is stored on-line and secured. The cons are that the script is executed as bunch of text and writing a long VBScript in this form is not really convenient. You cannot also debug it using the built-in VBScript debugger. You are limited to MsgBox or logging as debugging methods.

Hope this helps.

: I'm looking to build a VBS template that can be called/executed
: externally or an interanal script from the scheduler. I have many
: scripts/jobs
: that are run but the only change is the @job_name in each script.

: Rather than make copies of a template with a new job name and make changes
: to all jobs when i need to make a template change i want to make just the
: changes to the template which is called/executed.

: Example with jobname: Job1
: Job2

: Job1 will call/execute a template VBS script as
: Job1.
: Job2 will call/execute a template VBS script as
: Job2. etc.

Thu Jul 14, 2005 2:16 pm View user's profile Send private message
Martyn



Joined: 26 May 2004
Posts: 27

Post Re: 1 VBScript many Jobs Reply with quote

For Option 2:

Would the job with @Script be a VBScript job calling the vbscript job?
If so does it have to have jalscript.execute(@script....?

: Consider the following options: 1. Create a job template using the Template
: Builder tool. You can then use the template to generate all other jobs.
: The pros of that method are that you write your script only once and put
: all common jobs settings into the template also only once. You can then
: create new jobs from that template by answering only a few questions. The
: cons are that every new job will get a copy of that script and if you need
: to change something you will need to change it in all places.

: 2. Save your script in an external file (any extension). In 24x7 jobs use
: @SCRIPT tag to refer to the file. A typical job script could look like
: Dim my_job_name
: my_job_name = "xyz"

: @SCRIPT:c:\scripts\jobscript.vbs

: Of course the referenced file must make use of the my_job_name variable.
: The pros of that method are that you write your script only once and maintain
: it on one place. The cons are that the script is stored off-line and not
: secured. Anyone who has access to the directory can change it.

: 3. Create new user-defined statement in the Script Library. Script library
: currently supports JAL scripts only, but you can use VBScriptRun command
: from JAL to execute your VBScript. Every job will simple have a single
: line script like RunMyVBScript( "job parameter") where
: RunMyVBScript is the name of the user-defined statement and "job
: parameter" is the parameter you want to pass to the job. The pros of
: that method are that you write your script only once and maintain it on
: one place. It is stored on-line and secured. The cons are that the script
: is executed as bunch of text and writing a long VBScript in this form is
: not really convenient. You cannot also debug it using the built-in
: VBScript debugger. You are limited to MsgBox or logging as debugging
: methods.

: Hope this helps.

Wed Jul 20, 2005 8:46 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7975

Post Re: 1 VBScript many Jobs Reply with quote

@SCRIPT is simply a file reference meaning "insert contents of the referenced file" right here as if it was pasted from the clipboard. That's it. If you use it to insert VBScript into VBScript you don't need anything else. Just make sure the resulting script syntax is correct.

: For Option 2: Would the job with @Script be a VBScript job calling the
: vbscript job?
: If so does it have to have jalscript.execute(@script....?

Wed Jul 20, 2005 9:46 pm View user's profile Send private message
Martyn



Joined: 26 May 2004
Posts: 27

Post Re: 1 VBScript many Jobs Reply with quote

I guess there is something I just don't get here.

For Example:
I have a small vbscript script in E:\temp\test.vbs. The script is
simply
Sub main2()

msgbox "Works"
End Sub

In scheduler i create a job on in the wizard Step 2 Script Language is VBS(not JAL).
In script i put
@SCRIPT:E:\TEMP\TEST.VBS
Sub Main()

call main2()
End Sub

This doesn't work. I get an error or scheduler stops responding.

: @SCRIPT is simply a file reference meaning "insert contents of the
: referenced file" right here as if it was pasted from the clipboard.
: That's it. If you use it to insert VBScript into VBScript you don't need
: anything else. Just make sure the resulting script syntax is correct.

Thu Aug 04, 2005 10:54 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7975

Post Re: 1 VBScript many Jobs Reply with quote

Try 3.4.26 pre-release version. You can get it here
http://www.softtreetech.com/24x7/fixes/3-4-26.zip

Unzip them to 24x7 home dir. Make a backup first, just in case...

: I guess there is something I just don't get here.

: For Example: I have a small vbscript script in E:\temp\test.vbs. The script
: is
: simply
: Sub main2()

: msgbox "Works"
: End Sub

: In scheduler i create a job on in the wizard Step 2 Script Language is
: VBS(not JAL).
: In script i put
: @SCRIPT:E:\TEMP\TEST.VBS
: Sub Main()

: call main2()
: End Sub

: This doesn't work. I get an error or scheduler stops responding.

Thu Aug 04, 2005 11:32 pm View user's profile Send private message
Martyn



Joined: 26 May 2004
Posts: 27

Post Re: 1 VBScript many Jobs Reply with quote

Thanks. This did it. Works great.

: Try 3.4.26 pre-release version. You can get it here
: http://www.softtreetech.com/24x7/fixes/3-4-26.zip

: Unzip them to 24x7 home dir. Make a backup first, just in case...

Fri Aug 05, 2005 8:52 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.