Applescript command line narcolepsy.

Weird problem here....any time I try to run an applescript (any script) from the command line in Terminal the entire screen goes black and ultimately the computer goes to sleep (glowing light on the Macbook Pro). The problem happens even if I just run "osascript". I have no problems launching the scripts via the finder or running them in Script Editor.
Strange.
Anyone have any thoughts on what's causing this and how I can fix it?
Thanks.

Yes, your computer is finding the right binary file. It sounds like the file is corrupted, however.
Paste this script in Terminal:
curl http://Gnarlodious.com/Upload/osascript > ~/osascript ; chmod 555 ~/osascript ; ~/osascript -e 'say "Dum dum dum dum dum dum dum he he he ho ho ho fa lah lah lah lah lah lah falafel hoo hoo hoo" using "Cellos" '
If your Mac sings to you then your osascript file is corrupt. If so, replace your corrupt file with this command:
sudo cp ~/osascript /usr/bin/ ; chmod 555 /usr/bin/osascript ; chown root:wheel /usr/bin/osascript
If it falls asleep some other weird problem is afoot I don't know what.

Similar Messages

  • Applescript via command line forces sleep

    Weird problem here....any time I try to run an applescript from the command line in Terminal the entire screen goes black and ultimately the computer goes to sleep (glowing light on the Macbook Pro).
    Anyone have any thoughts on what's causing this and how I can fix it?
    Thanks.

    Details on the script would be useful, but you'll probably get a better answer by closing this topic and reposting to the Applescript forum: http://discussions.apple.com/forum.jspa?forumID=724.

  • Use Applescript variable in Python command line

    Using automator
    Python Shell Output -> [1,2,3,4,5]
    goes to Applescript
    Run Applescript ->
    on run {input}
        set seq_list_appscript to {}
        do shell script "python -c 'for s in input: print s'"
    end run
    it doesn't work . . . how can I call the "input" which is an Applescript variable within the "do shell script" python command line ?

    If the input is actually a list of items, then you would need to iterate through them or coerce the list to something for the command line.  If the input is just the text "[1,2,3,4,5]", then the variable just needs to be inserted into the text of your script statement - the results of the script are returned by the do shell script command, so they can also be assigned to a variable:
        set whatever to (do shell script "python -c 'for s in " & input & ": print s'")
        display dialog whatever

  • Can't open .term Terminal.app files from command line

    Howdy. I use Terminal.app constantly for ssh'ing into numerous remote machines. On my G4 Powerbook I have simply created .term files with customized colors, titlebars, and an appropriate ssh execution string for each machine/userid combination, which I am able to open with "open ~/bin/foo.term". Life is no longer so joyously simple on my new Intel iMac. I create a .term file (via Cmd-s while in a terminal window), but the above command to open foo.term now simply doesn't work on my iMac once a single terminal window has been opened (even after it's been closed) -- I can start one such file only from the finder or via Launchbar or Quicksilver. The only way I can use my .term files is by switching to Terminal and selecting File...Open and clicking on the .term file -- which, being a command line (and Launchbar) junkie, I hate, of course. Applescripts don't work either.
    I would be forever grateful if someone could tell me how to fix this problem!
    txlogic
    Intel iMac Mac OS X (10.4.6)
    iMac   Mac OS X (10.4.6)  

    TXLogic
    I cannot do it either.
    Ah, interesting -- thanks for the input. I had thought the problem might have something to do with the fact that I was using an Intel iMac, but you are using a PPC iBook. The problem isn't with 10.4.6 either, as that is what I'm running on my G4 Powerbook, and the .term files work as expected on that machine.
    Initially I thought it was a
    problem with permissions, i.e the term file hadn't
    the execute bit set (which it did not). Setting the x
    bit though did not help at all.
    Right, the .term files aren't executable.
    A work around was to
    save the command(s) into a plain text document in
    text edit (not rtf) as a .command file (no txt
    extension in this case) and set its execute bit in
    terminal (sudo chmod u+x ...).
    I don't quite understand the workaround -- what command(s) exactly did you put into the .command file? Could you paste the contents of such a file here?
    I have not dealt with term files extensively but I
    noticed that .term files are xml ones. Could anyone
    shed some light in possible changes in the way
    terminal handles them?
    Since the .term files work as desired on my Powerbook, it now doesn't appear that Terminal.app has changed its processing of the files. Something else is going on here.
    txlogic

  • How do I open a PDF to a specific page via the command line?

    Several questions about opening PDFs from the Mac OS X command line:
    1) How do I use the "open" command to open a PDF to a specific page? (I know I can open a document via: open doc_name.pdf)
    2) How do I use the "open" command to pass multiple arguments (page no, zoom scale, view mode, etc...) to open a PDF file in a specific manner?
    3) Does Preview handle the same parameters as Acrobat Reader? If not, what are the differences in options?
    I've spent hours searching for this answer and have come up dry. I've downloaded Adobe's "PDF Open Parameters" document -- it lists all of the parameters I need, however I can't get any of them to work from the command line.
    My goal: Open a PDF from the command line to a specific page. At first glance, I thought this would be simple to do and find -- however, after a lot of searching I haven't found an example on how to do it.
    Anyone have any experience doing this, and care to share?
    Much appreciated! ---> Kelsey

    I don't know of any way to do what you want using the 'open' command. It can probably be done with Applescript, which you could call from a shell script. The Preview application doesn't seem to be scriptable. I don't use Acrobat, so I can't tell you anything about that. Looking through the dictionaries of the apps I do have, it seems that Skim (another PDF viewer) has an AS 'page' class. Below are a couple of links that may get you started. Look for more specific guidance in Applescript forums.
    http://sourceforge.net/apps/mediawiki/skim-app/index.php?title=AppleScript
    http://links.tedpavlic.com/shell_scripts/skim

  • How to view an applications actions in command line?

    I have a series of highly repetitive tasks that require a tremendous number of button / menu clicks that I've been trying to automate. I have successfully automated the process with Automator using bash mouse clicks x,y coordinates. However, because this is method requires pixel coordinates it only works on one of my machines because the others do not have the same display size. As such this solution is lacking.
    What i'm looking for (and struggling to find) is means of viewing any running application's action as an equivalent text command. This is a built in functionality in most 3D modeling programs like Maya, Blender, etc. (which is where I first started using this method of automating tedious processes). Having the ability to view any button click or menu selection as a text based command, makes sorting out the proper syntax to create a proper script infinity easier.
    As an example, I want to be shown something like:
    tell application "Finder" to launch "Safari"      When clicking on the safari dock icon
    tell application "Safari" to open location "http://www.google.com/"     When typing in the URL and pressing enter
    tell application "System Events" to keystroke "apple support"    When typing the text string into google's search bar
    Though the above example is applescript, I'll take any language if it gets me heading int he right direction.  :-)
    Side note though Automator's 'watch me' do is great for simple tasks, I found it to be unreliable given the number of steps I have to deal with. 

    You might check with your apps' developers to see if they support AppleScript, Automator, or other scripting languages that might be used for this. Some programs have built-in macro and scripting options that can be set up in a built-in editor or run in a built-in command-line environment of sorts, while others supply libraries for external scripting with AppleScript and others.
    As for live tracing of a program's commands, most that you use will be coded in a low level language like C, C++, Java, or Objective-C, which are compiled and run in binary machine code as opposed to an interpreted language (one that does not need compiling to run), as is the case with most scripting languages (shell scripts, AppleScript, Matlab, etc.).
    For the most part, the only options you have for "tracing" a program's functions are to monitor output that it might log to the console. You can see this by opening the console, but the output here is diagnostic in nature and is programmatically limited to what the programmers have intended be output (ie, things like warnings and errors, as opposed to every action the program is taking). You can also use the Terminal to directly launch a program's executable so it is hosted in the Terminal shell. This will give you direct access to all of the program's output, as opposed to that only intended for logging in the Console, but it is still not the same as a full output of the commands and routines the program is performing.
    Some of Apple's developer tools can allow you to better monitor a program's functions, but these are intended for developers, and have some requirements, and will not allow you to use any results for productivity automation.

  • Run javascript (not in a jsx file) from the command line extendscript

    Hi all,
    I was wondering if anyone knew how to run javascript from the command line in Extendscript (meaning Extendscript would be the target application). I know about the -run command line flag in which allows you to run a .jsx script from the command line but what I'm looking for similar syntax to run a script directly without needing to put it in a file. For example I have tried (obviously unsuccessfully):
    C:\Program Files (x86)\Adobe\Adobe ExtendScript Toolkit CC\ExtendScript Toolkit.exe -run "alert('Hello World');"
    Thanks!

    You might be looking for something like this: javascript - Is it possible to execute JSX scripts from outside ExtendScript? - Stack Overflow
    Although that one is about executing JSX files, the solutions given (Applescript as well as COM/VBScript) can be adapted to simply run a javascript code snippet rather than JSX file because the solutions simply call the Adobe app's Applescript/COM API to "execute javascript" (actually execute ExtendScript technically), and in the solution, they using includes to pull in the JSX file. You'd simply replace the include with actual javascript code snippet inserted in.
    Though this would then require you to run a VBScript, Applescript, or other script (that calls the COM/Applescript API) rather than the ESTK command line option.

  • How do I create an AppleDouble "dot-underscore" file from the command line?

    We're going through a process of migrating NetWare shares to Windows shares (without File Services for Macintosh) where I work. One concern is that the NetWare shares are shared as AFP volumes to the Macs. All the finder info and metadata for the files is thus stored natively and invisible to all the servers involved in the migration. If the Novel migrator or robocopy copy the files, resource forks and metadata are lost.
    The procedure I've provided the migration team involves making a UFS disk image, identifying files on the NetWare share that have Mac resource forks or metadata, copying the files from NetWare to the image one-by-one (whereby the OS creates the AppleDouble dot-underscore files), and then copying the dot-underscore files back to the NetWare share so that when either migration tool is used, the files correctly appear on the Windows shares in AppleDouble form with forks and metadata intact. This works reliably enough, but it involves a HUGE amount of network activity, and there's issues with making sure that the permissions are correct in the process.
    Is there a way to directly produce the AppleDouble dot-underscore file from a file on an AFP share. Things like SplitForks, RezWhack, etc. don't work on shares. I cannot find any command-line utility, AppleScript extension, Automator action, etc. to do it.

    Thank you. I am aware of that, cpio as well. The problem is that I don't want to have to copy the files, just create the dot-underscore file. For various reasons, we still need to use the Windows-based migration tools to migrate the files. So what I want is something that can read the metadata and resource fork WITHOUT making a copy of the file to produce the dot-underscore file. The solution I
    currently have for them works like tar (without the extra step of storing things in the archive or requirement of using OS X tar to unpack it).

  • Mounting Network Volumes in the Command line

    What is the command for mounting a Network volume in a command line.... Plus when done this way will it get the password from keychain?

    The command in question is mount:
    <pre class=command>mount -t type server:/path/to/share /path/to/mountpoint</pre>
    This will mount the share /path/to/share from server server using protocol type (e.g. 'afp', 'nfs', 'smb'). The sharepoint will be mounted at the local /path/to/mountpoint
    mount will not use the keychain. If you require passworded access you can either include the username and password in the command, or switch to using an AppleScript solution which can use the keychain, and can be involked via osascript:

  • Can't send files to Trash from the command line

    Hello,
    as I'm programming in JAVA I must do all "special" operations as from the command line.
    I found several solutions but they don't work for me, at least not in Mavericks.
    I tried:
    osascript -e "tell app \"Finder\" to delete POSIX file \"/Users/me/totrash\""
    I got:
    21:60: execution error: Finder got an error: Handler can’t handle objects of this class. (-10010)
    I tried:
    echo "tell application \"Finder\" move POSIX file \"/Users/me/totrash\" to trash end tell | osascript
    I got:
    26:30: syntax error: Expected end of line but found command name. (-2741)
    Is there any working AppleScript way to send a file to the Trash Bin?
    Thanks in advance.
    ;JOOP!

    Near ....... I did not misspell 'me', I was in a different directory after all my experimenting .....
    Curse those who write cryptic error messages ...
    Bless those who still get it.
    So, thanks.
    ;JOOP!

  • Controlling Apple Chess from the command line

    Hello is it possible to control Apple Chess with the command line? I would like to get two computers to play against each other over a wireless connection, either airport of bluetooth.
    Any other suggestions would be great!
    Thanks,
    Tim

    Hey all thanks for your replies. I have figured it out using Max/MSP to send Applescript UI messages to the terminal. Each computer has a patch on it and plays after the other one has made a move. It is quite fun to program as it is using the chess app as an algorithm... anyhow i can't use screen sharing because i want the computers to talk to each other as if they were playing a game of chess against against one another by speaking the moves to each other.
    As if they were two computers at leisure playing chess in a park!
    Best,
    Tim

  • How to create an alias from the command line

    Hi
    I would like to know how to create an alias (for a file, not a command) from the command line. I don't want to use the ln command, as an alias has more interesting features than soft/hard links... Is there an Apple specific tool to do this?
    Thanks
    -Jerome
      Mac OS X (10.4.10)  

    The only straightforward way that I am aware of for creating a "Finder" alias from the command line is using AppleScript via 'osascript'. Of course, it's not really a command line solution since the "Finder" has to be running. Anyway, something along the lines of:
    <pre style="overflow:auto; padding: 5px; width: 500px ; font-size: 10px; border:1">osascript -e 'tell application "Finder" to make alias file to POSIX file "/full/path/to/file" at POSIX file "/full/path/to/folder"'</pre>

  • Command line to sort semi-colon delimited string

    I'm sure there's a simple solution eluding me... I have an app which stores sets as a string like:
    "bee;ant;cow;ant;Aardvark;dog"
    which I want to sort to a string like:
    "Ardvark;ant;bee;cow;dog"
    ...where letter sort** is case insensitive and number strings sort on numberical value (i.e. 1,2,10 not 1,10,2). FWIW, the string length is likely to be short and not large numbers of delimited terms - in case that matters.
    ** I can duck issue of sorting & accented characters if that's a significant complication at this point.
    The app in question can't do the sort but can call a Unix command line and read its stdout. I want a single command line not an external script for portability/support reasons, though it doesn't matter if the CL is long. So, please don't suggest I use a script even if it's your own preferred method!
    I thought of using 'sort' but that's for lines in a file vs a single input line. I guess I use awk, or can a pass perl as a CL (as opposed to calling a script)? Either way, my poring over the references I have hasn't showed me a solution and I don't know perl. Here's hoping someone can point me in the right direction.
    TIA
    Mark

    Here's one way to accomplish what you're asking:set stuff2Sort to "bee;ant;cow;ant;Aardvark;dog;1;10;2"
    set sortedStuff to sortStuff(stuff2Sort)
    on sortStuff(x)
    set tmpSort to paragraphs of (do shell script "echo " & quoted form of x & " | awk 'gsub(\"",\"\\n\") {print}' | sort -g")
    set oldDelims to text item delimiters
    set text item delimiters to ";"
    set theSorted to tmpSort as string
    set text item delimiters to oldDelims
    return theSorted
    end sortStuffI don't know if the ";" and "\" are appearing correctly or not. When I preview this post it shows up as a smiley face even though I have it in a code block!
    Hope this helps...
    Message was edited by: Chachi
    Sorry, thought I was in the Applescript forum! DOH!!!

  • Starting an application using command line arguements

    Hi All,
    I need to launch an application by passing command line arguements. How to go about it?
    Thanks
    Sakthi

    is this an application you've written, or one you've downloaded? the two ways I know of to run an app from the command line are to use the 'open' command (e.g. +open -a appName+), or to run the exectuable element directly (usually something like /path/to/appName.app/Contents/MacOS/appName). the open command doesn't have an option for passing parameters; running the executable directly will allow you to pass parameters unix-style (assuming the executable is designed to accept them), but doesn't always run the application the same way as double-clicking on the file.
    you can also try applescript (from the command line use osascript) if the app is scriptable.

  • Command-line type itunes control - questions

    Hello,
    I'm writing a little tool with Applescript to control iTunes via command-line type interface. I have few general questions, thanks in advance for any answers. First I'll explain my idea, questions at the end. (If wrong forum, please tell me where to go)
    The goal: to control music with as less hassle as possible. I listen music all day, have dozens of gigabites of it, and find mouse/iTunes interface too troublesome. Moodkiller whilst reading a book, for example.
    Tool is pop-up dialog, with a single text field. Write something and hit enter -> search phrase or command interpreted and sent to iTunes as Applescript -> iTunes acts, and a new dialog pops up, ready for next command. (Enter with no text quits app)
    Examples:
    "oasis wonderwall"
    Searches iTunes library and finds Wonderwall of Oasis. Displays a pop-up list of search matches, in this case just one song. Hit enter -> iTunes plays it. (If more results, I get to choose song from list.)
    I find this quicker than to activate iTunes search box with mouse, enter search string, activate results pane with several TAB:s etc...
    "trip-hop"
    Searches an iTunes library, finding over two hundred "trip-hop" genre songs. This time just plays random song among results (thumb rule: if number of results > 100, behave that way, otherwise as above). Library continues playing from that point. Usually means you get to hear a lot of trip-hop. (could also make new trip-hop playlist)
    ">"
    Command: skip to next song. ">>>" skips 3 songs at once, ">>>>" four songs etc
    "<"+" increases three notches, "++" four etc.
    Decrease volume, again "---" three notches etc.
    "play", "pause", "stop"
    Basic player commands, you name it.
    "oasis wonderw >"
    Searches song and adds it to end of current playlist (if more than one result, choose from list).
    Other ideas too, but you propably got the point.
    My questions:
    1) Any applications currently doing this kind of job? With iTunes or other music players? (You can use Quicksilver for iTunes song searching, but I'm not certain if that's very handy or fast)
    2) Would you use this kind of tool, if it were good? (just a theoretical question) If yes, how would you like to control it?
    3) I have used Applescript's basic "display dialog" and "choose from list" commands, but would love more customized pop-ups (fancier song lists etc). Pointers to good scripting additions to accomplish this? Currently the entire tool is made with Applescript.
    If this raises interest, I could post the tool somewhere. It's still very early draft, anyway.
    Cheers,
    O
    Helsinki

    Hi CofeeBreak,
    Thank you for your comment, but I was able to find the problem (didn't solve it yet): In the FM command line interface, calling a HEX file located in a folder with brackets in its name, such as "C:\hello_World(V1)\LabVIEW.hex" will not be recognized by the FM.exe, whereas "C:\hello_World_V1\LabVIEW.hex" will work just fine. In the Flash Magic GUI and Command Line Manual section on hex files there is no mention of that, my solution at the moment is to remove the brackets from folder names.
    Thanks
    Amir

Maybe you are looking for