Pulover's Macro Creator v5.0.5 - The Complete Automation Tool

Advanced Macro Recorder/Editor.

Moderator: Pulover

jejefoxx
Posts: 1
Joined: 22 Jul 2020, 14:08

Re: Pulover's Macro Creator v5.0.5 - The Complete Automation Tool

22 Jul 2020, 14:18

I can disable macros if I find a specific image. ?
blazinguitar
Posts: 2
Joined: 05 Aug 2020, 09:51

Re: Pulover's Macro Creator v5.0.5 - The Complete Automation Tool

05 Aug 2020, 10:05

I'm having issues running my exported ahk file. The script works perfectly in PMC, but hangs up on the first image search in ahk. What would be causing this?

The purpose of this script is to navigate to a certain website, login (credentials are saved in browser), navigate to a certain page and then upload a file using a specific user input. All of the navigating is done using ImageSearch.

Code: Select all

Run, (website link removed for security reasons)
WinWaitActive, ahk_exe firefox.exe
Sleep, 333
WinMaximize, ahk_exe firefox.exe
Sleep, 333
Loop, 200
{
    CoordMode, Pixel, Client
    ImageSearch, FoundX, FoundY, 0, 6, 196, 77, C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804131643.png
    CenterImgSrchCoords("C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804131643.png", FoundX, FoundY)
    If ErrorLevel
    	Break
}
Until ErrorLevel = 0
CoordMode, Pixel, Client
ImageSearch, FoundX, FoundY, 2, 77, 721, 606, C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804092706.png
CenterImgSrchCoords("C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804092706.png", FoundX, FoundY)
If ErrorLevel = 0
	Click, %FoundX%, %FoundY% Left, 1
Loop, 100
{
    CoordMode, Pixel, Client
    ImageSearch, FoundX, FoundY, 0, 6, 196, 77, C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804131643.png
    CenterImgSrchCoords("C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804131643.png", FoundX, FoundY)
    If ErrorLevel
    	Break
}
Until ErrorLevel = 0
CoordMode, Pixel, Client
ImageSearch, FoundX, FoundY, 0, 28, 226, 572, C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804141623.png
CenterImgSrchCoords("C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804141623.png", FoundX, FoundY)
If ErrorLevel = 0
	Click, %FoundX%, %FoundY% Left, 1
Sleep, 1000
Loop, 100
{
    CoordMode, Pixel, Client
    ImageSearch, FoundX, FoundY, -1, 78, 229, 816, C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804142048.png
    If ErrorLevel = 0
    	Click, %FoundX%, %FoundY% Left, 1
    If ErrorLevel
    	Break
}
Until ErrorLevel = 0
Loop, 100
{
    CoordMode, Pixel, Client
    ImageSearch, FoundX, FoundY, 0, 80, 1121, 584, C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804142525.png
    CenterImgSrchCoords("C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804142525.png", FoundX, FoundY)
    If ErrorLevel = 0
    	Click, %FoundX%, %FoundY% Left, 1
    If ErrorLevel
    	Break
}
Until ErrorLevel = 0
Loop, 100
{
    CoordMode, Pixel, Client
    ImageSearch, FoundX, FoundY, 0, 80, 1121, 584, C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804142723.png
    CenterImgSrchCoords("C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804142723.png", FoundX, FoundY)
    If ErrorLevel = 0
    	Click, %FoundX%, %FoundY% Left, 1
    If ErrorLevel
    	Break
}
Until ErrorLevel = 0
Loop, 100
{
    CoordMode, Pixel, Client
    ImageSearch, FoundX, FoundY, 0, 80, 1121, 584, C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804142834.png
    CenterImgSrchCoords("C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804142834.png", FoundX, FoundY)
    If ErrorLevel = 0
    	Click, %FoundX%, %FoundY% Left, 1
    If ErrorLevel
    	Break
}
Until ErrorLevel = 0
WinWaitActive, File Upload ahk_exe firefox.exe
Sleep, 333
InputBox, JobNumber, Job Number
Sleep, 300
SendRaw, %JobNumber%.csv
Sleep, 300
Send, {Enter}
Loop, 100
{
    CoordMode, Pixel, Client
    ImageSearch, FoundX, FoundY, 0, 73, 984, 627, C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804151949.png
    CenterImgSrchCoords("C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804151949.png", FoundX, FoundY)
    If ErrorLevel = 0
    	Click, %FoundX%, %FoundY% Left, 1
    If ErrorLevel
    	Break
}
Until ErrorLevel = 0
Sleep, 500
Loop, 100
{
    CoordMode, Pixel, Client
    ImageSearch, FoundX, FoundY, 0, 80, 1393, 818, C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804152104.png
    CenterImgSrchCoords("C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804152104.png", FoundX, FoundY)
    If ErrorLevel = 0
    	Click, %FoundX%, %FoundY% Left, 1
    If ErrorLevel
    	Break
}
Until ErrorLevel = 0
Sleep, 300
Send, {Enter}
gregster
Posts: 4631
Joined: 30 Sep 2013, 06:48

Re: Pulover's Macro Creator v5.0.5 - The Complete Automation Tool

05 Aug 2020, 10:11

blazinguitar wrote:
05 Aug 2020, 10:05
I'm having issues running my exported ahk file. The script works perfectly in PMC, but hangs up on the first image search in ahk. What would be causing this?
At least your code seems to be missing the CenterImgSrchCoords() function, which would be a user-defined function (because there is no built-in AHK function of this name). Didn't PMC export this as well?
blazinguitar
Posts: 2
Joined: 05 Aug 2020, 09:51

