Pass Variables to AppleScript

Hi,

I am using current AppleScript to create custom TrimBox (in Acrobat):

tell application "Adobe Acrobat Pro"
   activate
   tell active doc
      repeat with i from 1 to count of pages
         tell page i
            set {L, T, R, B} to media box
            set trim box to {L + 25 * 2.834645, T - 25 * 2.834645, R - 25 * 2.834645, B + 120 * 2.834645}
         end tell
      end repeat
   end tell
end tell

I would like to be able to prompt for User Input change the values of: L, T, R, B:

Any help appreciated!

1 Like

What you need is the KM WiKi article “Using AppleScript to Get and Set Keyboard Maestro Variables”.

In short:

You want to get KM variables into the AppleScript, so you would do something like this (at the beginning of your AppleScript):

tell application "Keyboard Maestro Engine"
  set trimTop to getvariable "Top"  
  set trimBottom to getvariable "Bottom"
  set trimLeft to getvariable "Left"
  set trimRight to getvariable "Right"
end tell

Then use the new variables (trimTop, etc.) in the script.

4 Likes

Add this to your AppleScript:

4 Likes

Works Like a charm! Thank you :slight_smile:

1 Like

If one of the above posts solves your problem/question as originally stated, please check the "Solved" checkbox at the bottom of that post.

Otherwise, please post your remaining questions/issues about this problem.
If you have other questions, please start a new topic.

Sorry, I was looking for that option, unfortunately can't find it on mobile version of the site...

OK, please refresh your browser and try again.

The problem was that this topic was in the "macro" Category, which does not allow the "Solved" feature. I changed it to the "general" Category (which is where it belongs), and now you should see the "Solved" checkbox.

1 Like

Miss this guy. :point_up_2:

3 Likes