Jump to content
You must now use your email address to sign in [click for more info] ×

Recommended Posts

Are there any plans to add scripting support?

I notice there is no Applescript library at all but am interested to know if there are plans to add Applescript or perhaps Javascript support. Virtually everything we do as far as creating PDFs, packaging, placing images and text, formatting, proofing, sending pages to print etc is done via script.

Tagged text goes hand-in-hand with scripting so I think this needs to also be supported.

Link to comment
Share on other sites

  • Staff

@kimtorch

Welcome to the Serif Affinity forums :)

There are plans to add scripting to the Affinity range, but few details have been released yet.

Patrick Connor
Serif Europe Ltd

"There is nothing noble in being superior to your fellow man. True nobility lies in being superior to your previous self."  W. L. Sheldon

 

Link to comment
Share on other sites

I'd like to offer some brief suggestions of what I believe would be a good start for scripting support. Clearly both InDesign and Quark have extensive scripting libraries but I think with some basic fundamentals a lot can be achieved. I believe the below would allow us to do about 80% of what we need.

Ability to create objects (text frame, image frames and rules) of specific sizes at specific co-ordinates using a list of properties. (set myFrame to create frame (x-coord, y-coord, width, height, colour, tint, border, name, columns, inset etc, etc) 
Ability to populate frames with text or images with ability to fit or scale as required (set story 1 of frame 1 to "myText.txt")
Ability to assign styles to objects (set paragraph style of text frame 1 to "Heading 1")
Ability to create new pages with properties for size, bleed, numbering, spreads etc
Ability to reference selections (set border of selected frame to 0 -  set style of selection to "Bold")
Ability to export using defined PDF Presets (export to myPath with PDF Preset "My Preset")
Ability to address (or loop through) all objects on a pages (set background of all text frames on selected page to "Transparent")
Ability to test for missing or broken links to assets
Ability to create colour swatches, character or paragraph styles, PDF Presets
Ability to create and manipulate layers

Most importantly, the ability to query for any property related to an object (set myProperties to properties of my selection  ->  list of all available properties) This is incredibly useful for writing and debugging.

Link to comment
Share on other sites

I've run into a Publisher crash yesterday that somehow involved Apple's JavaScriptCore library – I do wonder if that's an indication of something coming up 

That being said, I'm still hoping for Python instead of or at least in addition to JavaScript. Having written extensions for different software with both languages, I found that writing extensions in Python was always quick, easy, efficient and even fun, and there are tons of great third party libraries available, whereas any kind of JavaScript extensions, particularly for Adobe programs, have consistently been a royal pain. Getting good integration into the user interface of the host applications (like adding custom menu commands or panels) has never been very robust with any JavaScript-based extensions in any application I have come in contact with. And it's so easy to learn the basics of Python that I believe anyone with JavaScript experience would be able to get started in no time.

I realize that's a rather controversial point and everybody has their own personal preference, but I do encourage everyone to have a look at a few basic Python tutorials and form their own opinion.

Link to comment
Share on other sites

51 minutes ago, Peter Werner said:

That being said, I'm still hoping for Python instead of or at least in addition to JavaScript. Having written extensions for different software with both languages, I found that writing extensions in Python was always quick, easy, efficient and even fun, and there are tons of great third party libraries available, whereas any kind of JavaScript extensions, particularly for Adobe programs, have consistently been a royal pain.

I have no experience with python but have extensive experience with Applescript and PHP scripting. I've written numerous standalone apps in BASIC plus we wrap a lot of scripts in BASIC apps so we can pipe data directly from mysql to Applescript.

My preference would be Applescript but I understand they're not going to want to support two scripting methods for multiple platforms. My second choice would be BASIC but I think javascript makes the most sense. The best thing about choosing JS is that anyone with existing ID scripts will have a head start when looking to port them to AP. Our longest Applescript is 738 lines and I wouldn't look forward to rewriting it into a new language with a new object model.

I would be happy to have a concise, targeted set of logical commands rather than trying to support every single feature of the app but making the scripting unnecessarily complex.

Link to comment
Share on other sites

I don't think that a half-harted approach to scripting will do.

We need deep scripting integration in Publisher. While I applaud kimtorch for his basic approach in his earlier post I don't think this will do.

There are number of people here that would be extremely disappointed with that.

Do it properly from the start. We should be able to automate everything. InDesign is a good example here.

2017 27” iMac 4.2 GHz Quad-Core Intel Core i7 • Radeon Pr 580 8GB • 64GB • Ventura 13.6.4.

iPad Pro (10.5-inch) • 256GB • Version 16.4

Link to comment
Share on other sites

On 9/1/2018 at 12:00 AM, Seneca said:

I don't think that a half-harted approach to scripting will do.

We need deep scripting integration in Publisher. While I applaud kimtorch for his basic approach in his earlier post I don't think this will do.

There are number of people here that would be extremely disappointed with that.

Do it properly from the start. We should be able to automate everything. InDesign is a good example here.

I'm not suggesting for a moment they shouldn't do a full and complete library of scripting functions. I'd be disappointed if it was JUST basics.

I'm simply saying a good starting point would be the fundamental functions I detailed above. I would, however be extremely disappointed if scripting was delayed because they were trying to build every obscure and little used functionality in before releasing it. Get some basic functions out early and build upon that.

Getting AP to the level of a genuine ID competitor will take years but I certainly don't want to wait that long for scripting support. We are simply no chance of changing from ID to AP without scripting - it would cripple our workflow. If we could get the fundamentals I stated above we would be half a chance to move quite early.

Link to comment
Share on other sites

Link to comment
Share on other sites

Whilst I applaud 'thinking outside the square',  I'm not sure whether this is applicable.

Firstly, it appears to be Mac only which eliminates at least 50% of the potential audience. Second, it appears to still require the existance of Apple Events built into the appication (in which case it's already  Applescriptable) and third, I'm not sure the sort of people who have the option to write apple or java scripts will be interested in writing them in Obj C.

I'm not familiar with scripting bridges at all so might be completely wrong in my assessments but from briefly reading the supplied links this is what I was left with. The key point I came out with is that the application has to be inherently scriptable before the bridging can exist. But once again, maybe I have that wrong.

Link to comment
Share on other sites

I'm not knowledgeable about it, but my understanding is that scriptable just means "implements Apple Events", and AppleScript is just a language that was specifically created for sending Apple Events, but any language can do it through a Scripting Bridge. This would be a third-party software that the user would install, but this would not be up to Serif to do. Affinity would only have to implement one interface/protocol. For example, there used to be a software called JavaScript OSA (Open Scripting Architecture), which I could use to write scripts in the AppleScript Editor, but in JavaScript, to automate any application that already supports AppleScript. That software has been superseded by Apple's own thing called "JavaScript for Automation" (or JXA for short), but it seems to use the same basic mechanisms (Apple Events). In theory there could be an OSA extension for Python, etc, but as far as I can tell no one has made one yet.

It would be easier to just create another proprietary scripting system, but tying into native/preexisting infrastructure and ecosystem would probably be better for the user.

♥️Affinity v2; macOS 14; ⌨️🖱; recreational user since 2014.

Link to comment
Share on other sites

9 hours ago, hawk said:

It would be easier to just create another proprietary scripting system, but tying into native/preexisting infrastructure and ecosystem would probably be better for the user.

True, as long as that infrastructure/ecosystem is not Apple-specific. I imagine that Serif would like to use something that works across all their platforms, if there is something common between iOS, MacOS, and Windows :) 

But perhaps they'll focus on MacOS and Windows. JavaScript is usable on both. So is Python, and a lot of others.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
Share on other sites

On 8/30/2018 at 8:58 PM, Patrick Connor said:

@kimtorch

Welcome to the Serif Affinity forums :)

