Macro optimisation assistance request

Hi, is there a way to merge the actions in this macro together to speed up the execution of this macro? Keeping the order as it is, is mandatory. Can I make a simple applescript that includes many actions in each if statement to minimise the separate actions in each if statement for this macro? Can anybody make suggestions?

Many thanks in advanced for your assistance, optimising this macro will GREATLY assist me. This is the best that I can currently do :slight_smile:

Template Project GET Project NAME v1.0.kmmacros (45.5 KB)

Some questions:

  1. Have you done any timing studies to identify which Actions or sections take a long time?
  • How long does the macro take now, and what is your target time?

Would you please post an image of your macro (in edit mode).
I don't like to download a macro without seeing it first.

If you want to time parts of your macro, you can use this macro as a model:

###Example Results

###MACRO:   Macro Timer @Example

~~~ VER: 1.0    2017-04-01 ~~~

####DOWNLOAD:
Macro Timer @Example.kmmacros (5.4 KB)


###ReleaseNotes

TBD


Hi @JMichaelTX, thank you for your email. Since you provided me with this timing macro I have been using it on a regular basis. The macro uploaded is the most optimised version that i have created (I have been timing the macro and checking the effects of my optimisations). The macro takes about 1.2 seconds but because we loop this macro very often we can use this up to 8 times per overall macro execution. Unfortunately sometimes we need to execute this macro this often. A screen shot of the macro is attached as requested.

Would @DanThomas’s macro ‘Parse Letter v1.0’ speed optimise this macro?
I have already optimised this macro to what I believe is the absolute minimum number of actions.

Since I don’t know the objective of your macro, nor do I have the App “Daylite” it is very hard for me to evaluate your macro.

The only things that jump out at me are:

  1. You use a lot of UI scripting. This is always slow compared to direct scripting.
  2. You use the Daylite command “eval” a lot. I don’t know what that does, but if it is like the JavaScript eval() function, then it will also be slow compared to using direct commands.

Bottom line: I don’t have any specific suggestions on how to further optimize your macro.

1 Like

Daylite has virtually no AppleScript dictionary.

It has the base AppleScript suites that allow windows to be manipulated and such.

While there is a suite dedicated to Daylight (the FScript Suite), the only command it has in it is eval – which accesses Daylite’s internal implementation of F-Script.

Ali – as JM mentioned GUI-Scripting is relatively slow.

Wherever possible use eval.

Don’t split up your AppleScript calls any more than you have to.

Put them all together as much as you can.

Run AppleScript as script-files NOT text-scripts.

Find out if you can do more of what you need with eval.

Working with the demo of Daylite is not fun…

-Chris

1 Like