Run .mac files with AHK

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
euras
Posts: 429
Joined: 05 Nov 2015, 12:56

Run .mac files with AHK

25 Mar 2019, 10:51

is it possible to call "green screen" macros with autohotkey? My AHK is 64bit, so it doesn't support ScriptControl

Code: Select all

oSC := ComObjCreate("ScriptControl")
oSC.Language := "VBScript"
oSC.Timeout := -1 ;removes the timeout
ahkvariable := 2
code =
(
;your vbscript
variable = %ahkvariable%
)
oSC.ExecuteStatement(code) ;execute your code
variable := oSC.Eval("variable") ;you have to pull out any variables from the vbscript to be able to use them
But I have a macro, which I want to run via AHK and feed that macro with excel data. Is it possible to do that?

Code: Select all

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

REM This line calls the macro subroutine
subSub1_

sub subSub1_()
   autECLSession.autECLOIA.WaitForAppAvailable
   
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "prof"
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[enter]"
   
   autECLSession.autECLPS.WaitForAttrib 5,26,"00","3c",3,10000

   autECLSession.autECLPS.WaitForCursor 5,27,10000

   autECLSession.autECLOIA.WaitForAppAvailable
   
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "3946"
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[enter]"
end sub
euras
Posts: 429
Joined: 05 Nov 2015, 12:56

Re: Run .mac files with AHK

26 Mar 2019, 00:50

I have tried that class and it works for simple VBScript, but if I try to put into the code what I got from macro recorder from Green Screen, I get an error message that
autECLSession
variable is undefined. What do I wrong? I quess there is some problem with connection to the Green Screen.

Code: Select all

vb := new ActiveScript("VBScript")
code = 
(
OPTION EXPLICIT
autECLSession.SetConnectionByName(ThisSessionName)
REM This line calls the macro subroutine
subSub1_
sub subSub1_()
   autECLSession.autECLOIA.WaitForAppAvailable
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "prof"
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[enter]"
   autECLSession.autECLPS.WaitForAttrib 5,26,"00","3c",3,10000
   autECLSession.autECLPS.WaitForCursor 5,27,10000
   autECLSession.autECLOIA.WaitForAppAvailable
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "3946"
   autECLSession.autECLOIA.WaitForInputReady
   autECLSession.autECLPS.SendKeys "[enter]"
end sub
)
vb.Exec(code)  ; Execute some VBScript.
IMEime
Posts: 750
Joined: 20 Sep 2014, 06:15

Re: Run .mac files with AHK

26 Mar 2019, 03:32

I just tried very simple code of VBScript, too
Because, I have no knowledge about it

In General rules, you Could do it (whatever it is) using another route(languages), I guess

Good Luck To You

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 387 guests