There are plans to add scripting to the Affinity range, but few details have been released yet.

 

+1 for AppleScript here and in Photo and Designer, please! Don't care about JavaScript personally, but please don't reinvent the wheel and come up with some custom scripting language that will prevent integration. 

Adobe (and even Microsoft's Office for Mac) have always had good native AppleScript support for their products on macOS and it's what makes the difference between a "good app" and professional s/w that can do the heavy lifting.

:D

 

Link to comment
Share on other sites

The dev. team has kind of answered that question already some time ago on the Designer thread.

It will most probably be JavaScript just because it's cross platform.

While certainly not a commitment it's an indication of intent.

2017 27” iMac 4.2 GHz Quad-Core Intel Core i7 • Radeon Pr 580 8GB • 64GB • Ventura 13.6.4.

iPad Pro (10.5-inch) • 256GB • Version 16.4

Link to comment
Share on other sites

8 hours ago, walt.farrell said:

True, as long as that infrastructure/ecosystem is not Apple-specific. I imagine that Serif would like to use something that works across all their platforms, if there is something common between iOS, MacOS, and Windows :) 

It would be more work up front, but I think they could create two generic software layers that would translate a Mac-specific protocol (Apple Events) and a Windows-specific protocol to an Affinity scripting API. Only the Affinity-facing side would then have to be updated in the future, with perhaps a little bit of extra work to expose the actual API objects on the platform-specific sides.

