SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Run a JAL script from within a VBS loop.

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Run a JAL script from within a VBS loop.
Author Message
Jim Malone



Joined: 23 Oct 2000
Posts: 23

Post Run a JAL script from within a VBS loop. Reply with quote

Step 1:
I am using VBS to look for the letters 'BOL'
in the subject line of Outlook, then reading the
following six numbers and deleting the inbox message.
These numbers are then written to an Excel file for
process mgmt.

Step 2a:
The VBS, in a loop, then goes down the Excel list
looking at the status of a the BOL numbers for
'Ready'. Once found, it grabs the BOL number and
proceeds to Step 3.

Step 2b:
Takes the new status from Step 3 and updates the Excel
spreadsheet then proceeds down the list for the next
'Ready' Bol number. If found calls Step 3 again, if
not Exits script.

Step 3:
Executes a very involved JAL script using the BOL
number and will returns one of the four status
values back to the Excel spreadsheet. Goto Step 2b.

EXCEL SPREADSHEET: (sample)
BOL Status(Ready,AutoPocessed,Manual,Error)
000123 Auto
000124 Ready
000125 Auto
000126 Manual
000128 Error
000127 Ready
000129 Ready

Can I run the JAL script from within a loop of a VBS?
Note: The JAL script is approx. 300 lines.

Thanks,
Jim

Tue May 20, 2003 4:25 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6500

Post Re: Run a JAL script from within a VBS loop. Reply with quote

Yes, you can run 300 lines in-line script if the total size of the script does not exceed 32K. It might be easier from a coding prospective to place that script into a separate job which can be triggered from your VBS. If you need to pass some parameters in VBS you can save them in INI files, Registry, database or some place else then read them from JAL job.

Now, here is a more elegant solution. Create a new function in the Script Library. The function may have parameters if needed.
In your VBS job use JALScript.Execute("MyFunction(Parm1, Parm2)") which is just one line of code. The actual command is just a piece of text which can be "built" dynamically as
"MyFunction(" & Parm1 & "," & Parm2 & ")"

Hope this will help.

: Step 1: I am using VBS to look for the letters 'BOL'
: in the subject line of Outlook, then reading the
: following six numbers and deleting the inbox message.
: These numbers are then written to an Excel file for
: process mgmt.

: Step 2a: The VBS, in a loop, then goes down the Excel list
: looking at the status of a the BOL numbers for
: 'Ready'. Once found, it grabs the BOL number and
: proceeds to Step 3.

: Step 2b: Takes the new status from Step 3 and updates the Excel
: spreadsheet then proceeds down the list for the next
: 'Ready' Bol number. If found calls Step 3 again, if
: not Exits script.

: Step 3: Executes a very involved JAL script using the BOL
: number and will returns one of the four status
: values back to the Excel spreadsheet. Goto Step 2b.

: EXCEL SPREADSHEET: (sample)
: BOL Status(Ready,AutoPocessed,Manual,Error)
: 000123 Auto
: 000124 Ready
: 000125 Auto
: 000126 Manual
: 000128 Error
: 000127 Ready
: 000129 Ready

: Can I run the JAL script from within a loop of a VBS?
: Note: The JAL script is approx. 300 lines.

: Thanks,
: Jim

Tue May 20, 2003 5:09 pm View user's profile Send private message
Jim Malone



Joined: 23 Oct 2000
Posts: 23

Post Re: Run a JAL script from within a VBS loop. Reply with quote

Steps 1 and 2 are in Job 'A' and Step 3 is a separate Job 'B', can you give me
an example of how to trigger the Job 'B' from the Job 'A'? Also will
Job 'A' be on hold until Job 'B' is complete?

- I have it covered on passing the BOL number from one job to the other.

In regards to your elegant solution, do you have a simple example of this?
Still trying to build-up my skills.

Thanks,
Jim

: Yes, you can run 300 lines in-line script if the total size of the script
: does not exceed 32K. It might be easier from a coding prospective to place
: that script into a separate job which can be triggered from your VBS. If
: you need to pass some parameters in VBS you can save them in INI files,
: Registry, database or some place else then read them from JAL job.

: Now, here is a more elegant solution. Create a new function in the Script
: Library. The function may have parameters if needed.
: In your VBS job use JALScript.Execute("MyFunction(Parm1, Parm2)")
: which is just one line of code. The actual command is just a piece of text
: which can be "built" dynamically as
: "MyFunction(" & Parm1 & "," & Parm2 &
: ")"

: Hope this will help.

Tue May 20, 2003 5:43 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6500

Post Re: Run a JAL script from within a VBS loop. Reply with quote

If you want job A to wait for job B to complete use either

JALScript.Execute("JobRun [job id]")

or

Set shell = CreateObject("WScript.Shell")
shell.Run "24x7.exe /JOB [job id]", 0, 1

If you do not want job A to wait then simply do

Set shell = CreateObject("WScript.Shell")
shell.Run "24x7.exe /JOB [job id]", 0, 0

: Steps 1 and 2 are in Job 'A' and Step 3 is a separate Job 'B', can you give
: me
: an example of how to trigger the Job 'B' from the Job 'A'? Also will
: Job 'A' be on hold until Job 'B' is complete?

: - I have it covered on passing the BOL number from one job to the other.

: In regards to your elegant solution, do you have a simple example of this?
: Still trying to build-up my skills.

: Thanks,
: Jim

Wed May 21, 2003 12:00 am View user's profile Send private message
Jim



Joined: 15 May 2001
Posts: 5

Post Re: Run a JAL script from within a VBS loop. Reply with quote

Job A does not wait for Job B to complete:

Job A (VBS):
Sub Main
JALScript.Execute "JobRun ""215"""
Msgbox "hello",64, "header"
End Sub

Job B (JAL):
dim bol_number, string
dim File_Handle, number
FileReadLine( "D:\\24x7\\BCCTemp.txt", 1, BOL_Number )
Wait( 1 )
messagebox( BOL_Number )
FileOpen( "D:\24x7\BCCTemp.txt", "LineMode", "Write", False, File_Handle)
FileWrite( File_Handle, "test" )
FileClose( File_Handle )
FileReadLine( "D:\\24x7\\BCCTemp.txt", 1, BOL_Number )
Wait( 1 )
messagebox( BOL_Number )

: If you want job A to wait for job B to complete use either

: JALScript.Execute("JobRun [job id]")

: or

: Set shell = CreateObject("WScript.Shell")
: shell.Run "24x7.exe /JOB [job id]", 0, 1

: If you do not want job A to wait then simply do

: Set shell = CreateObject("WScript.Shell")
: shell.Run "24x7.exe /JOB [job id]", 0, 0

Wed Jun 18, 2003 10:20 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.