Skip to main content

Hello all.

I'm trying to print (to the default printer) a screenshot of RUMBA 8.1 through the script editor but am running into an issue. The code is as follows:

 

Sub Main

Dim SYMBOL as string
Dim CUSIP as string
Dim SYM as string
Dim APrintear as string

Set XLApp = CreateObject("Excel.Application") ' Create an EXCEL application
XLApp.Workbooks.Open Filename:="C:\\Users\\a267482\\Desktop\\BHIS-GET CUSIP FROM SYMBOL.xlsx"
XLApp.Visible = True
Set MYBook = XLApp.Workbooks("BHIS-GET CUSIP FROM SYMBOL.xlsx")
Set XLSheet = MYBook.Worksheets("Sheet1")

EMSetCursor 1,19
EMSendKey "BSECFIND"

for x=1 to 1

SYMBOL=XLSheet.cells(x,1).value
EMSetCursor 2,25
EMSendKey "<DELETE>" 
EMSendKey SYMBOL
EMSendKey "<ENTER>" 

EMReadScreen SYM, 13, 7,9

If trim(SYM)=SYMBOL then
EMReadScreen CUSIP, 9, 6,9
XLSheet.cells(x,2).value="'"&CUSIP
else
XLSheet.cells(x,2).value="Cusip not found"
End if

EMSetCursor 2,25

Next x

End Sub


#Rumba

Hello all.

I'm trying to print (to the default printer) a screenshot of RUMBA 8.1 through the script editor but am running into an issue. The code is as follows:

 

Sub Main

Dim SYMBOL as string
Dim CUSIP as string
Dim SYM as string
Dim APrintear as string

Set XLApp = CreateObject("Excel.Application") ' Create an EXCEL application
XLApp.Workbooks.Open Filename:="C:\\Users\\a267482\\Desktop\\BHIS-GET CUSIP FROM SYMBOL.xlsx"
XLApp.Visible = True
Set MYBook = XLApp.Workbooks("BHIS-GET CUSIP FROM SYMBOL.xlsx")
Set XLSheet = MYBook.Worksheets("Sheet1")

EMSetCursor 1,19
EMSendKey "BSECFIND"

for x=1 to 1

SYMBOL=XLSheet.cells(x,1).value
EMSetCursor 2,25
EMSendKey "<DELETE>" 
EMSendKey SYMBOL
EMSendKey "<ENTER>" 

EMReadScreen SYM, 13, 7,9

If trim(SYM)=SYMBOL then
EMReadScreen CUSIP, 9, 6,9
XLSheet.cells(x,2).value="'"&CUSIP
else
XLSheet.cells(x,2).value="Cusip not found"
End if

EMSetCursor 2,25

Next x

End Sub


#Rumba

Hi ,

