applescript

Run illustrator extendscript through automator applescript or bash?

我只是一个虾纸丫 提交于 2019-12-24 12:05:58
问题 The following command will run the SCRIPT_ABC.jsx which is located on my desktop. Is there a way to take the contents of the SCRIPT_ABC.jsx and put the javascript extendscript exclusively inside automator so when I save it out as an application it will be included within the program? on run {input, parameters} tell application "Adobe Illustrator" to open file "Macintosh HD:Users:NAME:Desktop:SCRIPT_ABC.jsx" return input end run 回答1: Paste the entire jsx into your applescript as a text body,

Delete PDF files only from folder using Applescript on MAC

假如想象 提交于 2019-12-24 11:34:09
问题 I need to delete the PDF files only from a folder on a network drive. There are other file types in the folder I can not touch. I am assuming I have to choose or identify the PF files first and then move them to the trash or delete them. What I have so far: tell application "Finder" set theFolder to "Macintosh HD:Users:Kathlene:Desktop:ABC123_JOB" set destFolder to "Server/JOBS/TRANSFER_TRASH/" set thePDFs to every file of theFolder whose name extension is "pdf" move thePDFs to destFolder end

Using applescript, can I change filename without modifying (or getting) the file extension?

谁都会走 提交于 2019-12-24 10:37:47
问题 I am trying to change the name of a file. Seems simple enough, if one is able to change the "displayed name" property. But I keep getting this error: Can't set displayed name of alias "Path:to:file:" to "New_name" Here's the folder action script I'm using (i.e. saved applescript, then used folder action setup service to assign it to my folder): on adding folder items to this_folder after receiving these_items try repeat with this_item in these_items tell application "Finder" to set displayed

How to manipulate “data” objects in AppleScript

ⅰ亾dé卋堺 提交于 2019-12-24 10:35:48
问题 I'm working with iTunes via AppleScript. The artwork element of a track contains image data (or raw data , which appears in practice to return the same thing), which can be retrieved and, say, directly written to a file. (It's an e.g. PNG bytestream.) But I don't know how to do anything with this thing besides write it to a file. I'd like to ask it how many bytes it contains, or even rummage through it (though the latter may well be out of scope for AppleScript). In Script Debugger, it looks

Toggle Web Sharing

。_饼干妹妹 提交于 2019-12-24 09:49:21
问题 I'm looking for an Applescript to toggle Web Sharing in Snow Leopard. I tried this but it doesn't disable, just restarts it when I run it again. Or a shell command as long as I can turn it into a Quicksilver action. That's my end goal. Thanks so much! 回答1: You can use the following shell script to toggle the enabled state of a Mac OS X service: #!/bin/sh # toggle OS X service if [ "$#" -ne "1" ] then echo 1>&2 Usage: `basename $0` service echo 1>&2 Toggle the enabled state of the given

Play sound with AppleScript using afplay and relative file path

人盡茶涼 提交于 2019-12-24 08:38:49
问题 I'm trying to create an AppleScript that uses afplay (as suggested here) to play a random sound file that's located in a directory within the same directory as the script. folder -- applescript.scpt -- sounds ----- sound-x.aiff I found this comment regarding relative paths to be potentially useful: (POSIX path of (path to me)) However, I keep receiving errors when I try mashing it up with this approach for randomness... set theNumber to 3 set theFiles to {} repeat set file_path to quoted form

NSTask Launch causing crash

旧时模样 提交于 2019-12-24 08:35:25
问题 I have an application that can import an XML file through this terminal command : open /path/to/main\ app.app --args myXML.xml This works great with no issues. And i have used Applescript to launch this command through shell and it works just as well. Yet when try using Cocoa's NSTask Launcher using this code : NSTask *task = [[NSTask alloc] init]; [task setLaunchPath:@"/usr/bin/open"]; [task setCurrentDirectoryPath:@"/Applications/MainApp/InstallData/App/"]; [task setArguments:[NSArray

Copy A File In AppleScript

浪尽此生 提交于 2019-12-24 08:23:59
问题 I have the code below to set a variable in Applescript for the path to the iTunes Music Folder: set username to text returned of (display dialog "RingtoneDude" default answer "Enter your path to your iTunes Ringtones folder here. e.g. /Users/David/Music/iTunes/iTunes Music/Ringtones" buttons {"Confirm", "Cancel"} default button 1) And then I have the code to call the variable username to copy a file tell application "Finder" copy file theCopy to username end tell but the file theCopy which is

AppleScript Email Attachment not working in handler

荒凉一梦 提交于 2019-12-24 08:09:41
问题 We have a working AppleScript that creates an email with an attachment and it works fine in the Script Editor. However, we cannot get the attachment to work in the handler used in our macOS app. Difficult to find doc and figure out the difference between activate and send commands. Thanks for any help you can provide. Here is the AppleScript set recipientAddress to "joe@joe.com" set recipientName to "Joe" set theSubject to "Estimate" set theContent to "This is your Estimate. Please call with

Finding a file selecting it in finder issue

半城伤御伤魂 提交于 2019-12-24 07:28:48
问题 I am having this script to find a file and select it set filePath to ("filePath.ext" as POSIX file) tell application "Finder" if (exists filePath) then select filePath activate else display alert "File " & filePath & " does not exist" end if end tell it is working perfect well on Mac os x 10.6.x (LION) but when I try to run this script on Mac os x 10.5.x (snow-leopard) it is selecting file but taking too much time. Any suggestion how can I make this code work fine on both versions of Mac.