I often need to copy and paste names from one app to another, and the names need to be inverted when pasted. So, for example, John Smith needs to become Smith, John.
Is there a way to create a macro for this? How much of this can the macro do? The most useful portion for me would be to invert the name. Can the macro also automatically paste in the appropriate app?
Not exactly. I mostly use the macro I provided to convert employee names from an Excel file where they are stored as 'Lastname[comma]Firstname' to copy and paste as 'Firstname[space]Lastname' elsewhere. However, where I have the name selected as 'Firstname[space]Lastname' and I need it as 'Lastname[comma]Firstname', the same macro is used with the other trigger (i.e. the last name moves in the direction of the > or <).
So:
'First Name[space]Last Name' to 'Last Name[comma][space]First Name'
John Smith would be replaced with Smith, John
or
'Last Name[comma][space]First Name' to 'First Name[space]Last Name'
Smith, John would be replaced with John Smith
In fact, that's the whole macro. You don't have to figure out the Perl. Just select the two names, press Option + Comma and it will swap them, adding a comma if necessary.
You can do this with Keyboard Maestro actions, but I just love the clarity of a simple Perl script.