to print the content of a Rumba Session to a default printer can be solved differently.
The easiest way is to send CTRL P  = SendKeys("^P").
But this is not a screenshot (image) as you described in your question.
To handle text in the clipbord is not a problem but you want to do screenshot and this can be tricky.
I suggest to use an intermediate application to get the image and to print.
See below a working code snippet with MS Word. (don't worry Word is invisible)

The snippet takes a screentshot and send it to the Default Printer.

Hope it helps


Sub Main

   Dim objWD As Object
  
   SendKeys "%{PRTSC}"     'Take Screenshot

   Set objWD = CreateObject("Word.Application")
   objWD.Visible = False
   objWD.Documents.Add
   objWD.Selection.Paste
   objWD.Selection.TypeText "This is some text."
   objWD.ActiveDocument.Saved = True

   objWD.PrintOut

 
   objWD.Quit
  
   Set objWD = Nothing
End Sub


Hello all.

I'm trying to print (to the default printer) a screenshot of RUMBA 8.1 through the script editor but am running into an issue. The code is as follows:

 

Sub Main

Dim SYMBOL as string
Dim CUSIP as string
Dim SYM as string
Dim APrintear as string

Set XLApp = CreateObject("Excel.Application") ' Create an EXCEL application
XLApp.Workbooks.Open Filename:="C:\\Users\\a267482\\Desktop\\BHIS-GET CUSIP FROM SYMBOL.xlsx"
XLApp.Visible = True
Set MYBook = XLApp.Workbooks("BHIS-GET CUSIP FROM SYMBOL.xlsx")
Set XLSheet = MYBook.Worksheets("Sheet1")

EMSetCursor 1,19
EMSendKey "BSECFIND"

for x=1 to 1

SYMBOL=XLSheet.cells(x,1).value
EMSetCursor 2,25
EMSendKey "<DELETE>" 
EMSendKey SYMBOL
EMSendKey "<ENTER>" 

EMReadScreen SYM, 13, 7,9

If trim(SYM)=SYMBOL then
EMReadScreen CUSIP, 9, 6,9
XLSheet.cells(x,2).value="'"&CUSIP
else
XLSheet.cells(x,2).value="Cusip not found"
End if

EMSetCursor 2,25

Next x

End Sub


#Rumba

Thanks Andre.

The suggestions did not work.  SendKeys("^P") passes "^P" as if it were a string, and the objWD solution does not print anything at all.


Hello all.

I'm trying to print (to the default printer) a screenshot of RUMBA 8.1 through the script editor but am running into an issue. The code is as follows:

 

Sub Main

Dim SYMBOL as string
Dim CUSIP as string
Dim SYM as string
Dim APrintear as string

Set XLApp = CreateObject("Excel.Application") ' Create an EXCEL application
XLApp.Workbooks.Open Filename:="C:\\Users\\a267482\\Desktop\\BHIS-GET CUSIP FROM SYMBOL.xlsx"
XLApp.Visible = True
Set MYBook = XLApp.Workbooks("BHIS-GET CUSIP FROM SYMBOL.xlsx")
Set XLSheet = MYBook.Worksheets("Sheet1")

EMSetCursor 1,19
EMSendKey "BSECFIND"

for x=1 to 1

SYMBOL=XLSheet.cells(x,1).value
EMSetCursor 2,25
EMSendKey "<DELETE>" 
EMSendKey SYMBOL
EMSendKey "<ENTER>" 

EMReadScreen SYM, 13, 7,9

If trim(SYM)=SYMBOL then
EMReadScreen CUSIP, 9, 6,9
XLSheet.cells(x,2).value="'"&CUSIP
else
XLSheet.cells(x,2).value="Cusip not found"
End if

EMSetCursor 2,25

Next x

End Sub


#Rumba

you could try

EMSendKey  "<Print>"


Hello all.

I'm trying to print (to the default printer) a screenshot of RUMBA 8.1 through the script editor but am running into an issue. The code is as follows:

 

Sub Main

Dim SYMBOL as string
Dim CUSIP as string
Dim SYM as string
Dim APrintear as string

Set XLApp = CreateObject("Excel.Application") ' Create an EXCEL application
XLApp.Workbooks.Open Filename:="C:\\Users\\a267482\\Desktop\\BHIS-GET CUSIP FROM SYMBOL.xlsx"
XLApp.Visible = True
Set MYBook = XLApp.Workbooks("BHIS-GET CUSIP FROM SYMBOL.xlsx")
Set XLSheet = MYBook.Worksheets("Sheet1")

EMSetCursor 1,19
EMSendKey "BSECFIND"

for x=1 to 1

SYMBOL=XLSheet.cells(x,1).value
EMSetCursor 2,25
EMSendKey "<DELETE>" 
EMSendKey SYMBOL
EMSendKey "<ENTER>" 

EMReadScreen SYM, 13, 7,9

If trim(SYM)=SYMBOL then
EMReadScreen CUSIP, 9, 6,9
XLSheet.cells(x,2).value="'"&CUSIP
else
XLSheet.cells(x,2).value="Cusip not found"
End if

EMSetCursor 2,25

Next x

End Sub


#Rumba

Hi Jose_Leon,

my mistake the syntax should be:  SendKeys "^ (p)"

EMSendKey  "<Print>" as suggested by Adrian works as well.

I re-tested the objWD Solution and it works as well. The solution requires a local Installation of Microsoft Word in order to work.

But you can take the concept and replace word by another application that supports Automation.


Hello all.

I'm trying to print (to the default printer) a screenshot of RUMBA 8.1 through the script editor but am running into an issue. The code is as follows:

 

Sub Main

Dim SYMBOL as string
Dim CUSIP as string
Dim SYM as string
Dim APrintear as string

Set XLApp = CreateObject("Excel.Application") ' Create an EXCEL application
XLApp.Workbooks.Open Filename:="C:\\Users\\a267482\\Desktop\\BHIS-GET CUSIP FROM SYMBOL.xlsx"
XLApp.Visible = True
Set MYBook = XLApp.Workbooks("BHIS-GET CUSIP FROM SYMBOL.xlsx")
Set XLSheet = MYBook.Worksheets("Sheet1")

EMSetCursor 1,19
EMSendKey "BSECFIND"

for x=1 to 1

SYMBOL=XLSheet.cells(x,1).value
EMSetCursor 2,25
EMSendKey "<DELETE>" 
EMSendKey SYMBOL
EMSendKey "<ENTER>" 

EMReadScreen SYM, 13, 7,9

If trim(SYM)=SYMBOL then
EMReadScreen CUSIP, 9, 6,9
XLSheet.cells(x,2).value="'"&CUSIP
else
XLSheet.cells(x,2).value="Cusip not found"
End if

EMSetCursor 2,25

Next x

End Sub


#Rumba

Andre/Adrian, that worked.

Thanks a lot!