STR SRV Job
STR SRV Job
LANGUAGE=VBSCRIPT
DESCRIPTION=Get Job Details from Work with Job screen and service it
[PCOMM SCRIPT SOURCE]
OPTION EXPLICIT
autECLSession.SetConnectionByName(ThisSessionName)
REM This line calls the macro subroutine
Call Main
sub Main()
'---------------------------------------------------------------------------------------------------------------'Declare Global Objects
'---------------------------------------------------------------------------------------------------------------'Presentation Space
Dim PS
Set PS = autECLSession.autECLPS
'Operator Information Area (OIA)
Dim OIA
Set OIA = autECLSession.autECLOIA
'Field List
Dim FieldList
Set FieldList = PS.autECLFieldList
'---------------------------------------------------------------------------------------------------------------' Do your thing here
'---------------------------------------------------------------------------------------------------------------FieldList.Refresh()
'Ensure we are in Work with Job screen.
If trim(FieldList(2).GetText) <> "Work with Job" Then
MsgBox "Applicable only in WorkJob screen. Exiti
ng..."
Exit Sub
End If
'Get Job Details
Dim JobName
Dim JobUser
Dim JobNumber
Dim CurRow
Dim CurCol
CurRow = PS.CursorPosRow
CurCol = PS.CursorPosCol
JobName = trim(FieldList(14).GetText)
JobUser = trim(FieldList(18).GetText)
JobNumber = trim(FieldList(22).GetText)
'---------------------------------------------------------------------------------------------------------------' Construct StrSrvJob Command
'---------------------------------------------------------------------------------------------------------------Dim txtCommand
Dim inpCommand
Dim Command
Set txtCommand = FieldList.FindFieldByText("===> ",1,1,1
)
If Not (txtCommand is Nothing) Then
'Service Job
Command = "StrSrvJob Job(" & JobNumber & "/" & JobUser & "/" &
JobName & ")"
'Command = InputBox("","",trim(Command))
'PS.SendKeys "[enter]"
'Wait(OIA)
End If
'---------------------------------------------------------------------------------------------------------------' Issue command
'---------------------------------------------------------------------------------------------------------------FieldList.Refresh()
Dim CommandLine
Set CommandLine = FieldList.FindFieldByText("===> ",1,1,
1)
If Not (CommandLine Is Nothing) Then
Set CommandLine = FieldList.FindFieldByRowCol (C
ommandLine.EndRow,CommandLine.EndCol +2)
CommandLine.SetText(Command)
PS.Wait(1000)
Else
MsgBox "No Command Line found."
Exit Sub
End If
'---------------------------------------------------------------------------------------------------------------'Cleanup Global Objects
'---------------------------------------------------------------------------------------------------------------Set PS = Nothing
Set OIA = Nothing
Set FieldList = Nothing
Set txtCommand = Nothing
end sub
Sub Wait(OIA)
OIA.WaitforAppAvailable
OIA.WaitForInputReady
End Sub