applescript

Make MIMETYPE file the first file in an EPUB ZIP file?

て烟熏妆下的殇ゞ 提交于 2019-12-08 18:39:30
My goal is to create an EPUB file via an AppleScript, and I'm starting with semi-manually generating an EPUB file. My issue is that the IDPF EPUB validator reports that my MIMETYPE file isn't isn't the first file in my EPUB package or that my MIMETYPE doesn't exist. My AppleScript is creating the EPUB folder structure and a MIMETYPE file: set EPUBMIMETYPEfilepath to ((EPUBfolderPath & ":MIMETYPE") as string) set referenceToEPUBMIMETYPEfile to a reference to file EPUBMIMETYPEfilepath open for access referenceToEPUBMIMETYPEfile with write permission write "application/epub+zip" to

How do I determine whether Growl is running using AppleScript?

人盡茶涼 提交于 2019-12-08 15:44:37
I the past, in order to determine whether the Growl helper is running on macOS, I've used tell application "System Events" set isRunning to (count of (every process whose bundle identifier is "com.Growl.GrowlHelperApp")) > 0 end tell But recently, both this and an alternative thats been suggested tell application "System Events" to set isRunning to exists (processes where name is "com.Growl.GrowlHelperApp") just run forever. This seems to happen (only) when it (or more precisely the app "Hardware Growler" is not running), but is still clearly not the desired outcome. How do I determine whether

How to I tell this Applescript to skip some files?

走远了吗. 提交于 2019-12-08 13:50:16
问题 Im, using an Applescript to bashconvert a whole bunch of mv4 files to 640x480 using Handbrake CLI. I have a applescript I found somewhere changed to my parameters, and it works great. But to save time, I want the script to skip files that are already 640x480, since not all files need conversion. How would I go about that? Here´s the script: --on adding folder items to this_folder after receiving these_items with timeout of (720 * 60) seconds tell application "Finder" --Get all m4v files that

Using AppleScript to Move Mail Messages to Trash

血红的双手。 提交于 2019-12-08 13:14:55
问题 I've written a script that is invoked by a Mail rule. I want the script to move messages to the trash under certain conditions. It didn't work so I've commented out the test and it still didn't work. I got the code from an online tutorial. The tutorial moved the message to "Filed". The rule itself worked when I replaced the call to the script with a move to the trash. Here's what I'm testing: using terms from application "Mail" on perform mail action with messages these_messages for rule this

AppleScript path relative to script location

元气小坏坏 提交于 2019-12-08 13:02:44
问题 I'm trying to launch a Finder window of a folder that's in the same directory as my script. When I run the code below, it launches a blank Finder window set to the path of the script not to the folder. tell application "Finder" tell application "Finder" to make new Finder window set file_path to (path to me) as text set target of Finder window 1 to file_path end tell How can I get the path to the folder of the script, not the script? 回答1: You were close. You do not need the text version of

AppleScript to force quit Java (JAR) programs?

泪湿孤枕 提交于 2019-12-08 13:00:03
问题 Hello, I run a Java (jar) application on MAC OS. I am using an AppleScript to run the Java program and it works fine. Now, I like to use an AppleScript to close the Java program. I need to Force Quit the Java program. I used the following AppleScript, set app_name to "NPC" set the_pid to (do shell script "ps ax | grep " & (quoted form of app_name) & " | grep -v grep | awk '{print $1}'") if the_pid is not "" then do shell script ("kill -9 " & the_pid) The AppleScript that runs the Java program

AppleScript aborts execution after moving a mail message?

有些话、适合烂在心里 提交于 2019-12-08 12:48:19
问题 I'm using the following script with a Mail.app rule. It seems that on my computer the code isn't being executed after moving the message to the Trash mailbox. (adayzdone below reports it works for him). How can I identify the reason for this and solve it? using terms from application "Mail" on perform mail action with messages theMessages repeat with eachMessage in theMessages set theText to content of eachMessage -- -- ... here happens some processing -- -- this works: move eachMessage to

Finder application hangs / freezes sometimes when applescript is executed

给你一囗甜甜゛ 提交于 2019-12-08 12:35:25
问题 I am an applescript beginner and I am trying to automate some processes in the Finder. My script includes some simulated mouseclicks (cliclick), key codes and keystrokes to navigate through the Finder application. Sadly, in some cases the Finder application kind of freezes. As soon as i click on anywhere manually, Finder is running again but suddenly all the key codes, keystrokes etc. are executed at once without delays, leading the script to mess up the actions. I know that the answer or

applescript can't delete any mailbox

杀马特。学长 韩版系。学妹 提交于 2019-12-08 12:26:45
问题 how to delete a mailbox? tell application "Mail" delete mailbox "complaints" of account "ACME LLC" end tell gives me error "AppleEvent handler failed." number -10000" MacOs Sierra 10.12 It is not a problem of file permission because renaming mailboxes works fine 来源: https://stackoverflow.com/questions/39938557/applescript-cant-delete-any-mailbox

Applescript Mojave Toggle Accessibility Grayscale On/Off

天大地大妈咪最大 提交于 2019-12-08 12:13:14
问题 I have a script I run periodically to toggle grayscale on/off with Applescript. It runs fine on High Sierra but throw an exception when I use it was Mojave. tell application "System Preferences" reveal anchor "Seeing_Display" of pane id "com.apple.preference.universalaccess" end tell tell application "System Events" to tell process "System Preferences" delay 0.5 # Needed or else script fails set theCheckbox to checkbox "Use grayscale" of window "Accessibility" tell theCheckbox # If the