AS/400 - Macro AS400 Hascript

 
Vista:

Macro AS400 Hascript

Publicado por Roser (1 intervención) el 26/05/2022 15:26:50
Necesito realizar una macro en Hasscript, ja la tenia hecha en java.script y era la siguiente:
a) no se como asignar una variable en un campo
<input value="'30011083133[enter]'" row="0" col="0" movecursor="true" xlatehostkeys="true" encrypted="false" />
30011083 debe ser una variable
b) se puede abrir la aplicación excel desde el nuevos AS400 HAScript?

[PCOMM SCRIPT HEADER]
LANGUAGE=VBSCRIPT
DESCRIPTION=
[PCOMM SCRIPT SOURCE]
OPTION EXPLICIT
autECLSession.SetConnectionByName(ThisSessionName)

REM This line calls the macro subroutine
subSub1_

sub subSub1_()

dim dataval
dim import
dim retencio

dim i
dim h
dim numpol

dim objExcel
dim objWorkbook
dim objWorksheets


Set objExcel = CreateObject("Excel.Application")
ObjExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Open("C:\Users\VILADERO\Desktop\Rescats_Estalvi.xlsx")

h=ObjExcel.cells(1,1)

autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "6"
enter()

autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "14"
enter()


for i=1 to h

numpol=ObjExcel.cells(2+i,2)
tab():tab()
i_01(numpol)
enter()

autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
dataval=autECLSession.autECLPS.GetText(13,25,10)
import=autECLSession.autECLPS.GetText(17,25,14)
retencio=autECLSession.autECLPS.GetText(18,25,14)


ObjExcel.cells(2+i,3).Value=dataval
ObjExcel.cells(2+i,4).Value=import
ObjExcel.cells(2+i,5).Value=retencio

f12()

next

objExcel.ActiveWorkbook.Save

objExcel.ActiveWorkbook.Close
ObjExcel.Visible = False

f3():f3()


MsgBox "Procés finalitzat"


end sub

Function f12()
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf12]"
End function
Function f3()
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf3]"
End function
Function enter()
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[enter]"
End function
Function tab()
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[tab]"
End function
Function down()
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[down]"
End function
Function up()
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[up]"
End function
Function i_01(z)
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys z
end function
Function avp()
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[roll up]"
End function
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder