(Solved) How to Get a KM Variable Into AppleScript

I am trying to get KM variable to use as input to a AppleScript.

I need to replace the "Person Name" with the value found in globalFullName

Solved Code:

And should you start using Local variables, you just need to refer to them by macro instance:

image

1 Like

Thanks for the information.

Help me as to why? This variable is set using several other macro's

Roger

That was "this is how you access a variable when it is Local", not "you should be using a Local" -- sorry, I should have been clearer.

Although it doesn't actually matter to AppleScript -- you can quite happily refer to the macro instance when referencing a Global, too. You don't need to, but it doesn't hurt to. So you can have a standard template:

Execute an AppleScript w Variables.kmactions (968 Bytes)

image

...saved as a Favourite, which you can add to your macro and then uncomment lines and change variable names as appropriate.

In fact, now I've thought of it I might just do that!

Thanks.

The favorites was a great suggestion as I have mine scattered in different folders so I will be making some changes

Roger

@Nige_S - You just don't know how many jewels you've dropped in this forum. You just helped me figure out something that has been bugging me for days.

That why I call you the Wonderful Wizard of Nige!

Thank you!
KC

1 Like