Tag Info

Hot answers tagged

4

You won't be able to do it in AppleScript : Safari only does something on open windows. You should definitely look at Command line scripts like curl. The AppleScript to call a shell command takes the form: set variableName to do shell script "command" So using your AlertURLString you'd want something like: set curlOutput to do shell script "curl '" ...


2

Instead of telling System Events to restart, tell Finder. tell application "Finder" restart end tell


2

You are not referencing the file correctly. Try tell application "Finder" to set myFile to file "Macintosh HD:Users:scott:Dropbox:Downloads:AppleScriptFinderGuide.pdf"


1

To ping multiple hosts with the red/green feedback image you need to run multiple instances of the ping geeklet. Just open ping.glet multiple times, enter a different host name each time and line them up on your screen to get the effect seen in the screenshot at the site you linked. You can rewrite the script to ping multiple sites but you'll only get one ...


1

You want to read up on loops in bash scripts. For example: HOSTS="hosta hostb hostc" for machine in $HOSTS do PING=`ping -q -c 1 $machine` if [[ $? -eq 0 ]] ; then TIME=`echo $PING |tail -1 | cut -d/ -f 5` echo ${TIME}ms away from $machine else echo $machine could not be reached fi done I didn't test that, but it's close enough. ...


1

This looks like a bug. I've tried rewriting the script various ways but the change only seems to take effect for new windows. So here is a horribly hacky way to get this to work. tell application "Finder" tell list view options of window 1 tell column kind column if sort direction is normal then set sort direction to ...


1

It seems the issue isn't with AppleScript, but with Script Editor, after confirming it with a back and forth with an Apple engineer. I'm still not convinced of why this should be the case, but the script runs a lot better when run via osascript, especially after refactoring it to use a whose statement when fetching messages, rather than iterating over them ...


1

To bring the contents of Mateusz's comment here in an answer. Credit to Camelot for the steps. The AppleScript log statement does not write to the StandardOutPath. Writing to a log file takes 3 steps. The second step may take 2 forms depending of wether you want to save previously written data. -- Open the log file set logFile to (open for access POSIX ...


1

What about this answer by user markhunte: http://stackoverflow.com/questions/20444904/terminal-command-to-open-new-safari-window You can place the below function with the osascript code in your .profile code: function Safari { # Will open a New Safari window with argument 1. osascript <<EOD tell application "Safari" to make new document with ...


1

Here is an AppleScript that should help you. Open AppleScript Editor and save this as a script. I have modified the source that I found here to support taking arguments on the command line. Use it like this: osascript new_window.scpt http://www.google.com http://www.stackoverflow.com Of course, replace the URLs above with your own URLs. ...


1

It's been a while since I played with Applescript, but I think it's just 'window 1' [without quotes] for the frontmost window.


1

Have a look at http://stackoverflow.com/questions/18136567/applescript-keystroke-not-behaving-as-expected & the list of ANSI codes at How do I automate a key press in AppleScript? It appears you're not the only one with the issue. One solution on there was to use the key code instead... tell application "System Events" key code {18} using ...


1

No i'don't think you can do this the way you want. Every Human interaction on a PC during Screensaver tries to deactivate it. (Like moving the Mouse, pressing a Key e.g.) Applescript most time is used to Script some GUI (like in your case --> tell application TextEdit -> does nothing other than opening Textedit like you would do it by double clicking) ...


1

There is a hidden error that is generated when you run your "working" script... You have to bump the shell script part of the code into its own tell current application block as shown in the second example below... This version works for me with creating a TextEdit document: global presenterNotes tell application "Keynote" activate -- open (choose ...


1

It seems that even though the UI Element shows up as radio group in 'Result', you need to specify radio group 1 for the click command to work.



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