Tag Info

New answers tagged

0

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 # ...


0

There are a couple of things. First you will need a delay between the Activation of the App (Firefox) and the click action. If you do not,the click action will be fire way too soon for the application to pick it up. Secondly, in my FirfFox the Zoom in Menu item is under the View menu. So the code needs to work back from the Zoom in menu item back to the ...


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 ...


0

Here is a quick something to get you started. If you also want the filename changed too, then it is easy to add in the copy section... set dpath to "/some/path/some/where/" set qdpath to quoted form of dpath # Choices of apps to use depending what files you have # mp3 set tapp3 to "/usr/local/bin/id3v2 -t " # m4a set tapp4 to "/usr/local/bin/mp4tags -s " ...


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: ...


0

You can try launching "SelfControl" in the background, then hiding it (although, simply launching in the background may be enough in your case). The idea is to hide the application once a window appears, indicating the launch process is mostly done, and the application can be hidden (which takes a few seconds. I generally shy away from using arbitrary delays ...


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

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

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)"


0

Applescript to Create Contacts: set phoneDad to "Dad Mobile" --Use your own custom variables imported from CSV -- would need to parse CSV tell application "Contacts" set thePerson to make new person with properties ¬ {first name:"John", last name:"Doe", organization:"ABC Apps"} ¬ -- see the "Contacts" AppleScript ...


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 ...


0

Thanks for the reply @aaplmath, I actually just found the needed addition which is what you have and it does the job! | grep SMBHome: | cut -c 10- | sed 's/\\\\/\\//g' " Thank you for your input!


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 ...


0

My experience is that you can no longer define an AppleScript applet as the default handler upfront by the Info.plist. And, if you try, by including LSIsAppleDefaultForScheme in your Info.plist, that applet will no longer even be allowed as a handler for the URL type at all. After upgrading to Yosemite, my applet would no longer be called when I clicked a ...


0

Its hard to know exactly what you are trying to accomplish but some improvements were introduced into the code below, with comments added in the code. Several points: Note that depending on how fast/slow your system is responding you may need small delays after every keystroke or action. You'll have to figure the minimum time empirically. Any time you ...


0

So here is some final code that works for all windows, Finder and otherwise. Note the 4 second delay to switch to your window of interest is required. Without it the AppleScript Editor will always be frontmost. tell application "System Events" display dialog "Click OK, then immediately click on the target window. Whichever window is highlighted at 4 ...


0

Here is my take on what I understood you are trying to accomplish. The code is long winded on purpose. All you need to do is copy the code to the Applescript Editor, make any changes you want and save it as an application. As for the dialog about PowerPC application not supported, I don't know. Can you run it from the command line? I would check that to ...


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

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

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

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 ...


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.


0

Works for me, but I had to set volume 6 to make it audible. "Big mistake" should be "Big mistake " -- that space matters.


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

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


1

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


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

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 ...


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

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 ...


0

Power Manager If you are happy to use a third party application, Power Manager can do exactly what you want. There are lots of recipes to help create your schedule. For your situation: Create a Scheduled Power On/Start Up Create a Scheduled Application Launch By default, Power Manager will power on a sleeping Mac to perform scheduled events. The recipe ...


0

Turn you screen fully bright. Open Terminal, type nvram backlight-level. Note the value. Create a logout hook to run nvram backlight-level=<value>. In my case the value was backlight-level %a0%06.


0

Here's code that will wait an amount of seconds before quitting the current application and going to sleep. delay (your amount of seconds here) tell application "System Events" key down {command} keystroke "q" key up {command} set volume "1" say "computer going to sleep" tell application "Finder" sleep end tell end ...


0

@ArtemG. then I assume that this operation could be done by editing the playlist file that is loaded by iTunes. It should be located in ~/Music/iTunes/ Information is according to the posts marked as helful over here (https://discussions.apple.com/thread/2439817)


0

Try this... tell application "iTunes" set iSel to selection set n to 1 repeat with trk in iSel set track number of trk to n set n to n + 1 end repeat end tell


0

Change the line, set imageName to the file name of imageItem to set imageName to the name of imageItem and it should work. EDIT: Couldn't help but notice that you are not quoting your file names. If any of them contain spaces, then you will have problems. Best to also change set concatFiles to concatFiles & " " & imageName to ...


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 … ...


0

I actually found a really simple solution to this problem: delete the play button entry from USB Overdrive and then it won't overwrite the behaviour and everything is as it was for that one button. Interestingly, this the play key is referred to by Karabiner as ConsumerKeyCode::MUSIC_PLAY. See https://pqrs.org/osx/karabiner/xml.html.en.


0

It appears that there is a Gist on GitHub using USB Overdrive and a Windows Keyboard that addresses how to map the media keys the way you want to. Configure media keys on a non-Apple keyboard to control Spotify via AppleScript and USB Overdrive on OSX. If you scroll down to ludalex addition to the Gist, they have added an Applescript that can identify ...


0

You need to use a tool that can write a plist such as defaults. defaults write ~/Desktop/gametocheat/my.cheat.preference '{ "Filter" = { "Bundles" = (foo); }; }';


1

Try the following: set cheat1 to the quoted form of text returned of (display dialog "Enter Cheat" default answer "99 Gold, super health, unlimited Grenades..") set newText to quoted form of "I am now adding a few test lines" do shell script "echo " & newText & " >> ~/Desktop/test.txt" do shell script "echo " & cheat1 & " ...



Top 50 recent answers are included