Sunteți pe pagina 1din 3

[PCOMM SCRIPT HEADER]

LANGUAGE=VBSCRIPT
DESCRIPTION=Collapse a Subroutine
[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
'-----------------------------------------------------------------------
------------------------------------------
' Get Subroutine Name
'-----------------------------------------------------------------------
------------------------------------------
Dim CommandString
CommandString = InputBox("Enter subroutine to collapse", "Subrout
ine name","")
If CommandString = "" Then
MsgBox "No subroutine entered. Exiting."
Exit Sub
End If
'-----------------------------------------------------------------------
------------------------------------------
' Find Command Input Field
'-----------------------------------------------------------------------
------------------------------------------
Dim inpCommand
Dim InputFieldFound
Call FindCommandField (FieldList, inpCommand, InputFieldFound)
If Not InputFieldFound Then
Exit Sub
End If
'-----------------------------------------------------------------------
------------------------------------------
' Find Start of Subroutine
'-----------------------------------------------------------------------
------------------------------------------
CommandString = "Find " + Trim(CommandString) + " 18 "
PS.SetCursorPos inpCommand.StartRow,inpCommand.StartCol
PS.SendKeys "Top [enter]"
Wait(OIA)
inpCommand.SetText CommandString
Wait(OIA)
PS.SendKeys "[enter]"
Wait(OIA)
'-----------------------------------------------------------------------
------------------------------------------
' Pull Subroutine start to top of page
'-----------------------------------------------------------------------
------------------------------------------
'PS.SendKeys "[PageDn]"
'Wait(OIA)
PS.SendKeys "[Tab]"
Wait(OIA)
PS.SendKeys "XX[PF10]"
Wait(OIA)
PS.SendKeys "Find ENDSR[enter]"
Wait(OIA)
'-----------------------------------------------------------------------
------------------------------------------
' Pull Subroutine end to bottom of page
'-----------------------------------------------------------------------
------------------------------------------
'PS.SendKeys "[PageUp]"
'Wait(OIA)
PS.SetCursorPos PS.CursorPosRow-1,1
Wait(OIA)
PS.SendKeys "XX"
PS.SendKeys "[enter]"
'-----------------------------------------------------------------------
------------------------------------------
'Cleanup Global Objects
'-----------------------------------------------------------------------
------------------------------------------
Set PS = Nothing
Set OIA = Nothing
end sub
'************************
Sub FindCommandField (ByRef FieldList, inpCommand, InputFieldFoun
d)
InputFieldFound = true
FieldList.Refresh()
Dim txtCommand 'Text for input field
Set txtCommand = FieldList.FindFieldByText("SEU==> ",1,1,
1)
If Not (txtCommand is Nothing) Then
Set inpCommand = FieldList.FindFieldByRowCol(txtCo
mmand.EndRow,txtCommand.EndCol + 2 )
Else
InputFieldFound = false
MsgBox "Input Field for SEU commands not found. Exit
ing."
End If
End Sub
'************************

Sub Wait(OIA)
OIA.WaitforAppAvailable
OIA.WaitForInputReady
End Sub


S-ar putea să vă placă și