Hi, I'm a beginner, I searched but I didn't find answer because I don't know if this is possible.
I've done a web macro with pulover macro creator, it opens some IE window, do the job (on a web app it downloads a .csv file after doing some filtering), than it close them.
I compiled that as an autohotkey EXE.
I wonder if it's possible to run it in silent/invisible mode, so I can't see windows opening and closing but it does the job so downloads the file.
I want to run that from a java app so I hope it doesn't open windows cause it's ugly...
Thanks!
Luca
Run an AHK compiled script (exe) in invisible mode
Re: Run an AHK compiled script (exe) in invisible mode
I assume it uses IE COM. If so, add a line similar to this:
wb.Visible := False
where wb is the name of the web browser object that was created, so replace that with the name of the object in your script.
wb.Visible := False
where wb is the name of the web browser object that was created, so replace that with the name of the object in your script.
Re: Run an AHK compiled script (exe) in invisible mode
Thank you, but I failed before, I'm using Microsoft edge, not IE, and the code you pasted doesn't work with edge...
I try to post the script to see if you can help me...
I try to post the script to see if you can help me...
Code: Select all
; This script was created using Pulover's Macro Creator
; www.macrocreator.com
#NoEnv
SetWorkingDir %A_ScriptDir%
CoordMode, Mouse, Window
SendMode Input
#SingleInstance Force
SetTitleMatchMode 2
#WinActivateForce
SetControlDelay 1
SetWinDelay 0
SetKeyDelay -1
SetMouseDelay -1
SetBatchLines -1
; UserGlobalVars
global zuccDatafine := "17-05-17"
global zuccDatainiz := "15-05-17"
Macro1:
BlockInput, MouseMove
Run, https://www.xxxxxxxxxxxxxx
WinWaitActive, Login Page - Microsoft Edge ahk_class ApplicationFrameWindow
Sleep, 333
Sleep, 1500
ControlSetText, ApplicationFrameInputSinkWindow1, , Login Page - Microsoft Edge ahk_class ApplicationFrameWindow
Sleep, 300
SendRaw, xxxxxxxxxx
Sleep, 300
Send, {Tab}
Sleep, 300
SendRaw, xxxxxxxxxxxxxxxx
Sleep, 1000
Click, 568, 394 Left, 1
Sleep, 10
Sleep, 8000
WinWaitActive, xxxxxxx - Microsoft Edge ahk_class ApplicationFrameWindow
Sleep, 333
Click, 1126, 399 Left, 1
Sleep, 10
Sleep, 4500
WinWaitActive, xxxxxxxxxxxx - Microsoft Edge ahk_class ApplicationFrameWindow
Sleep, 333
Click, 71, 133 Left, 1
Sleep, 10
Sleep, 3000
Click, 31, 285 Left, 1
Sleep, 10
Sleep, 1000
WinWaitActive, xxxxxxxxxxx - Microsoft Edge ahk_class ApplicationFrameWindow
Sleep, 333
Sleep, 2000
Loop, 3
{
Click, 188, 412 Left, 1
Sleep, 3
}
Sleep, 1000
Send, {Delete}
Sleep, 300
SendRaw, %zuccDatainiz%
Sleep, 300
Loop, 3
{
Click, 196, 437 Left, 1
Sleep, 3
}
Sleep, 1000
Send, {Delete}
SendRaw, %zuccDatafine%
Sleep, 600
Click, 423, 155 Left, 1
Sleep, 10
Sleep, 4000
Loop
{
CoordMode, Pixel, Window
ImageSearch, FoundX, FoundY, 12, 6, 826, 674, C:\Users\Utente\AppData\Roaming\MacroCreator\Screenshots\Screen_20170526104621.png
If ErrorLevel = 0
Click, %FoundX%, %FoundY% Left, 1
}
Until ErrorLevel = 0
Sleep, 4000
WinClose, xxxxx - Microsoft Edge ahk_class ApplicationFrameWindow
Sleep, 333
WinClose, xxxxxx - Microsoft Edge ahk_class ApplicationFrameWindow
Sleep, 333
WinClose, xxxxxxxx - Microsoft Edge ahk_class ApplicationFrameWindow
Sleep, 333
WinClose, xxxxxxxxxxx - Microsoft Edge ahk_class ApplicationFrameWindow
Sleep, 333
WinClose, Login Page - Microsoft Edge ahk_class ApplicationFrameWindow
Sleep, 333
BlockInput, MouseMoveOff
Return
Re: Run an AHK compiled script (exe) in invisible mode
If you want it to be invisible, using COM with IE is the way to do it. Otherwise, you're pretty much stuck with seeing the windows.
Re: Run an AHK compiled script (exe) in invisible mode
Ok, thanks, just the last question, I'm boring I know...
I modified all to fit with IE and the script works, but, when I set Visible to false, the script stops at row 2.. just after "opening" IE in invisible mode...
There's something that I miss?
I modified all to fit with IE and the script works, but, when I set Visible to false, the script stops at row 2.. just after "opening" IE in invisible mode...
There's something that I miss?
Code: Select all
; This script was created using Pulover's Macro Creator
; www.macrocreator.com
#NoEnv
SetWorkingDir %A_ScriptDir%
CoordMode, Mouse, Window
SendMode Input
#SingleInstance Force
SetTitleMatchMode 2
#WinActivateForce
SetControlDelay 1
SetWinDelay 0
SetKeyDelay -1
SetMouseDelay -1
SetBatchLines -1
; UserGlobalVars
global zuccDatafine := "17-05-17"
global zuccDatainiz := "15-05-17"
Macro1:
ie := ComObjCreate("InternetExplorer.Application"), ie.Visible :=false, ie.Navigate("xxxxx/")
WinWaitActive, Login Page - Internet Explorer ahk_class IEFrame
Sleep, 333
Sleep, 2000
WinMaximize, Login Page - Internet Explorer ahk_class IEFrame
Sleep, 333
Sleep, 1500
SendRaw, xxxxx
Sleep, 300
Send, {Tab}
Sleep, 300
SendRaw, xxxxx
Sleep, 1000
Click, 572, 409 Left, 1
Sleep, 10
Sleep, 8000
WinWaitActive, xxxxxxxxx - Internet Explorer ahk_class IEFrame
Sleep, 333
Click, 1116, 396 Left, 1
Sleep, 10
Sleep, 4500
WinWaitActive, xxxxxxxxxxxxxx - Internet Explorer ahk_class IEFrame
Sleep, 333
Click, 59, 108 Left, 1
Sleep, 10
Sleep, 3000
Click, 38, 272 Left, 1
Sleep, 10
Sleep, 1000
WinWaitActive, xxxxxxxxxxx - Internet Explorer ahk_class IEFrame
Sleep, 333
Sleep, 2000
Click, 202, 399 Left, 1
Sleep, 3
Sleep, 1000
Send, {Delete}
Sleep, 300
SendRaw, %zuccDatainiz%
Sleep, 300
Click, 189, 422 Left, 1
Sleep, 3
Sleep, 1000
Send, {Delete}
SendRaw, %zuccDatafine%
Sleep, 600
Click, 426, 136 Left, 1
Sleep, 10
Sleep, 4000
ControlFocus, DirectUIHWND1, xxxxxxxxxxxxx - Internet Explorer ahk_class IEFrame
Click, 569, 639 Left, 1
Sleep, 10
Sleep, 4000
WinClose, xxxxxxx - Internet Explorer ahk_class IEFrame
Sleep, 333
WinClose, xxxxxxxxxx - Internet Explorer ahk_class IEFrame
Sleep, 333
WinClose, xxxxxxxxxx - Internet Explorer ahk_class IEFrame
Sleep, 333
WinClose, xxxxxxxxxxx - Internet Explorer ahk_class IEFrame
Sleep, 333
WinClose, Login Page - Internet Explorer ahk_class IEFrame
Sleep, 333
Return
Re: Run an AHK compiled script (exe) in invisible mode
You haven't converted it to using COM. You started, but then you are still trying to interfacie with the browser window like before. You can't do any of that waiting for windows and clicking at locations. It requires a total rewrite to solely use COM techniques, and it would be a lot to learn. Check out the various IE COM tutorials if you have the interest in climbing the learning curve.
Re: Run an AHK compiled script (exe) in invisible mode
Ok, now I got it.. Thank you so much, I'll try to learn COM