Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Macro Creator v4.1.2 - Automation Tool (Recorder & Writer)


  • Please log in to reply
670 replies to this topic
Pulover
  • Members
  • 1596 posts
  • Last active: Apr 06 2016 04:00 AM
  • Joined: 20 Apr 2012

If I put a Sleep 500 at the very start before Send {i} then it does work.


When you use a combo hotkey the state of modifier keys should be ignored but some applications/games might still receive. So the game is probably receiving Alt+I and that could explain why the small pause solves it. wink.png

Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer) | Class_LV_Rows - Copy, Cut, Paste and Drag ListViews | Class_Toolbar - Create and modify | Class_Rebar - Adjustable GUI controls

Join the New AutoHotkey Forum!


Pulover
  • Members
  • 1596 posts
  • Last active: Apr 06 2016 04:00 AM
  • Joined: 20 Apr 2012
New forum addresshttp://auto-hotkey.c...=143&p=936#p936

Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer) | Class_LV_Rows - Copy, Cut, Paste and Drag ListViews | Class_Toolbar - Create and modify | Class_Rebar - Adjustable GUI controls

Join the New AutoHotkey Forum!


Dayspring
  • Members
  • 12 posts
  • Last active: Oct 23 2013 09:54 AM
  • Joined: 30 Aug 2013

Hey again, I didn't get around to creating my account on the other forum yet, will do so sometime over the next couple of days.  I'm trying to work with arrays now and I'm hitting a bit of a wall.  I just can't seem to access the array variable.  Tonight I made a bit of a breakthrough but I'm still not there:

[PMC Code]|!Numpad6||1|Window|1|Macro5
1|[Assign Variable]|Pets := Bear*Cat*Dog|1|0|Variable|||||
2|[LoopStart]|Pets`, *`, |1|0|LoopParse|||||
3|[MsgBox]|%A_LoopField%|1|0|MsgBox|0||||
4|[LoopEnd]|LoopEnd|1|0|Loop|||||
5|Array|Cols := Red,Blue,Green|1|0|Function|||||
6|[MsgBox]|%Cols2%|1|0|MsgBox|0||||
7|[MsgBox]|%Cols%2|1|0|MsgBox|0||||
8|[MsgBox]|Cols[2]|1|0|MsgBox|0||||

The loop parse method works fine for my Pets string but I want to use a proper array so I can access data without a loop.  My end goal is to have an array of x/y co-ordinates and then on the next line pick a random set from the array and do a mouse move/click.  You can see where I tried to use a real array called Cols on lines 5-8.  The message box never displays the value.  I thought it might be something to do with the message box so I tried using conditional statements with a generic "Found" message but that didn't work either.



Pulover
  • Members
  • 1596 posts
  • Last active: Apr 06 2016 04:00 AM
  • Joined: 20 Apr 2012
Hey man! Good to know you're trying to use arrays. I was waiting for some feedback.

To retrieve the contents in commands is like in ahk, you need to start the parameter with a percent sign and a space.

% Col[2]

Arrays might not work directly with statements yet. Didn't have the time to test everything.

Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer) | Class_LV_Rows - Copy, Cut, Paste and Drag ListViews | Class_Toolbar - Create and modify | Class_Rebar - Adjustable GUI controls

Join the New AutoHotkey Forum!


Dayspring
  • Members
  • 12 posts
  • Last active: Oct 23 2013 09:54 AM
  • Joined: 30 Aug 2013

Boom!  I didn't use a space between my % and the variable name, just modified my test to do that and it works!  I'll copy one of my crafting macros and modify it to use arrays.  Huge thanks :)



Dayspring
  • Members
  • 12 posts
  • Last active: Oct 23 2013 09:54 AM
  • Joined: 30 Aug 2013

I tried to get multidimensional arrays running but didn't get far, not too bothered though since I can just use a flat array and then just step by 2 for each set of x/y.  I don't suppose there's any chance you could add Random to the function list?

 

One macro I want to write is to reverse engineer the 1st 20 items in my inventory, I can use the same macro on all my crafting characters.  The plan is to store an array of the top left corner points for each of the 20 inventory slots.  Then for each slot I'll use Random to pick a number ranging from "that point" to "that point + the maximum dimensions of a slot".  That way it still clicks each inventory slot in order but it does it in a bit of a varied click position.  I can then tie then into the awesome new random delay system you added.



Pulover
  • Members
  • 1596 posts
  • Last active: Apr 06 2016 04:00 AM
  • Joined: 20 Apr 2012
Multidimensional arrays not supported yet (it's complex to implement so one step at a time ;) ).

The Random command has always been among the list in the Run window. You can use the Find a Command window to search for commands and functions.

Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer) | Class_LV_Rows - Copy, Cut, Paste and Drag ListViews | Class_Toolbar - Create and modify | Class_Rebar - Adjustable GUI controls

Join the New AutoHotkey Forum!


Dayspring
  • Members
  • 12 posts
  • Last active: Oct 23 2013 09:54 AM
  • Joined: 30 Aug 2013

