UNIX path AND  Do shell script path with spaces

I am trying to building a interface with buttons to execute shell commands when the button is pressed. Below press button execute code.
I am new to AppleScript and Xcode and Interface builder. I have read different post referencing spaces but I still don't understand.
THIS COMMAND DOESN'T WORK IT'S SOMETHING TO DO WITH SPACES.
How would I fix this to work.
on clicked theObject
do shell script "rm /Library/Preferences/com.netopia.netOctopus\ Agent.preferences"
end clicked
This works (Below) no spaces in the path
on clicked theObject
do shell script "open /System/Library/PreferencePanes/SharingPref.prefPane/"
end clicked
ALL Mac OS X (10.4.6)
ALL   Mac OS X (10.4.6)  
ALL   Mac OS X (10.4.6)  
ALL   Mac OS X (10.4.6)  
ALL   Mac OS X (10.4.6)  
ALL   Mac OS X (10.4.6)  
ALL   Mac OS X (10.4.6)  
ALL   Mac OS X (10.4.8)  
ALL   Mac OS X (10.4.8)  

Camelot's explanation was good, but you don't seem to get it, so I'll take a crack at explaining as well.
First off, you need to understand what "do shell script" does and does not do. "do shell script" takes a string from AppleScript and passes it to a shell interpreter. It does not check in advance that this string makes sense. (That is impossible to do, in fact.) It just passes it along. The shell interpreter then converts the string into a command, or series of commands, and attempts to run them.
In AppleScript, quotation marks around something make that something a string. So, for example:
"rm "
is a string containing a letter r, a letter m, and then a space. Some commands can also return a string, which can then be stored in a named variable, as for example:
set a_variable to (the text returned of display dialog "Hi!" default answer "Some text")
When you wish to put two strings together in AppleScript, you use the & operator, as in:
"String 1" & "String 2"
In this example, there is no space at the end of the first string, and none at the beginning of the second, so the result is:
"String 1String 2"
All clear so far?
When a shell interpreter attempts to convert a string into commands, it has to split the string into pieces. A space signifies a break between pieces. In order to put a space into a single item, you can do a number of things. You can put the whole item in quotation marks (single or double), which is known as "quoting":
'/A/Path/With/A Space'
or you can put a backslash before the space, which is known as "escaping":
/A/Path/With/A\ Space
You can combine quoting and escaping if you do it right. For example, the backslash also lets you use a quotation mark inside a single item which is quoted:
"/A/Path/With/A Space/And/A\"Quotation/Mark"
There are further rules and substitutions that sometimes border on the arcane.
In order to simplify things, Apple created the command "the quoted form of". This command takes a string and returns a new string which is properly set up so that it will be just one item when split up for the command line. It will add quotation marks, backslashes, or whatever.
So, to put things together:
"rm " & the quoted form of thePath
is a way of saying to AppleScript "take the string in the variable named thePath, and quote it for the command line; then stick it on the end of a string containing an r, an m, and a space."
When you pass this to "do shell script", it will break things up in such a way that it hands thePath to the rm command, which will attempt to remove whatever is represented by thePath. (Adding the "-r" in there just tells the rm command "if this is a directory, get rid of it and all its contents". Otherwise rm will complain if the item is a directory.)
I think, however, you may just have the path wrong. In one of the spots where you gave the POSIX path, it had a backslash (\) at the end instead of a forward slash (/). As Camelot says, a forward slash means that the item is a directory and not a plain file. But if you really meant the backslash, it suggests that the item is a plain file, but has a space at the end (or some other character that mystifies the command line). It's an escape.
Try making a new script in Script Editor which says
">" & (the POSIX path of (choose file)) & "<" at the end, that's the culprit.
(And if it won't let you select the file when you run the script, it means that the item is actually a folder.)

Similar Messages

  • Need last [login, access, bind] time plugin and/or shell script

    Hi Gurus,
    I was wondering if anyone could share their pre-op bind plugin (and/or shell script) to store the last access time. We have a heterogeneous UNIX environment (Solaris, HP-UX, and Linux clients and Sun JES DS 5.2 on Solaris 9 as name service repository) and need to implement account suspension if the user has not logged in in the specified period.
    Thanks.

    Thanks for the reply, I've updated my OP with proper code tags.
    The g13 is a gaming keyboard https://wiki.archlinux.org/index.php/Logitech_G13
    I'm attempting to use the 'g13' outlined section
    I will look into udev rules, thanks again.

  • Tomcat as service : install path with spaces

    I'm trying to install tomcat as service
    but when I choose an install path with spaces
    I mean smthing like "c:\program files\tomcat"
    it doesn't work
    I tried to modify the wrapper.properties file
    with "" but it doesn't work
    I even set the parameter wrapper.cmd_line with
    a command line that works when launched for CMD
    but the service doesn't start
    any idea????

    I found it ! (hope it helps)
    wrapper.properties that works with spaces in the name
    of the java directory and the tomcat directory
    # $Header: /home/cvs/jakarta-tomcat/src/etc/Attic/wrapper.properties,v 1.2.2.1 2000/10/16 01:59:22 larryi Exp $
    # $Revision: 1.2.2.1 $
    # $Date: 2000/10/16 01:59:22 $
    # jk_service.properties - a bootstrup file for the Tomcat NT service.
    # This file provides jk_nt_service with the needed information to
    # start tomcat at a different process.
    # As a general note, the characters $( and ) are used internally to define
    # macros. Do not use them!!!
    # Whenever you see a set of lines such as:
    # x=value
    # y=$(x)\something
    # the final value for y will be value\something
    # Normaly all you will need to modify is the first two properties, i.e.
    # wrapper.tomcat_home and wrapper.java_home. Most of the configuration
    # is derived from these two.
    # wrapper.tomcat_home should point to the location where you
    # installed tomcat. This is where you have your conf, webapps and lib
    # directories.
    wrapper.tomcat_home=C:\Program Files\tomcat-3.2.1
    # wrapper.java_home should point to your Java installation. Normally
    # you should have a bin and lib directories beneath it.
    wrapper.java_home=C:\Program Files\JavaSoft\JRE\1.3
    #------ ADVANCED MODE ------------------------------------------------
    # Make sure that you read the how-to before making too many changes.
    # Defining where the service is going to put the standard
    # output of Tomcat. This is where System.out.println and
    # System.err.println goes to.
    wrapper.stdout=$(wrapper.tomcat_home)\logs\jvm.stdout
    wrapper.stderr=$(wrapper.tomcat_home)\logs\jvm.stderr
    # Additions to the path. put here directories where you store DLLs for
    # native methods etc.
    wrapper.ld_path=d:\
    wrapper.ld_path=c:\
    # Defining the classpath. All the rows that belongs to the class_path
    # property are concatenated to create the classpath for Tomcat.
    # If you have additional locations that you would like to add to the
    # claspath you should add a new wrapper.class_path=<location> line.
    wrapper.class_path="$(wrapper.tomcat_home)\classes"
    wrapper.class_path="$(wrapper.tomcat_home)\lib\jaxp.jar"
    wrapper.class_path="$(wrapper.tomcat_home)\lib\parser.jar"
    wrapper.class_path="$(wrapper.tomcat_home)\lib\webserver.jar"
    wrapper.class_path="$(wrapper.tomcat_home)\lib\servlet.jar"
    wrapper.class_path="$(wrapper.tomcat_home)\lib\jasper.jar"
    # This is where Javac is located in JDK1.2.x
    wrapper.class_path="$(wrapper.java_home)\lib\tools.jar"
    # and a tribute to JDK1.1.x
    wrapper.class_path="$(wrapper.java_home)\lib\classes.zip"
    # This is the Java interpreter used for running Tomcat
    wrapper.javabin=$(wrapper.java_home)\bin\java.exe
    # This is Tomcat's startup class (the class that contains Tomcat's
    # starting point.
    wrapper.startup_class=org.apache.tomcat.startup.Tomcat
    # This is the location where tomcat's server.xml configuration file
    # is located.
    wrapper.server_xml=$(wrapper.tomcat_home)\conf\server.xml
    # The NT service uses AJP12/AJP13 to shutdown Tomcat. The
    # wrapper.shutdown_port tells the service the identity of the port that
    # is used by AJP12/AJP13.
    wrapper.shutdown_port=8007
    # Can either be ajp12 or ajp13 depending on your configuration.
    # Default value is ajp12
    wrapper.shutdown_protocol=ajp12
    # This is the command line that is used to start Tomcat. You can add extra
    # parameters to it but you can not remove anything.
    wrapper.cmd_line="$(wrapper.javabin)" -classpath $(wrapper.class_path) $(wrapper.startup_class) -config "$(wrapper.server_xml)" -home "$(wrapper.tomcat_home)"

  • Get all .pdf file in a folder and do shell script

    Hi, I need to convert many pdf to ps using pdf2ps, and I'm try to do this with applescript:
    tell application "Finder"
    set pdf_folder to (choose folder)
    set pdf_path to POSIX path of (item of folder pdf_folder whose name...)
    end tell
    repeat with k in pdf_path
    set kl to ... -- same of k but with extension .ps
    do shell script ("pdf2ps "&k&" "&kl)
    end repeat
    but I don't know how implement that.
    Can anyone help me?
    Thanks!

    01. The 'tell application "Finder" ... end tell' code block is not required to call 'choose folder'. View the 'Standard Additions' dirctionary.
    02. 'choose folder' returns a single alias - if only a single folder is to be selected, or a list of 'alias'es - if 'multiple selection allowed' is set to true.
    03. 'pdf2ps' is not part of Apples' UNIX commands installation; and you did not provide a valid URL for others to download the UNIX command.
    Code to process only a single selected folder.
    -- Code starts here --
    try
    do shell script ("pdf2ps " & (quoted form of (POSIX path of ((choose folder) as string))))
    end try
    -- Code ends here --
    Code to process multiple selected folders.
    -- Code starts here --
    set pFolder to choose folder with multiple selections allowed
    if ((count pFolder) > 1) then
    set {oAStid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ""}
    set pFolder to text items of pFolder
    repeat with i from 1 to (count pFolder)
    set (item i of pFolder) to quoted form of (POSIX path of (item i of pFolder))
    end repeat
    set AppleScript's text item delimiters to " "
    set pFolder to pFolder as string
    set AppleScript's text item delimiters to oAStid
    else
    set pFolder to pFolder as string
    end if
    try
    do shell script ("pdf2ps " & pFolder)
    end
    -- Code ends here --

  • Wireless network (and a shell script for you guys, also)

    I don't know the right way to bring up my wireless iface at bootup, so I wrote a small shell script to do it for me.
    Feel free to use it if you find it useful..
    I'd also appreciate someone telling me what *IS* the arch way of doing what my shell script's doing
    #!/usr/bin/env bash
    # Val Polyakov <[email protected]>
    # 7/8/07
    # Change these to reflect your network
    PATH=/usr/sbin:/sbin:/bin
    IFACE=ifaceNameOfYourWirelessCard
    DRIVER=moduleNameForYourWirelessCard
    SID=yourSID
    ENCKEY=yourEncryptionKey
    # Don't change anything beyond this point.
    case "$1" in
        start)
            echo "Loading the wireless card driver"
            modprobe $DRIVER
        echo "Setting up the SID and encryption key"
            iwconfig $IFACE essid $SID enc $ENCKEY
        echo "Bringing up the wireless interface"
        ifconfig $IFACE up
        if [ -f /var/run/dhcpcd-$IFACE.pid ]
        then
            rm /var/run/dhcpcd-$IFACE.pid
        fi
        echo "Running the dhcp client"
        dhcpcd $IFACE
        stop)
            echo "Bringing down the wireless interface"
        ifconfig $IFACE down
        echo "Unloading the driver"
        rmmod $DRIVER   
        restart)
            $0 stop
        sleep 2
            $0 start
            echo "usage: $0 {start|stop|restart}"
    esac
    exit 0

    brain0 wrote:If your wireless drivers support wpa_supplicant, you could try autowifi from http://www.archlinux.org/~thomas/autowifi-svn/ It handles multiple wireless networks very well. There is no documentation right now, just read here: http://archlinux.org/pipermail/arch-dev … 00867.html
    what would the benefit of that be, as compared to my script ?
    the shell script i made (and pasted) works just fine, sits in /etc/rc.d and is called by /etc/rc.conf
    i was just curious whats the official, i guess, way to do it with arch
    since network profiles dont work for some reason, i figured i must be missing something..

  • How to run a spool program in unix environment within a shell script

    Hi
    I have written a spool program , which i run from SQL * PLUS
    using
    @'path of the spool file having extension .sql'
    Now i want to include this spool program within the shell script , please help me , how to do it.
    Thanks in advance ..

    user8703472 wrote:
    Thank You Sir for the reply .
    #!/bin/ksh
    ORACLE_SID=<SID>; export ORACLE_SID
    ORACLE_HOME=<ORACLE_HOME>; export ORACLE_HOME
    $sqlplus / as sysdba <<-EOFSQL1 >> output.log 2>&1
    spool /tmp/a.log
    select * from v\$instance
    spool off;
    EOFSQL1
    Please explain me this statement $sqlplus / as sysdba
    and also what a.log contains .
    i have the user id and password for the DB.
    should i write something like this
    $sqlplus -Uusername -Ppassword -Sservername
    i know how to run a procedure from isql(sybase DB)
    Ahh.... but oracle is not just sybase under a different name.
    It would be a good investment in your career to go to tahiti.oracle.com. Drill down to your product and version. There you will find the complete doc library.
    You should spend a few minutes just getting familiar with what kind of documentation is available there by simply browsing the titles under the "Books" tab.
    Open the Reference Manual and spend a few minutes looking through the table of contents to get familiar with what kind of information is available there. Learning where to look things up in the documentation is time well spent on your career.
    For your immediate task, spend a few minutes looking through the SQLPlus User Guide and Reference.
    Then set yourself a plan to dig deeper.
    - Read a chapter a day from the Concepts Manual.
    - Look in your alert log and find all the non-default initialization parms listed at instance startup. Then read up on each one of them in the Reference Manual. Take a look at your listener.ora, tnsnames.ora, and sqlnet.ora files, then bounce what you see there in the network administrators manual.
    Give a man a fish and he eats for a day. Teach a man to fish and he eats for a lifetime.
    But this project , i need to run the spool program from with in a shell script .We see what you mean, but the term "spool program" has no meaning in Oracle and only serves to cloud the issue. I know you are used to using this term with other products, but "When in Rome ...."
    >
    Thank You in advance ..

  • FTP files from Unix box to Windows ( Shell script )--inplemention in Apps

    Hi,
    I have an requirement like need to send files generated at a particular path in the UNIX sever into Windows machine.
    This should be a scheduler( can we create any shell script
    ) for this...
    Note : files generated at Unix move into Windows box....
    Please check and help on this... and let me know if any clarification required on my requirement.
    Thanks,
    Pavan K

    This is relatively easy to do. You will need to write the shell script code and register it as a concurrent program of type "Host". Pl see the Application Developer Guide (for 11i and R12) at http://www.oracle.com/technology/documentation/applications.html for details on how to register a shell script "Host" custom program.
    ML Docs 266268.1, 147455.1, 1013907.6 and 156636.1 have some more info too.
    HTH
    Srini

  • Host in forms 10g and execute shell script

    Hi!
    I have a little problem. When I transfer form to AS through SSH protocol I want to automatically generate form on AS wit h code:
    declare
    lv_server_dir vc2() := /folder1/folder2;
    lv_file_name vc2():= a.fmb;
    host(lv_server_dir||'/ftp_gen.sh '||lv_server_dir||' '||lv_file_name);
    In file ftp_gen.sh is code:
    export ORACLE_HOME=myOracleHome
    export PATH=$PATH:$ORACLE_HOME/bin
    export TNS_ADMIN=$ORACLE_HOME/network/admin
    export SQLPATH=$ORACLE_HOME/dbs
    export NLS_LANG=SLOVENIAN_SLOVENIA.EE8ISO8859P2
    export DISPLAY=:2
    cd $1
    ./gen.sh $3
    When I execute this command on form nothing happens.
    What could be wrong?
    Thanx,
    Bojan

    Hi Bojan,
    Executing the HOST Command will execute in the Mid Tier and nothing will show up in the Client. (other than the form go into Blocking mode). Just check out whether the Operation you wanted to do in the Mid tier is done or not. (Here it looks like you are compiling a form. So, check out that the fmx is generated.)
    Alternatively to check out the proper execution of the HOST command, you can generate a file in the Mid-tier (on successful execution of the shell script) and read the file using TEXT_IO and display a message to user.
    HTH.

  • How to run cdb -c with a command that contains paths with spaces?

    CDB has a -c command line option that runs a specified command, sort of like
    cmd -c, I suppose. Here's what I need to run:
    cdb.exe -c "!itoldyouso \"c:\Program Files (x86)\My Software\1.exe\" \"c:\Development\my-software\bin\1.pdb\";q" "notepad.exe"
    Note that here I've tried escaping quotes around paths with \. No luck. I've also tried
    ^ and """ (triple quote). All I get is this:
    0:000> cdb: Reading initial command '!itoldyouso "c:\Program Files (x86)\My Software\1.exe" "c:\Development\my-software\bin\1.pdb";q'
    c:Program - ignored. The input name/address could not be resolved to a loaded module.
    Files - ignored. The input name/address could not be resolved to a loaded module.
    (x86)My - ignored. The input name/address could not be resolved to a loaded module.
    Software1.exe - ignored. The input name/address could not be resolved to a loaded module. Could not find module c:program ^ Extra character error in '!itoldyouso "c:\Program Files (x86)\My Software\1.exe" "c:\Development \my-software\bin\1.pdb";q'
    The command is passed to CDB correctly, but CDB itself doesn't know how to parse quotes.

    Hmm,
    !itoldyouso with spaces in path does not even work, when started inside cdb or windbg for me.
    But something like this reports success:
    cdb.exe -c ".reload /f /i \"'C:\Users\sammy\Documents\Visual Studio 2010\Projects\DebuggerStub\Debug\DebuggerStub.
    exe'=0x6000000,0x1b000\"" notepad.exe
    Microsoft (R) Windows Debugger Version 6.3.9431.0 X86
    Copyright (c) Microsoft Corporation. All rights reserved.
    CommandLine: notepad.exe
    ************* Symbol Path validation summary **************
    Response Time (ms) Location
    OK C:\Users\sammy\Documents\Visual Studio 2010\Projects\DebuggerStub\De
    bug
    OK C:\Windows\symbols\dll
    Deferred srv*C:\Symbols\MsSymbols*http://msdl.microsoft.com/download/symbols
    Symbol search path is: C:\Users\sammy\Documents\Visual Studio 2010\Projects\DebuggerStub\Debug;C:\Windows\symbols\d
    ll;srv*C:\Symbols\MsSymbols*http://msdl.microsoft.com/download/symbols
    Executable search path is:
    ModLoad: 007c0000 007e8000 notepad.exe
    ModLoad: 77540000 77668000 ntdll.dll
    ModLoad: 77460000 7753d000 C:\Windows\system32\kernel32.dll
    ModLoad: 75c70000 75d36000 C:\Windows\system32\ADVAPI32.dll
    ModLoad: 75f60000 76022000 C:\Windows\system32\RPCRT4.dll
    ModLoad: 75ed0000 75f1c000 C:\Windows\system32\GDI32.dll
    ModLoad: 77680000 7771d000 C:\Windows\system32\USER32.dll
    ModLoad: 761d0000 7627a000 C:\Windows\system32\msvcrt.dll
    ModLoad: 77720000 77793000 C:\Windows\system32\COMDLG32.dll
    ModLoad: 75c10000 75c69000 C:\Windows\system32\SHLWAPI.dll
    ModLoad: 749c0000 74b5e000 C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.6002.1830
    5_none_5cb72f2a088b0ed3\COMCTL32.dll
    ModLoad: 76920000 77431000 C:\Windows\system32\SHELL32.dll
    ModLoad: 6f750000 6f792000 C:\Windows\system32\WINSPOOL.DRV
    ModLoad: 76310000 76455000 C:\Windows\system32\ole32.dll
    ModLoad: 76280000 7630e000 C:\Windows\system32\OLEAUT32.dll
    (fc8.1738): Break instruction exception - code 80000003 (first chance)
    eax=00000000 ebx=00000000 ecx=0015fa34 edx=775a5b44 esi=fffffffe edi=00000000
    eip=775886ce esp=0015fa4c ebp=0015fa7c iopl=0 nv up ei pl zr na pe nc
    cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000246
    ntdll!DbgBreakPoint:
    775886ce cc int 3
    0:000> cdb: Reading initial command '.reload /f /i "'C:\Users\sammy\Documents\Visual Studio 2010\Projects\DebuggerS
    tub\Debug\DebuggerStub.exe'=0x6000000,0x1b000"'
    *** WARNING: Unable to verify timestamp for 'C:\Users\sammy\Documents\Visual Studio 2010\Projects\DebuggerStub\Debu
    g\DebuggerStub.exe'
    0:000> lm
    start end module name
    007c0000 007e8000 notepad (deferred)
    06000000 0601b000 DebuggerStub M (private pdb symbols) c:\users\sammy\documents\visual studio 2010\projects\debuggerstub\debug\DebuggerStub.pdb
    6f750000 6f792000 WINSPOOL (deferred)
    So a backslash looks not so bad, else one can try to use a script-file with "-c" arg. 
    With kind regards

  • SAP and Korn shell scripts

    Hi,
    It looks SAP default is c-shell only.  I have an issue, when remote calls (rsh) to OS to run a command, k-shell script does not source the .profile.  Do any one face this issue? how it was resolved.
    Thanks, R

    Hi,
    It is a very, very long time, but as far as I remember that is an issue with the rsh.
    I think the solution is not to use the Ksh on the destination.
    I think there is/was a note indicating so.
    For that reason SAP does recommend to use only the cshell.
    Edited by: Fidel Vales on Nov 14, 2009 11:02 AM
    hi again.
    Check note 202227.
    > In general, you can use the Korn shell (ksh) as a login shell, however, note that the implementation of the Korn shell differs among the different UNIX platforms. This has lead to problems within SAP, in particular this is the case when you start external programs from an SAP system.
    and note 188772
    > The .profile file is not read under ksh.

  • Oracle 10g and Korn Shell Scripting

    I have a table,SALES_STAGING, with 3 main columns.
    Sales_Date, Sales_type,Sales_Code.
    A sale is added to the table then waits until approved to be processed. The Sales_Code is 1(waiting approval). Then manually changed to 2 every 30 minutes by sales staff except on weekends. By Monday,a large queue develops. This must be changed because the queue is slowing the system. Can someone help create a Unix Korn shell script to
    1) Run every 30 minutes via Crontab
    2)login to the Oracle DB.
    3)Count the number of records to be processed, if any.
    4)Update another 'log' table with the time it ran and the records to be processed
    5)if there are less than 20 add another 50 to be processed by changing the Sales_Code from 1 to 2.
    This would really help out tremendously! Thank you.

    Wait... Isn't this forum designed for the sharing of information? The experts here shouldn't be concerned whether the request is from a Student, Oracle newbie or Developer and should focus on the request. If you are capable of assisting then I am hoping you will out of the core respect for professionalism and the motivation to provide something of value to others. If not, don't waste my time or any one else by responding with preconceived judgments and insulting remarks as these will be reported.
    Sales transactions can peak at 20,000 per hour with an average of several million thru the week. Those sales by VIP customers are immediately identified and have a priority for approvals because their balances can easily exceed $1,000,000.00. There is a pre-approval process to be introduced but until programs can be modified/tested and deployed we need a quick fix. The programming system isn't slow, it's the limited human resources approving VIP customers. My request was to keep it simple and expand on it myself to include the entire scope of our project. dbms_scheduler, although a good idea will require DBA assistance and there is no resource available. I need a simple working model to give me some direction/ideas...

  • How do I enter a path with spaces

    In creating a special mail alert there is an option to enter a file to execute. If I put the file in my C;/Program Files (86)... it wont execute because of the spaces. How do I enter the path and filename with spaces. YES, I have tried all sorts of "s and they don't seem to work. Can you give an example.

    I usually find that if use the offered option to browse to the file using the browser/picker provided, all this is taken care of. Thunderbird will use a technique widely emplyed on the web, where spaces are encoded as %20. Other potentially troublesome characters such as slashes and colons will get similar treatment.
    As an aside, 20 is hexadecimal for the decimal value 32, which is the standard value in ASCII and many other encodings for the space character. So %20 is a particular notation that advises that the character with hexadecimal value 20 is to be used.
    In general "C:\Program Files\example\example.txt" ought to work too.
    But your problem may be specific to the particular context. I have had a long standing issue where I want to send a link to a file on a shared network drive and the link sent via Thunderbird has refused to work as an active link. The recipient generally had to copy and paste the provided pathname. This seems to have resolved itself in a recent update of Thunderbird. If you're using an add-on then the problem may be inherent in that add-on, or in a rather obscure difficulty with giving the Thunderbird process access permission to work with local files.

  • Do Shell Script .. with Administrator Privileges ... ?

    hi everyone!
    I have a script that have multiple lines like this:
    do shell script " ... " with administrator privileges
    do shell script " ... " with administrator privileges
    Mac OS X 10.4 does it right(?) by asking ONCE for an admin login/password, and would run both lines above ... but 10.2 (and 10.3?) asks TWICE for the password using the same code. What am I doing wrong? I want all versions 10.2-4 to ask only once ... Any ideas?
    Thank you!!
    Cass

    If you would prefer that your script would not ask for a password to get admin privileges, then this uses the keychain:
    set aVariable to do shell script DefinedAsVariable password getPassw() with administrator privileges
    -- The Handler --
    The following handler assumes you have a password in your keychain called ASPW (could be anything you want) saved as a generic key. To do that, open your Keychain Access (in Utilities) application, choose file New, and in the sheet give it a name, enter your account name and type the password you want to use (your admin password in this case). OK. Now find the new password and double-click it. Under the attributes tab change Kind to generic key (it will be Applications). This makes for a fast search because there aren't many of them. Switch to the access control tab and select the "Allow all applications to access this item" button. Enter your admin password in the dialog that appears, and you are done. The first time you run the script, you'll have to click "Always Allow" in the dialog that appears - perhaps several times. After that, it won't ask.
    to getPassw()
    tell application "Keychain Scripting"
    launch
    tell current keychain to ¬
    tell (some generic key whose name is "ASPW")
    return password
    end tell
    end tell
    end getPassw

  • Automator and "Run Shell Script" error

    First, if I'm in the wrong place with this- sorry. Figured this was an OS kind-of thing.
    I recently migrated to a new iMac ... I brought along an Automator script; I've been using it for years to perform a little rsync backup to an USB HDD. It's 'never' given me any problems ... until now!
    "*Run Shell Script*" encountered an error .. but alas, the system log is devoid of messages ... and the verbose log I have running indicates that all the files are copied/backed-up ... I would love any input on this that might help me get back on the feet. .....
    *Here's what my Shell Script Looks like:*
    Shell Option: /bin/bash
    Pass Input: to stdin
    rm -dfr '/Volumes/Backup HD/*********'
    rm -dfr '/Users/***********/Library/Logs/Profile_Backup.log'
    rsync -rltv /Users/******** '/Volumes/Backup HD/' > /Users/*******/Library/Logs/Profile_Backup.log
    (I'm sure there's way to only sync the changed stuff between backups ... but I've simply preferred the fresh copy approach).
    *I do however note this in my logs when I open Automator:*
    12/14/10 3:15:46 PM [0x0-0x42042].com.apple.automator.Backup[464] Application Stub: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/Adobe Unit Types.osax" declares no loadable handlers.

    @Tony T1
    Thanks, I'll certainly adjust the log file as suggested
    In troubleshooting the problem I went the terminal route - and issued each command ... during the rsync process I was getting an error ... turns out when it was syncing the SyncServices folder it was encountering a copy of the keychain ... which had root permissions - naturally rsync was not able to copy the file (personally I have no idea why the keychain would be being sync'd with anything)!
    I removed the file from the sync ... I'm still doing some "debugging" to correct the problem-
    Again, thanks for the assist!

  • Translating working UNIX command to "do shell script"

    A few days ago LittleSaint and Gary Kerbaugh (UNIX discussions) suggested an approach for text positioning which appears to work flawlessly in Terminal. The UNIX version is:
    awk -v str_x="140 280" -v str_y=abcdef 'BEGIN{ printf "%-13s%s\n", str_x, str_y }'
    Now, I'm trying to use this in AS as a "do shell script". Clearly, some changes are needed (characters escaped, punctuation changes, etc.), but I've been unable to nail down exactly what those are (assuming it's even feasible).
    Ideas?

    How about this:
    do shell script "awk -v str_x=\"140 280\" -v str_y=abcdef 'BEGIN{ printf \"%-13s%s\\n\", str_x, str_y }'"

Maybe you are looking for