Tag Info

Hot answers tagged

7

I can see a couple of things wrong there. Firstly you have opened a workflow and not an Application. You should choose Application when you make your selection for the type of Automator file. And the code you have will not work as you expect, since you have not changed directory. (cd). In the code as you have it, all it is doing is getting the path as ...


4

You cannot. JavaScript for Automation was only introduced in OS X 10.10 Yosemite. AppleScript Editor.app was also renamed to Script Editor.app due to it now not only being for AppleScript.


4

Can you change run.sh to run.command and get the user to double click it?


3

Short answer message: URLs are persistent, but Mail needs to be restarted so that its message ID database gets updated and the URLs are properly resolved. You will have to restart Mail before using BusyCal. Alternatively, you could restart Mail in your script. Long answer After some tests I noticed that: message IDs don't change when a message is ...


3

AppleScript to Expand Text The following AppleScript snippet adds a space between each character of a string. Copy and paste this code in Applications > Utilities > Script Editor to try it out: set myText to "hello world" set myResult to "" repeat with c in every character in myText set myResult to myResult & " " & c end repeat display dialog ...


3

Path to Script In your AppleScript, you need to change the current working directory (cwd) before issuing the java command. Do this with an AppleScript line like: do shell script "cd " & quoted form of (POSIX path of file_path) & " && java -jar app.jar" The && is important. If the cd succeeds, the java command will be launched ...


2

The error you're getting is related to the sudo command. You're probably trying to run the script as the normal administrator. Instead, you can run it directly as root.


1

Take a gander at this page. It has a few examples on how to write variables to a file.


1

To have the selected text converted to upper case, along with having a space added between each character, add the following line to the script posted by Graham Miln. set myResult to do shell script "echo " & quoted form of (myResult) & " | tr [:lower:] [:upper:]" So in Automator it would be: on run {input, parameters} set myText to input as ...


1

You want unix id. Like this... tell application "System Events" to get unix id of every process PS: Realize that not all "windows" returned by your original code are visible. So depending what you are trying to do you may want to also look into http://stackoverflow.com/questions/14551419/listing-all-windows-of-all-applications Google will give you ...


1

Not being clear as to what you are trying to do, maybe what you are looking for is a named pipe. You create one like this... mkfifo mypipe and you could listen or consume what comes down the pipe like this... tail -f mypipe you can now send data down the pipe from applescript like this... on timeStamp() return (current date) as string end ...


1

Personal Dropbox does not work in this fashion, as it causes open preference file conflicts, thus the hang on the startup of the second instance. You must login and logout of each personal Dropbox account to use them individually, or used shared folders for common files. You can also have two Dropbox accounts open in different web browser windows. If you ...


1

Well you can ask Finder for its windows. The order returned is topmost to bottommost. If you have a specific window you want, and know its name then just ask it to activate... tell application "Finder" set w to (name of every window) set i to (id of every window) tell window named "Desktop" to activate get front window end tell And the ...


1

There are two approaches to solving this problem. One is to use JavaScript for Automation (either by putting your AppleScript into an Automator workflow and then using a separate Run JavaScript action, or by re-writing the entire script in JXA), while the other is to use the sed and cut command line utilities via do shell script. Here's the JavaScript ...


1

Rename your .sh file to .command and you can cd to the directory that the .command file is located in with the following at the beginning of the file: cd "$(dirname $BASH_SOURCE)"


1

allEmails is a list that contains several lists, each sublist contains emails of a contact. email is an object, you need to get the value of this object. So, you need a loop for each list, and another loop for each value. tell application "Contacts" set myList to value of emails of people end tell repeat with aList in myList repeat with anEmail in ...


1

Are you sure you have something at the other end of that named pipe actually accepting the data? "do shell script" will not exit until something actually tries to read from the pipe. If you want to work around this, you can use: do shell script "sh -c \"echo " & currtime & " > " & aname & "\" &> /dev/null &" This will keep ...


1

I believe OP has two separate Dropbox accounts and wants to have both running simultaneously. This means running two instances of Dropbox. Dropbox themselves do not support this (why should they?) so there are various workarounds. I used a similar script (run in bash shell) to OP's for several years on Snow Leopard without any issues: ...


1

Here is a shell script that will do what you want - for both Apple's Terminal or iTerm (we have users of both). For your tabs that you open, this will execute another batch file in each tab, such as one for tomcat, one for you db, etc. #!/bin/bash function tab () { local cmd="" local cdto="$PWD" local args="$@" if [ -d "$1" ]; then ...


1

So the following script will send the text to the pipe, in the background, and if the background job does not exit after a second it will kill it. This should stop the script from blocking... #!/bin/sh echo $1 > $2 & sleep 1 # Following is necessary. Seems to need it or # job will not complete! Also seen at # ...


1

Unfortunately Applescript does not offer a way to get a list of applications ordered by when they were last used - like when you press CMD-Tab. Fortunately, somebody found a bit of Objective-C code that does get that information. I've wrapped it up and created this little command link tool that prints all the applications in order. Now it is easy, a matter ...


1

Before you try running a non-trivial script using osascript, first try compiling it (and running it, if feasible) in Script Editor. When I compiled your script in Script Editor, it revealed that your script is trying to use the term custom title—a Terminal-specific term—without targeting Terminal, so the term isn't available. Extend your first line, tell … ...



Only top voted, non community-wiki answers of a minimum length are eligible