Wow that is great, Run & Find, sweet!  I'll try and get something together over the next few days and post it so you can see what shennanigans I'm getting up to with your utility :p



Dayspring
  • Members
  • 12 posts
  • Last active: Oct 23 2013 09:54 AM
  • Joined: 30 Aug 2013

Hey, thought I'd post a bit of an update with my macro adventures.  Took me a while to get the spare time to tinker around again.  This is my latest addition, I use it in Star Wars the Old Republic.  It's for reverse engineering and I use it for all my crafters.  The in-game setup for it is that I move my inventory to the top left corner of the screen so it can't move anymore and I have opening/closing the inventory bound to the letter "i".  I move it to the top left so that it's easy to reposition incase I accidently move it, this way my inventory specific macros will always work with the correct positions.  I'm not sure how it will work on different resolutions since I don't know how the game handles scaling, mine is 1920x1080.

[PMC Code]|!Numpad5||1|Window|1|Macro7
1|[Label]|Reverse_Engineer_Adv_Random|1|0|Label|||||
2|[Pause]||1|1500|Sleep|||||
3|i|{i}|1|0|ControlSend||Star Wars™: The Old Republic™ ahk_class PlayerClient|||
4|[Pause]|Random|1|4800|Sleep|5100||||
5|Left Click|Left, 1, NA|1|0|ControlClick|x432 y66|Star Wars™: The Old Republic™ ahk_class PlayerClient|||
6|[Pause]|Random|1|4800|Sleep|5100||||
7|[Assign Variable]|SlotCount := 20|1|0|Variable|||||
8|[Assign Variable]|StartX := 37|1|0|Variable|||||
9|[Assign Variable]|StartY := 96|1|0|Variable|||||
10|[Assign Variable]|SlotWidth := 51|1|0|Variable|||||
11|[Assign Variable]|HorizontalSpacing := 57|1|0|Variable|||||
12|[Assign Variable]|VerticalSpacing := 57|1|0|Variable|||||
13|[Assign Variable]|CurrentX := %StartX%|1|0|Variable|Expression||||
14|[Assign Variable]|CurrentY := %StartY%|1|0|Variable|Expression||||
15|[Assign Variable]|Slots := |1|0|Variable|||||
16|[LoopStart]|LoopStart|%SlotCount%|0|Loop|||||
17|[Assign Variable]|CurrentXMax := %CurrentX%+%SlotWidth%|1|0|Variable|Expression||||
18|[Assign Variable]|CurrentYMax := %CurrentY%+%SlotWidth%|1|0|Variable|Expression||||
19|Random|ClickX, %CurrentX%, %CurrentXMax%|1|0|Random|||||
20|Random|ClickY, %CurrentY%, %CurrentYMax%|1|0|Random|||||
21|[Assign Variable]|Slots .= %ClickX%x%ClickY%*|1|0|Variable|||||
22|Evaluate Expression|mod(%A_Index%`,10) = 0|1|0|If_Statement|||||
23|[Assign Variable]|CurrentX := %StartX%|1|0|Variable|Expression||||
24|[Assign Variable]|CurrentY += %VerticalSpacing%|1|0|Variable|Expression||||
25|[Else]|Else|1|0|If_Statement|||||
26|[Assign Variable]|CurrentX += %HorizontalSpacing%|1|0|Variable|Expression||||
27|[End If]|EndIf|1|0|If_Statement|||||
28|[LoopEnd]|LoopEnd|1|0|Loop|||||
29|Sort|Slots, Random D*|1|0|Sort|||||
30|[LoopStart]|Slots`, '*`, |1|0|LoopParse|||||
31|Evaluate Expression|%A_Index% <= %SlotCount%|1|0|If_Statement|||||
32|StrSplit|ClickCoords := %A_LoopField%,x|1|0|Function|||||
33|[Assign Variable]|ClickX := % ClickCoords[1]|1|0|Variable|Expression||||
34|[Assign Variable]|ClickY := % ClickCoords[2]|1|0|Variable|Expression||||
35|Right Click|Right, 1,  x%ClickX% y%ClickY% NA|1|0|ControlClick||Star Wars™: The Old Republic™ ahk_class PlayerClient|||
36|[Pause]|Random|1|5100|Sleep|5500||||
37|[End If]|EndIf|1|0|If_Statement|||||
38|[LoopEnd]|LoopEnd|1|0|Loop|||||
39|Left Click|Left, 1, NA|1|0|ControlClick|x428 y60|Star Wars™: The Old Republic™ ahk_class PlayerClient|||
40|[Pause]|Random|1|4800|Sleep|5100||||
41|i|{i}|1|0|ControlSend||Star Wars™: The Old Republic™ ahk_class PlayerClient|||

I use a lot of variables so it can be easily adjusted later on if I change my resolution or they upate the ingame graphics.  Lines 16-28 is where I create an array of all the clicks in left-to-right order.  When it hits 10 inventory slots it then wraps around to the first left block of the 2nd row.  The number of slots to reverse can be set with the SlotCount variable.

 

In that loop and on line 29 you can see where I used Random to give the clicks a random x/y position and then again in Sort I use it to shuffle the order of the boxes it will click.  Then it's just a matter of looping through the shuffled array and clicking those inventory slots.

 

I actually use 2 versions of this, both the same except in one I have the random sort on line 29 commented out.  If I've crafted enough items to fill the top 20 slots then I'll use the random sorted version.  If I only have say 15 crafted items then I use the unrandomised one and then just manually stop the macro when it starts reversing the 15th slot.

 

Put the Control window stuff to good use so now I can load into my character, trigger one of the 2 reverse engineering macros, then alt tab out and continue working/browsing/whatever.  It saves about 1 and 1/2 minutes of sitting there manually reverse engineering.  Doesn't sound like much but it does add up.



Pulover
  • Members
  • 1596 posts
  • Last active: Apr 06 2016 04:00 AM
  • Joined: 20 Apr 2012

Very nice, Dayspring! I see you're making use of StrSplit to create the arrays, it's good to know that this is working fine. This is an interesting example to study when looking for good ways of automating games and apps, especially because it's short and easy to understand. Thanks for sharing.

 

I have some updates for PMC. I didn't have the time to finish everything yet but a new version should be out soon. Let me know if you find any bugs.


Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer) | Class_LV_Rows - Copy, Cut, Paste and Drag ListViews | Class_Toolbar - Create and modify | Class_Rebar - Adjustable GUI controls

