applescript

Associate a shell script (starting a Java JAR) with a file extension in a Mac application bundle

北慕城南 提交于 2021-02-08 11:48:42
问题 To run a Java8-JAR archive on Macs with a higher Java version I pack the jar into an APP bundle (stuff.app) together with a bash-script, let's call it stuff.sh (edit: removed "-cp" argument, inserted echoing command line arguments): #!/bin/bash VM_ARGS_A="--add-modules=java.xml.bind" # Set the working directory DIR=$(cd "$(dirname "$0")"; pwd) APP_JAR="some-java-stuff.jar" APP_NAME="Some Java Stuff" APP_ICNS="stuff.icns" #test: set command line args STUFF_TITLE="Launching $APP_NAME" STUFF

Associate a shell script (starting a Java JAR) with a file extension in a Mac application bundle

荒凉一梦 提交于 2021-02-08 11:48:04
问题 To run a Java8-JAR archive on Macs with a higher Java version I pack the jar into an APP bundle (stuff.app) together with a bash-script, let's call it stuff.sh (edit: removed "-cp" argument, inserted echoing command line arguments): #!/bin/bash VM_ARGS_A="--add-modules=java.xml.bind" # Set the working directory DIR=$(cd "$(dirname "$0")"; pwd) APP_JAR="some-java-stuff.jar" APP_NAME="Some Java Stuff" APP_ICNS="stuff.icns" #test: set command line args STUFF_TITLE="Launching $APP_NAME" STUFF

AppleScript used in my cocoa mac app, stopped working in osx 10.14

允我心安 提交于 2021-02-08 09:19:38
问题 I have used AppleScript to get selected text from third party app. Which is working fine in osx 10.13 but stopped working in osx 10.14. From searching, got one suggestion to add "NSAppleEventsUsageDescription" in info.plist, but that is also not working for me. let latestApp = "Safari" //Write script to activate the app and get the selected text to our app let script = """ tell application \"\(latestApp)\" activate end tell tell application \"System Events\" tell process \"\(latestApp)\"

Trigger a script (AppleScript or JXA) on .app running?

醉酒当歌 提交于 2021-02-08 06:33:13
问题 I have a small computer lab for students to use fairly unsupervised, with a printer attached on the network. I am trying to implement a simple scripting additions alert dialog with all the rules about the printer that I need to pop up when they select print from any number of different applications. I am trying to attach the script directly to the printer itself in the User/Library/Printer directory, (xxx.xxx.xxx.xxx.app) so any browser, or pdf viewer, etc. will get the message displayed when

Simulated key command not working since OS upgrade

随声附和 提交于 2021-02-08 04:01:21
问题 I considered posting this to Ask Different but I thought it belonged here due to being mainly focused on code. I have created a macro on my mac for switching spaces, and since upgrading to Sierra the following AppleScript is no longer working. Does anyone know if something has changed? tell application "System Events" to key code 124 using control down and tell application "System Events" to key code 123 using control down This is the output when running in terminal (note the ^[[1;5D ): 14:16

Can't figure out how to implement REGEX with AppleScript

半城伤御伤魂 提交于 2021-02-08 04:00:32
问题 I wrote a regex command to find and output the first instance of a line of digits in a string: find: ^[^\d]*(\d+).* replace: $1 The problem is that in order to actually utilize this in AppleScript, the only way I know of doing this is with calling a shell script and using sed. I can't figure out how to actually use my regex in this way. I've tried for hours without any luck. This is as close as I can get, but it returns ALL the numbers in a string, rather than the first group of numbers: set

Running script with admin permissions on OS X

≡放荡痞女 提交于 2021-02-07 19:56:19
问题 I've tried my best to find out a solution with the many script questions on Stack Overflow and the internet, but I can't seem to find the solution I need. What I want to do is create a more automated and less clicking solution to remove all the Mobile cached user accounts on a system. I've been logging in and manually going to user accounts and removing the users one at a time by clicking the "-" button, then clicking "Delete Immediately" for the user data. This works, but is time consuming

Running script with admin permissions on OS X

萝らか妹 提交于 2021-02-07 19:51:57
问题 I've tried my best to find out a solution with the many script questions on Stack Overflow and the internet, but I can't seem to find the solution I need. What I want to do is create a more automated and less clicking solution to remove all the Mobile cached user accounts on a system. I've been logging in and manually going to user accounts and removing the users one at a time by clicking the "-" button, then clicking "Delete Immediately" for the user data. This works, but is time consuming

How to run an AppleScript from within a Python script?

别说谁变了你拦得住时间么 提交于 2021-02-07 12:46:21
问题 How to run an AppleScript from within a Python script? The questions says it all.. (On a Mac obviously) 回答1: this nice article suggests the simple solution cmd = """osascript -e 'tell app "Finder" to sleep'""" def stupidtrick(): os.system(cmd) though today you'd use the subprocess module instead of os.system , of course. Be sure to also check page 2 of the article for many more info and options, including appscript. 回答2: A subprocess version which allows running an original apple script as-is

Find Mac OSX version installed using AppleScript

萝らか妹 提交于 2021-02-06 23:58:39
问题 How can I find which version of OSX is installed on my Mac by using AppleScript? I want to install an app programatically and run different pkg files based on the version. Thanks 回答1: I'm not on a Mac, so there may be a better way to do this, but the first approach that comes to mind is just executing a shell command to query the OS version. http://developer.apple.com/technotes/tn2002/tn2065.html#TNTAG2 http://developer.apple.com/DOCUMENTATION/Darwin/Reference/ManPages/man1/sw_vers.1.html