Tag Info

New answers tagged

0

I'm not sure I understand correctly - if in the third line of Your script You're checking whether ftp service is running You can use following script: #!/bin/bash launchctl list | grep ftpd if [ $? != 0 ]; then IPADDR=$(ifconfig -a | perl ...


1

Like this say "some long text here" without waiting until completion


0

There's two problems with the above plist. You've put the program in the ProgramArguments key. Replace the ProgramArguments key with the Program key and the array with a string. You can't use ~ in a Launch Agent plist. Replace the ~ with the absolute path.


0

You can do this by getting Terminal to run the line of AppleScript: set myscript to "say \"some long text here\"" ignoring application responses tell application "Terminal" do script "osascript -e " & quoted form of myscript end tell end ignoring


0

One non-applescript solution to your problem may be to open the Terminal Preferences... select Settings. Then, under the Window tab select the Command Key check box. This will add a command key to the title bar to instantly switch to that window (so Window titles would have ⌘1, ⌘2, etc. appended to the window title.


0

I've haven't an OSX up my sleeve but I think the problem is : ^C is not like Ctrl+C. What you are looking for is : keystroke "c" using control down edit: Was too slow :3


1

^C is not a valid keystroke. Use: tell application "System Events" keystroke "c" using control down end tell


1

To keep restarting the job on succesful exit You can use launchd on OSX. For this You have to prepare *.plist file in order to "tell" launchd how to behave. To restart application on succesfull exit please look at KeepAlive -> SuccessfulExit key (more info: ...


0

After curl http://theurlwiththexml.com: sed -n 's,.*<ImageStuff>\(.*\.png\)<.*,\1,p'|xargs -I, curl http://url1.com/, -o , sed -n disables printing, \( and \) are a portable way to specify groups, and p prints the pattern space. xargs -I specifies a replacement string and curl -o specifies an output file. Or using xmlstarlet, parallel, and ...


0

This code works great. Please pay attention to "radio group 1" part. Took me several hours to figure that out. :-/ tell application "System Preferences" activate set current pane to pane id "com.noodlesoft.Hazel" end tell tell application "System Events" tell process "System Preferences" set frontmost to true click radio button ...


0

You can reference the files like this: set myPath to (path to library folder from user domain as text) & "Keychains" tell application "Finder" to get files of folder myPath


1

Add the following to your crontab (run env EDITOR=nano crontab -e to edit your crontab): @daily /usr/bin/osascript -e 'tell application "Finder" to delete (every file of folder "Macintosh HD:Users:username:Downloads" whose name starts with "message" and modification date is less than (get current date) - 2 * days)' Untested as I have no such files on my ...


0

To get information about UI elements in Accessibility Inspector, you just need to hover the mouse over whichever UI element you want to know more about. For the purposes of closing this security warning, you need to be able to identify which button and which window. So if you hover the mouse over the title bar of the window you can see the AXValue is ...


2

If you had an alert dialog appearing with an OK button, then this AppleScript code would close it. tell application "System Events" to tell process "Safari" if exists (button "OK" of window 1) then click (button "OK" of window 1) end if end tell You'll likely need to customise this to fit your exact situation. If the alert dialog appears ...


0

tell application "Microsoft Outlook" set topFolder to mail folder "AT&T" of on my computer set destFolder to folder "Deleted Items" of topFolder set srcFolder to mail folder "Deleted Items" of on my computer set selectedMessages to messages of srcFolder repeat with theMessages in selectedMessages set thisAccount to account of ...


0

Okay, so I've found a solution using AppleScript, it's a fairly big script but it's not actually all that complicated; it simply loops through the mailboxes of every count, skipping any specified in a list, and looks for read, undeleted messages older than the specified number of days. on run arguments # Don't run if Mail isn't open if application ...


1

I highly recommend the app SelfControl: http://selfcontrolapp.com You can use either a whitelist or a blacklist of websites and you can set it for a specified time limit. It's great for either blocking the sites you know will tempt you, or allowing only certain sites you know you'll need. You can also edit the hosts file at /private/etc/hosts to block ...


1

You can use Keyboard Maestro: Repeat script with 'is disconnected'. You may need to change the USB device name. AppleScript from shell script: Toggle Natural scrolling from command line with reload


0

One option is a third party product like the one discussed here or the free SleepWatcher. Another option is to write a script to query the status using ioreg. Here is snipset from code that I found elsewhere sometime ago... set Cap to (do shell script "ioreg -w0 -l | grep ExternalChargeCapable") tell Cap to set {wallPower} to {last word of paragraph 1} if ...


0

A solution was posted at https://discussions.apple.com/message/23989931: property theSavedValues : {"Mission Control", "Desktop", "Dashboard", "Launchpad"} -- for example tell application "System Preferences" activate set current pane to pane id "com.apple.preference.expose" tell application "System Events" tell window "Mission Control" ...


0

AppleScript - Remove Files Added 5 Minutes Ago Elaborating on Lri’s answer, you could create a script that takes files that were downloaded 5 minutes ago and move them to the trash with a script like this (using Date Added sorting in Finder): set dirSel to path to downloads folder set timeInterval to -5 * 60 -- 1 measured in milliseconds e.g. -1*60 = 1 ...


0

You can do this multilpe ways, one is to use applescript to do a 'for each' loop. Take this applescript code snippet as an example and work it out from there. on adding folder items to this_folder after receiving these_items repeat with an_item in these_items tell application "Adobe Photoshop CC" activate open an_item ...


0

The main Problem is that Apple Script Editor doesn't know any of the Names "App" nor "App 2" so if you run the script it asks you to select where App is stored and then replaces "App" with the Actual Name of the Application. This also happens for "App 2". So if you two times select the same Application (which is what you're trying to do, according to your ...


0

The file is the LauchServices plist file. It is at ~/Library/Preferences/com.apple.LaunchServices.plist You can edit it manually, or is you plan to do this a lot, I'd suggest looking at RCDefaultApp which gives a preference pane for editing.


1

You can avoid the problem at compile by dynamically choosing the apps in system events. tell application "System Events" set App1 to (first process whose name is "App") tell App1 set frontmost to true set position of window 1 to {8, 22} end tell end tell Then do the same for App2.


1

For reading a text file of hostnames into an AppleScript list, see Read textfile into list in Applescript. For looping over hostnames within your AppleScript list see An AppleScript list iterate/loop example: set myList to {"Hello", "Goodbye", "I must be going"} repeat with theItem in myList say theItem end repeat do shell script To avoid launching ...


2

First thing is that the rating value is just stored as "rating". But iTunes stores the star rating as a value between 0 and 100, so you need to convert from that value to the number of stars. There might be a smarter way to do this but this code seems to work. tell application "iTunes" set theTrack to (item 1 of (get selection)) set theRating to ...


1

I just hacked together this little tool. https://github.com/vorgos/QuickGrab It is a command line tool that will capture the top most active window or any window you specify just like the -l option in the newer version of screencapture. Hope that helped.


0

Depending on your needs, this can be applied to specific folder/mount points and is great to use when mounting a USB flash drive for example... http://www.jbmurphy.com/2011/07/15/os-x-running-a-script-when-a-usb-drive-is-inserted/


0

I was browsing the same thread you linked to and also found that none of the answers worked. However I was able to modify Philip Regan's solution to work with my Mac OS version (10.9.3). Here is the modified solution. tell application "System Preferences" to set current pane to pane "com.apple.preferences.sharing" delay 1 tell application "System Events" ...



Top 50 recent answers are included