Re: Pulover's Macro Creator v5.0.5 - The Complete Automation Tool

05 Aug 2020, 10:30

gregster wrote:
05 Aug 2020, 10:11
At least your code seems to be missing the CenterImgSrchCoords() function, which would be a user-defined function (because there is no built-in AHK function of this name). Didn't PMC export this as well?
Haha you can tell it's been a long day. I had the pmc code in the clipboard and forgot to change it to the ahk code. Here is the actual code from the ahk file.

Code: Select all

; This script was created using Pulover's Macro Creator
; www.macrocreator.com

#NoEnv
SetWorkingDir %A_ScriptDir%
CoordMode, Mouse, Screen
SendMode Input
#SingleInstance Force
SetTitleMatchMode 2
#WinActivateForce
SetControlDelay 1
SetWinDelay 0
SetKeyDelay -1
SetMouseDelay -1
SetBatchLines -1


Test:
Run, (Website link removed for secutrity reasons)
WinWaitActive, ahk_exe firefox.exe
Sleep, 333
WinMaximize, ahk_exe firefox.exe
Sleep, 333
Loop, 200
{
    CoordMode, Pixel, Client
    ImageSearch, FoundX, FoundY, 0, 6, 196, 77, C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804131643.png
    CenterImgSrchCoords("C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804131643.png", FoundX, FoundY)
    If ErrorLevel
    	Break
}
Until ErrorLevel = 0
CoordMode, Pixel, Client
ImageSearch, FoundX, FoundY, 2, 77, 721, 606, C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804092706.png
CenterImgSrchCoords("C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804092706.png", FoundX, FoundY)
If ErrorLevel = 0
	Click, %FoundX%, %FoundY% Left, 1
Loop, 100
{
    CoordMode, Pixel, Client
    ImageSearch, FoundX, FoundY, 0, 6, 196, 77, C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804131643.png
    CenterImgSrchCoords("C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804131643.png", FoundX, FoundY)
    If ErrorLevel
    	Break
}
Until ErrorLevel = 0
CoordMode, Pixel, Client
ImageSearch, FoundX, FoundY, 0, 28, 226, 572, C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804141623.png
CenterImgSrchCoords("C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804141623.png", FoundX, FoundY)
If ErrorLevel = 0
	Click, %FoundX%, %FoundY% Left, 1
Sleep, 1000
Loop, 100
{
    CoordMode, Pixel, Client
    ImageSearch, FoundX, FoundY, -1, 78, 229, 816, C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804142048.png
    If ErrorLevel = 0
    	Click, %FoundX%, %FoundY% Left, 1
    If ErrorLevel
    	Break
}
Until ErrorLevel = 0
Loop, 100
{
    CoordMode, Pixel, Client
    ImageSearch, FoundX, FoundY, 0, 80, 1121, 584, C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804142525.png
    CenterImgSrchCoords("C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804142525.png", FoundX, FoundY)
    If ErrorLevel = 0
    	Click, %FoundX%, %FoundY% Left, 1
    If ErrorLevel
    	Break
}
Until ErrorLevel = 0
Loop, 100
{
    CoordMode, Pixel, Client
    ImageSearch, FoundX, FoundY, 0, 80, 1121, 584, C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804142723.png
    CenterImgSrchCoords("C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804142723.png", FoundX, FoundY)
    If ErrorLevel = 0
    	Click, %FoundX%, %FoundY% Left, 1
    If ErrorLevel
    	Break
}
Until ErrorLevel = 0
Loop, 100
{
    CoordMode, Pixel, Client
    ImageSearch, FoundX, FoundY, 0, 80, 1121, 584, C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804142834.png
    CenterImgSrchCoords("C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804142834.png", FoundX, FoundY)
    If ErrorLevel = 0
    	Click, %FoundX%, %FoundY% Left, 1
    If ErrorLevel
    	Break
}
Until ErrorLevel = 0
WinWaitActive, File Upload ahk_exe firefox.exe
Sleep, 333
InputBox, JobNumber, Job Number
Sleep, 300
SendRaw, %JobNumber%.csv
Sleep, 300
Send, {Enter}
Loop, 100
{
    CoordMode, Pixel, Client
    ImageSearch, FoundX, FoundY, 0, 73, 984, 627, C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804151949.png
    CenterImgSrchCoords("C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804151949.png", FoundX, FoundY)
    If ErrorLevel = 0
    	Click, %FoundX%, %FoundY% Left, 1
    If ErrorLevel
    	Break
}
Until ErrorLevel = 0
Sleep, 500
Loop, 100
{
    CoordMode, Pixel, Client
    ImageSearch, FoundX, FoundY, 0, 80, 1393, 818, C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804152104.png
    CenterImgSrchCoords("C:\Users\Admin\AppData\Roaming\MacroCreator\Screenshots\Screen_20200804152104.png", FoundX, FoundY)
    If ErrorLevel = 0
    	Click, %FoundX%, %FoundY% Left, 1
    If ErrorLevel
    	Break
}
Until ErrorLevel = 0
Sleep, 300
Send, {Enter}
Return


CenterImgSrchCoords(File, ByRef CoordX, ByRef CoordY)
{
	static LoadedPic
	LastEL := ErrorLevel
	Gui, Pict:Add, Pic, vLoadedPic, %File%
	GuiControlGet, LoadedPic, Pict:Pos
	Gui, Pict:Destroy
	CoordX += LoadedPicW // 2
	CoordY += LoadedPicH // 2
	ErrorLevel := LastEL
}

Return to “Pulovers Macro Creator”

Who is online

Users browsing this forum: No registered users and 5 guests