Join the New AutoHotkey Forum!


Dayspring
  • Members
  • 12 posts
  • Last active: Oct 23 2013 09:54 AM
  • Joined: 30 Aug 2013

To be  honest, I did find a few bugs but I didn't have the time to sit down and work out how to reproduce them consistantly.  A few that come to mind are:

 

1) After heavy tweaking any of the macros none of them would be launchable with the associated hotkeys.  The only fix for this I found was to restart the app.

2) After I started using Random sometimes all my MsgBoxes would be converted into Run commands that don't fire.  The fix for this is to remove all the MsgBoxes and add them again.

3) Sometimes I would find that big chunks of my other macros were missing.  Now I have to check them all before I save any of them.  My guess is that something goes a bit crazy with the parser.

 

In the code I posted last time I have these two lines:

 

30|[LoopStart]|Slots`, '*`, |1|0|LoopParse|||||
31|Evaluate Expression|%A_Index% <= %SlotCount%|1|0|If_Statement|||||

 

From what I read using the LoopStart as I did it should ignore the empty * at the end but that isn't what actually happened.  Instead I had to add the conditional to check if we had reached the end of my count instead of the end of the loop-parsed objects.

 

Don't get me wrong, these are all things that I noticed quite early on so now I'm used to working around/with them.  If I had more time I'd try and lock them down to give you reproducable results but I don't have much time atm.



Pulover
  • Members
  • 1596 posts
  • Last active: Apr 06 2016 04:00 AM
  • Joined: 20 Apr 2012
Hi Dayspring,

I've been quite busy lately too...

1) I'll have to find time to make tests and try to reproduce this issue.
2) There's an issue with line breaks in the msgbox. I've fixed already and will be in the next update.
3) I think it happened to me only once but I cannot spot where the error would be...

If you get more clues let me know.

I suspect I'm not receiving email notifications from this site so when you get the time sign up in the new one... Besides, the theme here hurts my eyes.

Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer) | Class_LV_Rows - Copy, Cut, Paste and Drag ListViews | Class_Toolbar - Create and modify | Class_Rebar - Adjustable GUI controls

Join the New AutoHotkey Forum!


Gorhell
  • Members
  • 3 posts
  • Last active: Oct 24 2013 07:12 PM
  • Joined: 23 Oct 2013

Great tool! But how can I make schedule my macro. Let say I recorded a macro that enters text and send them and want them to send every 10 mins. How can I do that



Pulover
  • Members
  • 1596 posts
  • Last active: Apr 06 2016 04:00 AM
  • Joined: 20 Apr 2012

Great tool! But how can I make schedule my macro. Let say I recorded a macro that enters text and send them and want them to send every 10 mins. How can I do that

 

Thanks, Gorhell.

 

You can use the timer, it's in the menu Macro > Timer (or Ctrl+Shift+T). In the next version I'll also add the option to schedule a task on windows task scheduler, so be sure to check the updates.


Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer) | Class_LV_Rows - Copy, Cut, Paste and Drag ListViews | Class_Toolbar - Create and modify | Class_Rebar - Adjustable GUI controls

Join the New AutoHotkey Forum!


Gorhell
  • Members
  • 3 posts
  • Last active: Oct 24 2013 07:12 PM
  • Joined: 23 Oct 2013

The Problem is the timer keeps it spamming I put it at 10 minutes then Play every X(miliseconds) options But it just keeps spamming and I want to create it as exe but the program can't do it. The best thing about your tool is the record so cool!