6 hours ago, Seneca said:

The dev. team has kind of answered that question already some time ago on the Designer thread.

It will most probably be JavaScript just because it's cross platform.

While certainly not a commitment it's an indication of intent.

Thanks.

♥️Affinity v2; macOS 14; ⌨️🖱; recreational user since 2014.

Link to comment
Share on other sites

On 8/31/2018 at 10:42 AM, Peter Werner said:

I've run into a Publisher crash yesterday that somehow involved Apple's JavaScriptCore library – I do wonder if that's an indication of something coming up 

That being said, I'm still hoping for Python instead of or at least in addition to JavaScript. Having written extensions for different software with both languages, I found that writing extensions in Python was always quick, easy, efficient and even fun, and there are tons of great third party libraries available, whereas any kind of JavaScript extensions, particularly for Adobe programs, have consistently been a royal pain. Getting good integration into the user interface of the host applications (like adding custom menu commands or panels) has never been very robust with any JavaScript-based extensions in any application I have come in contact with. And it's so easy to learn the basics of Python that I believe anyone with JavaScript experience would be able to get started in no time.

I realize that's a rather controversial point and everybody has their own personal preference, but I do encourage everyone to have a look at a few basic Python tutorials and form their own opinion.

+1 for python. See the magic that happens with drawbot or nodebox

Link to comment
Share on other sites

Adding a +1 to the vote for scripting / API support.

InDesign's Javascript support (despite being ancient) is a very high-bar to aim for but something in that direction in the final release would be amazing. If we had that we could definitely migrate most of our work machines over to AP instead of being forced into Creative Cloud at some point in the future - we're still hanging onto CS5 for dear life at the moment!

Link to comment
Share on other sites

Nothing against Python other than it's not a language I have used before. However, it's not just InDesign that uses Javascript.

I would imagine either language would be a good choice, providing the API is broad and detailed enough to really allow maximum control just like InDesign offers (and not the pathetic minimalist offering like Acrobat)

Link to comment
Share on other sites

1 hour ago, Zoot said:

Or just good old Python like every other piece of software in the world that isn't InDesign, lol.

lol indeed. Having used Macs since day one I'm not aware of any standard Mac app which supports python but literally thousands that support Applescript. I'm all for open discussion but I'd prefer it be realistic. As much as my preference is Applescript, I think the most practical would be javascript due to its cross platform nature. I believe either of these would be openly accepted by current InDesign scripters who already script in these languages.

I believe Python would turn existing ID users off - it certainly would me as I don't want to learn yet another language. If Affinity do the syntax and object model right, a lot of existing ID code could even be reusable/transportable which would be a HUGE consideration to switching.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.