I have a macro loop I want to run but I need to insert a set of text characters into a text box which is selected in the loop each time. The the sets of characters are in a text file separated by a space between each set. I understand text can be inserted through the clipboard command, but how would I complete the rest of this? Thank you for any help!
I tried that ccstone and it works perfectly thank you! Although I need a single character string on each loop on the macro inserted into the text box going sequentially. So if there is 20 different text character strings in a file separated by a space, on the first loop the first text character string is inserted and on the second loop the second text character string is inserted etc.
From a programming point of view I have thought about making a variable with the number 0 in it and each loop the number is increased by 1 and this variable is used to select which item in an array is selected and put into a new variable which is put in the text box. How would I go about this?
I put the rest of my job sequence into the for each loop last night and ran the macro multiple (multiple) times and it started having problems. I put a one second delay at the start of the execution of the instructions on each loop and I found the text box that the character set is inserted into likes to immediately jump to a new text box without finishing the job sequence and will put a new character into the new text box (no matter what that text box is). It is an action very similar to a tab key press but I assure that is not in the job sequence although a return key press is the first action within the loop. I am aware sometimes a pause is required or the macro will try to carry out an action before the last one is finished, I am unsure if this could be the problem. Is no pauses the route of many problems?
I have tried to be as clear as possible sorry if that is difficult to read! Does anyone know what could be causing tab key problem? All ideas are very appreciated! Thank you
I added pasting on another macro which did a simplified sequence and it was more accurate. Adding it on this, the entire file is pasted and not a single six digit character set.
When I select the text box it is meant to paste but the mouse movements are not recorded properly either so it pastes randomly on the screen. I have recorded and rerecorded and it still does not work, yet on a small macro mouse movements work fine.
The tabbing has seemed to have stopped after using pasting. There are three pasting options which is best for my purpose?
The mouse movements and pasting the entire file instead of the single character set are my main problems I think.
What you are missing is some Pause actions to allow the actions to complete before continuing on. For some actions (eg Activate Application), Keyboard Maestro can wait until the action is performed, but for others, there is no way for Keyboard Maestro to know the consequences and how long they will take (eg Click actions, or menu actions that cause animations or other time consuming behaviour).
In this case, the prime locations that likely need a Pause would be after the click (to allow whatever consequences the click has to happen); after the menu selection to allow the dialog to appear; after the first activate application (to ensure Illustrator is ready to accept the keystroke) (the second activate adobe illustrator seems redundant); after the click (as before); at the end of the loop to ensure the loop does not repeat too fast.
Also, you activate Illustrator, but never anything else, so its not clear what application you expect to be in at the start of the loop.
Thats great thank you so much I got it working with pauses, but now after the sixth loop it starts inserting the same text repeatedly into the text box and the mac makes a beep noise like it can’t do something. I checked the file it is reading from and there are no errors in that, I am very confused.
I have managed to work that problem out! Is there a a way so I can run a macro on a program in the background and still use the computer to do other things? Currently because the mouse and keyboard is used by my macro it renders the computer useless until its finished its task!
IMO, the main purpose of that is to allow the same hotkey (or other trigger) to be used in multiple applications, but actually trigger the macro specific for the app.
Here’s an example:
I use many different apps that support highlighting (background color) of text, but each of them do it differently, and have different app shortcuts (or none at all) to apply the highlight.
Using KM, I have one hotkey, CMD-CTRL-H, that applies highlight in every app I use, but with a different macro for each.