Is there a way to get Automator or Applescript to run 'batch' processes in Adobe Illustrator?
I have a workflow that handles a number of steps - but the key one is to use Illustrator variable data sets to replace two embedded eps files (one of a symbol and one of some text) and a bit of text with a product code.
I'm basically running through this:
http://hypertransitory.com/blog/2014/05/27/use-adobe-illustrator-variable-data-xml/
Except I have some php spitting out the xml that illustrator requires to use for data.
So I have my xml, and if I run a batch process from within illustrator that works fine - trouble is I want to do this multiple times - and each time I want the files to save in the same location. I can get automator to run an action in illustrator, but I can't create an action to load in and run through the data sets from the xml, saving each one. The only way illustrator seems to let you use the variable data sets is via 'batch' - which means you have to provide it with the 'Destination' to export the files to every time (and you can't use it as a step in Automator).
I'm using Illustrator CC (so I believe that's referred to as illustrator 17 in applescript) and OSX 10.10 (if that's relevant)
I'm new to applescript and am busy learning the syntax - but I can't find anything that seems to indicate this is going to be possible!
You can use Illustrator-friendly scripting languages to "manually" change out the datasets within the Illustrator document and output the files into your manually-coded location. If you can find the Applescript commands to do this, you can use it, otherwise you can make a .jsx extendscript and trigger it with your Applescript.
There are also a couple of sets of Illustrator Automator actions, which may be of use to you. Ai Actions and AI Automator Action Pack, both of which are available on the Mac app store. Not as versatile as coding your own bespoke solution using AppleScript (which is how I'd probably approach the problem), but much easier to implement. For the sake of transparency, I'm the developer of the former.
Related
I'm working on a program that acts as a Windows Accessibility / UI Automation API client, consuming accessibility data from other programs (much like a screen reader does). I'm looking for a way to get the full path of the current "document" (or other file) open in a program. So, for example, Word might give me the path to the current .docx file, Paint the path to the current image file, WMP the path to an audio or video file... you get the idea. Is there a way to do this?
On a Mac, I'd use NSAccessibilityDocumentAttribute, but Windows doesn't seem to have an equivalent accessibility property. A few other questions I looked at:
Getting the path & filename of the open document in any Windows application (last answer in 2009, may have been unaware of accessibility APIs, no answer gives reliably accurate data)
How to get filename and path of file opened in Notepad? - five years old, specific to one program, only answer given is incomplete.
So... is there any equivalent to NSAccessibilityDocumentAttribute, and if not, is there a reasonable way to re-implement it (possibly doing stuff outside of the accessibility tree / API)? It's more important that this return correct information (i.e. never give me a file that isn't open in the relevant program/window) than that it be universally available.
I'm using C# (via System.Windows.Automation for accessibility) but could use other languages if needed, so long as they'll run on Windows 10 (downlevel support nice but not mandatory).
I currently have an Automator workflow that uses Textwrangler to trim text files down for me.
These files are often full of the same bits of code and spaces, so I made a workflow where I click the Automator action which grabs all the text files in a folder, then uses a Dispense Items Incrementally action to pass them through Automator, where an Applescript runs multiple find/replace queries on each file, before saving and repeating.
All this time, I sit there while the files open, are edited and then closed & saved.
Is there not a way to do this without opening the files themselves? Could I not just tell Textwrangler (using some Applescript command) to grab that folder's text files, mess around with them in the background, and then save them?
The problem with opening them all up on your screen is it increases the chance of some error intefering with the workflow - quite often the workflow encounters some error and so I have to run it again.
(E.g. the way Automator might reduce jpeg picture size in the background is ideal.)
Thanks - happy to take any suggestions!
Tardy
I have opened the AppleScript Editor and pressed Record button.
Then I run TextEdit, create a file and put some text there.
When I click the Stop button in AppleScript Editor, nothing was recorded, the window is blank.
What is the problem?
You can use the Record feature of the Automator to record the UI interaction steps needed to do the relevant workflow. Then you can then literally select and copy the recorded steps in automator and paste them into a new Applescript Editor window. This will give you applescript which may or may not work. You'll probably want/need to edit the resulting script, but at least it should help give an idea what is needed to achieve your workflow programatically. This method is usable regardless of whether or not the target application has an applescript dictionary or supports the AppleScript Editor Record button, as it is the interaction with the underlying UI elements which is recorded.
Steps:
Open Automator
Start a new "Workflow"
Start recording
Perform whatever steps you require with your app (in this case typing into textedit)
Stop recording
This will create a list of actions in Automator like:
Select all these and copy (CMD+c)
Open the Applescript Editor app
Paste (CMD+v). The result will be valid applescript to perform the actions you just recorded:
Note that as is generally the case with UI automation, the automator records steps exactly and the script plays them back exactly. This my not be exactly what you want - e.g. if a different application were active, the text could get typed in there instead. The generated applescript should be used as a guide to the final applescript.
The problem is that applications need to explicitly support AppleScript recording in order for it to work, but almost no applications actually do. Finder still supports it a bit, and maybe a couple other apps (BBEdit comes to mind), but for the most part, AppleScript recording has been pretty useless for quite some time.
Not all apps are recordable (in fact, only a small handful are). Recordablity is something each app needs to implement, and I guess TextEdit isn't recordable.
I want to create an application on a Mac to convert multiple files (txt, pdf, doc, html, etc) to a single pdf file that can be printed. The real point is that if you have 50 texts you don't have to open every single file and click command-p.
I'm not quite sure whether the best way to do this is by creating a full-fledged app or an automator plugin (or something else). If I remember correctly there's a filter in mac os's terminal that can convert files to pdf (but I forgot what it's called).
So would an automator plugin do this well, or shall I make an app for this? Can you provide me advantages for each answer?
I've done cocoa touch programming before so I can write objective-c quite well.
Use appscript, either as an action in an automator script or standalone. The advantage is that it is very simple and will take you a fraction of the time to write an app.
Here is something very close to what you want. It sets up a drop-folder and each file dragged onto it is printed (you can use multiple-select to get what you want). It uses Apple Works 6 which doesn't support the file-types that you want.
To modify it to use the Preview application instead you need to change the tell command in the script and then google the dictionary for Preview to check which verb to use for printing.
I wanted to have a GUI front-end for a script that accepts numerous command-line options, most of them are UNIX paths. So I thought rather than typing them in (even with auto-completion) every time, I'd create a GUI front end which contains text boxes with buttons beside them, which when clicked will invoke the file browser dialogue. Later, I thought I'd extend this to other scripts which would sure require a different set of GUI elements. This made me think if there's any existing app that would let me create a GUI dialog, after parsing some kind of description of the items that I want that window should contain.
I know of programs like Zenity, but I think it's doesn't give me what I want. For example, if I were to use it for the first script, it'll end up flashing sequence of windows in succession rather than getting everything done from a single window.
So, basically I'm looking at some corss-platform program that lets me create a window from a text description, probably XML or the like. Please suggest.
Thanks
Jeenu
Mozilla's XUL is a cross platform application framework - . You could write an app as a Firefox plugin or a standalone XUL application.
mono and monodevelop could work for this. Or even something super simple like shoes.