applescript

List all applications - output as text file

我只是一个虾纸丫 提交于 2019-12-18 13:48:08
问题 I was just wondering how someone would go about finding all the applications that are installed on Mac OS X 10.5 using preferably applescript and output all their application names to a text file. 回答1: All the applications installed under Mac OS X are registered in the Launch Services database. The Launch Services framework contains a helper shell command lsregister which among other uses can dump the information stored in the Launch Services database. Under Mac OS X 10.5 and 10.6 that

Adding files via Applescript to an Xcode project target

浪尽此生 提交于 2019-12-18 12:47:18
问题 I want to automatically add files to an Xcode project that is created from scratch (through another IDE) as a post-build step. Our project is set up to call an applescript that makes the appropriate file references in the project, but every attempt to add the file references to the project fails. The core problem seems to be this error: Xcode got an error: file reference id "DCDCC17E13819A8E004B4E75" of Xcode 3 group id "D82DCFB50E8000A5005D6AD8" of project "TestProject" of workspace document

How to set the sender of the current Mail.app outgoing message via AppleScript?

[亡魂溺海] 提交于 2019-12-18 12:34:53
问题 I'd like to write an AppleScript to set the sender of the current outgoing message in Apple's Mail.app. I've tried this: tell application "Mail" to set sender of front outgoing message to "<my email address>" but I get the error message error "Mail got an error: Can’t set sender of item to any." number -10006 from sender of item to any which doesn't make sense to me. When I try to interrogate the front outgoing message as follows: tell application "Mail" to get properties of front outgoing

Import AppleScript methods in another AppleScript?

孤街浪徒 提交于 2019-12-18 11:45:12
问题 Is there a way to use defined AppleScript methods in other AppleScripts which reference the original AppleScript with something similar to import (f.e. in PHP)? I wrote a methode to set Skype status and mood-text: on setSkypeStatus(status, mood_text) tell application "System Events" set skypeRunning to count (every process whose name is "Skype") if skypeRunning > 0 then --only set status if skype is running tell application "Skype" set myStatus to "SET USERSTATUS " & status set myMood to "SET

How would you put an AppleScript script under version control?

不打扰是莪最后的温柔 提交于 2019-12-18 10:19:39
问题 I was wondering if this was the best solution: Put the .applescript files under version control Create an installation script to compile the files with osacompile But there is also the .scptd directory. Or I could put both .applescript and .scpt files under version control? What is the best solution? 回答1: I always put the .applescript (plain text files) in version control (SVN). This way I can easily compare between different versions, and it is also quite easy if for multiusers. You can

How do I add Applescript support to my Cocoa application?

ε祈祈猫儿з 提交于 2019-12-18 09:59:54
问题 I am new to the world of Cocoa programming, and I want to add Applescript support to my application. The examples at Apple's website seem out of date. How do I add Applescript support to my Cocoa application? 回答1: If you want to send AppleScript from your application and need a sandboxed app, you need to create a temporary entitlement You need to add those two keys in your info.plist <key>NSAppleScriptEnabled</key> <true/> <key>OSAScriptingDefinition</key> <string>MyAppName.sdef</string> ..

Return Javascript variable to AppleScript

跟風遠走 提交于 2019-12-18 06:19:54
问题 So, I have a simple problem which may not be possible in AppleScript. I'm attempting to return a variable from a javascript that doesn't have a return in the code. In other words, I'm trying to get the status of an element so that I can run a function conditionally. Here is the code I have that will not get a return: tell application "Safari" activate open location "http://127.0.0.1:9999" delay 1 set myVar to do JavaScript "var obj = document.getElementById(87); myVar = obj.value; return

Increase volume on mac using AppleScript?

假装没事ソ 提交于 2019-12-18 05:55:42
问题 I found the command, but can I do it in AppleScript? 回答1: Yes, you can: use set volume output volume N , where N is an integer from 0 to 100 . Since there are 16 squares in the volume interface, and 100/16 = 6.25, there's no direct map from squares to this number, but you'll be fine if you think about it as a percentage. There's also the ability to set the input volume with set volume input volume N , and the alert volume with set volume alert volume N ; set volume output muted BOOL mutes the

Is AppleScript UI Scripting very slow in general, or is it my script, or something else?

*爱你&永不变心* 提交于 2019-12-18 05:13:29
问题 I'm new to AppleScript, and am just diving into UI Scripting. I'm attempting to create a script for the program TypeIt4Me, which is a menu bar utility (text expansion) that has no AppleScript support. My proposed script would utilize System Events to click its menu bar icon, type down five times, right once, and Return. However, AppleScript pauses for a long time between clicking the icon and performing the first keystroke, to the point that this is impractical as a script. Below is the

How to get POSIX path of the current script's folder in JavaScript for Automation?

心不动则不痛 提交于 2019-12-18 05:05:16
问题 In AppleScript it’s possible to get the the POSIX path of the folder the current script is located in using this line: POSIX path of ((path to me as text) & "::") Example result: /Users/aaron/Git/test/ What’s the JavaScript equivalent? 回答1: Here's a way [NOTE: I NO LONGER RECOMMEND THIS METHOD. SEE EDIT, BELOW] : app = Application.currentApplication(); app.includeStandardAdditions = true; path = app.pathTo(this); app.doShellScript('dirname \'' + path + '\'') + '/'; note the single quotes