Problem with backtick replacing apostroph in applescript/shell script

I've got a script that appears to be using a backtick instead of an apostrophe which is causing an error in my shell script. For the life of me I can't seem to find where the error is being generated?
The script is attached below. I'm using Exiftool, an app that writes metadata to image files. The shell script
set cmd to "exiftool -CopyrightNotice=" & exifCopyright & " " & thisFilePath & ""
set theResult to do shell script cmd
works fine but the following shell script
set cmd to "exiftool" & space & authorStr & " " & thisFilePath & ""
set theResult to do shell script cmd
returns the error "sh: -c: line 0: unexpected EOF while looking for matching `''
sh: -c: line 1: syntax error: unexpected end of file" number 2. The code in the event log in applescript editor looks exactly the same to me but one fails in the shell script.
It has been suggested by the developer of Exiftool, Phil Harvey, that there is a backtick in the second shell script. I read somewhere in the applescript docs that this is due to a change in OS 10.6? Any suggestions on how to fix this?
Thanks.
Pedro

Yea, the authorStr value has a space like "Joe Smith"
Then you need to use quoted form of this string, too:
set cmd to "exiftool " & quoted form of authorStr & space & thisFilePath
although the format looks wrong to me - shouldn't there be some kind of switch, such as "-author=' before it?
You have to consider how you'd enter this at the command line to work out how best to translate it to AppleScript. For example, if the command line version were:
exiftool -author='John Doe' /path/to/some.jpg
you can see the quotes are around the name, not the entire -author switch. In this case you should be looking at something like:
set authorStr to "John Doe"
set theFilePath to "/path/to/some.jpg"
set theCmd to "exiftool -author=" & quoted form of authorStr & space & quoted form of theFilePath
Now you could, of course, use quoted form when you create the variables (e.g. set authorStr to quoted form of "John Doe"), but that may screw you up later on if/when you try to use authorStr in some other way, so I find it best to use quoted form only where it's needed.

Similar Messages

  • SQL Developer Problems with Microsoft Word Apostrophes

    Hi,
    I'm trying to copy and paste a list like the following from Microsoft Word to SQL Developer -
    '123','456','789'
    Shouldnt be a problem.
    But when ever I paste it into an sql file in Developer it comes out with different styled apostrophes which SQL Developer does not seem to like -
    ‘123’,’123’,’123’
    Obviously I can just do a find and replace and change all of the problem apostrophes but is there a way to stop the problem occuring?
    It doesnt matter what font I am using in Word, I always get the slanted style apostrophes. But in Developer, if I just normally type an apostrophe, I get the acceptable version - '

    I hate copying and pasting to/from word it does far to many things I don't want it to do.
    A trick that sometimes works for me is to copy in word, paste in notepad, then copy in notepad and paste into SQL developer.
    I have replicated your issue but I have found that even this dosn't work.
    You could write a VBA macro in word linked to the ctrl + c short cut that does a text copy and a find and replace on the special chars turning them into normal ones but I think this might be overkill.

  • Has anyone had a problem with their replacement nano?

    My replacement nano came with a letter saying that it was covered by a 90 day warranty. Yesterday when I thought I had a problem with it I submitted a request for support and included a scan of the letter. I just got a reply saying that my warranty is from the original date of purchase and thus expired.
    Fortunately I have resolved my problem in the mean time but what happens if I get a problem that I can't fix. It appears that the so-called warranty on the replacement units is completely worthless.

    I hope you are correct if I need the warranty! This is how Applecare replied to me:
    Thank you for sending the proof of purchase.
    Apple has reviewed your proof of purchase and your request to update the purchase date in our records. Your request was carefully considered. We regret to inform you that your request has been denied.
    Your request was denied because the date of purchase for your replacement IPOD NANO is the same as the date of purchase of the original IPOD NANO. The replacement IPOD NANO is entitled to the remaining warranty coverage from the original IPOD NANO.
    Your IPOD NANO has the following date of purchase in our records: 02/14/2006
    Sincerely,
    AppleCare Agreement Administration
    This is what they wrote after looking at my letter about the 90 day warranty - hence my concern that it is worthless. Hopefully I never have to call AppleCare - they seem quite unhelpful.

  • Problem with Nested tell blocks in Applescript

    Hello everyone,
    I've been trying to do a little Applescript, whose purpose is to open a file selector to let the user choose a bunch of images, then prompt him to ask a resizing ratio, and then resize the chosen pictures accordingly (after duplicating the originals in a folder on the desktop, the copied files being the ones resized).
    I'm having problems with the resizing part... Here is the code I've come up with so far... "Image traitées" is the name of the new folder created on the desktop, and "compression" is the factor in %.
         -- Resizing 
         tell application "Finder"
              repeat with photo in folder "Images traitées" of desktop
                   tell application "Image Events"
                        launch
                        scale photo by factor compression * 0.01
                   end tell
              end repeat 
         end tell
    I'm encountering an error number -1708, saying that the 'photo' item doesn't understand the scale message...
    As I'm new to Applescript, I have some difficulties solving this... Could it be due to the nested tell blocks ?
    Thanks a lot for your help !
    Thomas

    Your tell statements are OK, although when nesting them you do need to keep track of what application is getting targeted in any given statement (to avoid terminology conflicts).
    Each application refers to its objects in its own way - unfortunately, not everything knows about Finder references.  Your photo variable contains a Finder reference (e.g. "file x of folder y of disk z"), but Image Events doesn't know what that is.  The solution is to convert the Finder reference to something more standard, such as text or an alias.
    Your script won't work with just that change, however.  Image Events works with the image contained in a file, so you also need to actually get that image, for example:
    set compression to 80 -- used in the following snippet
    tell application "Image Events" to launch -- just need to do this once
    tell application "Finder"
         repeat with photo in folder "Images traitées" of desktop
              tell application "Image Events"
                   set theImage to open (photo as alias) -- get the image from the Finder reference
                   scale theImage by factor compression * 0.01
                   save theImage -- save the changed image
              end tell
         end repeat
    end tell

  • Applescript/shells script for capture one

    Hey,
    Wanting a script that will take the last item copied to the clipboard (which will be a folder name), search for it in finder, in "this mac", and then open the folder in Capture One.  It would be great if it were ready to run, so I could launch it each time with a keystroke.  Any one willing to help me on this.  Thanks so much!!
    I know a little applescript, but this one is kind of out of my league, I think, at least.

    Hi,
    You can use this script in an Automator Service (you can assign a keystroke combination to this service).
    If the script find one folder whose name equal the contents of the clipboard, "Capture One" will open this folder.
    if the script finds multiple folders whose name equal the contents of the clipboard, it will do nothing, because I don't know what you want in this case.
    To create a service, you start by selecting New from Automator's File menu.
    You should select the Service option, which is accompanied by a gear icon, clic "Choose" button.
    In your new service, you will see a bar at the top of the Automator flow pane. It has combo boxes that allow you to set filters that establish the conditions in which your service should be made accessible. You want to make a service that receives selected "No Input" and will operate in any application or select an application.
    Add the "Run Shell Script" action
    Copy/paste this script in the action:
    folder=$(mdfind "kMDItemFSName = \"$(pbpaste -Prefer txt)\" && kMDItemContentType = \"public.folder\"")
    if [ -z $folder ];then exit 0;fi ## no match
    tot=$(wc -l <<< "$folder")
    if [ $tot -eq 1 ]; then open -b 'com.phaseone.captureone7' "$folder"; fi
    Replace the bundle identifier in this script --> 'com.phaseone.captureone7'
    To know the bundle identifier of your "Capture One" application, run this AppleScript, copy the result to change the  bundle identifier in the shell script
    tell application "Finder" to get id of (application "Capture One")
    Save the service, quit Automator
    The final step is to assign a keystroke combination to the newly created service.
    Open the System Preferences application and navigate to the Keyboard preference pane, and select the Shortcuts tab.
    From the list on the left of the preference pane, select the Services category.
    A list of the installed services will be displayed to the right.
    Scroll to the last category titled General, and locate the service you just created.
    Double-click to the far right of the service name to activate the keystroke input field and then type the key combination you wish to assign to the service.
    Close the System Preferences application.

  • How to replace a word thr shell script

    Hi,
    I need a shell script which should read a file(a.txt)
    and need to update the same file( means only replace a word with another one in the same file)
    my unix version is SunOS and i am using ksh
    could you pls provide me some better way.
    My failured trails are as below
    suppose a.txt file having data like,
    column1 column2 column3
    data1 data2 data3
    and my script is,
    #!/usr/bin/ksh
    patha=/tmp
    filea=a.txt
    sed '/column2/s//column4/g' $patha/$filea > $patha/$filea
    And also pls provide how to add data(data into new line) into file(a.txt)
    Thanks in advance.

    This is an Oracle SQL and PL/SQL forum.
    If you want to learn how to write unix shell scripts I suggest you search the internet for a suitable unix forum.

  • Tacacs problem with ACS 4.2 NDG and shell authorization sets

    Hi all,
    I am trying to solve this problem without success so far. I have fresh ACS 4.2.15 patch 5 ACS installation and I am tryng to deploy it to our environment. So I have configured one 2960S to be my test client and everything works fine. Problem is when I try to create fine grained policies using network device groups and shell authorization sets.
    I have created shell authorization sets called ReadOnly and FullAccess. I have also created NDG called FloorSwitches and added my 2960. I have 2 user groups called FloorSwitchesReadOnly and FloorSwithcesFullAccess. Now, if I configure group FloorSwitchesFullAccess and assign Shell command authorization set per NDG and then log into the switch, all of my commands are refused as unauthorized.
    One thing that I have noticed is that if I assign shell command authorization set to any device ( in user group settings ) it works fine. Or if I create association with DEFAULT NDG in user group it also works. So my conclusion is that ACS for some reason does not associate my switch with correct group but rather puts it to DEFAULT group for some reason.
    Did anyone had similar problem or is there something that I am doing in a wrong way? Is there another way to achieve such thing without using NDG's?
    Thanks everyone....

    Please upgrade to patch 6, there is a bug in patch 5 and you can check the release notes or the readme for more information.
    What is your user setting set to while you are testing command authorization, did you set it back to the group setting?
    Thanks,
    Tarik Admani

  • [SOLVED] problem with spaces and ls command in bash script

    I am going mad with a bash script I am trying to finish. The ls command is driving me mad with spaces in path names. This is the portion of my script that is giving me trouble:
    HOMEDIR="/home/panos/Web Site"
    for file in $(find "$HOMEDIR" -type f)
    do
    if [ "$(dateDiff -d $(ls -lh "$file" | awk '{ print $6 }') "$(date +%F)")" -gt 30 ];
    then echo -e "File $file is $(dateDiff -d $(ls -lh "$file" | awk '{ print $6 }') "$(date +%F)") old\r" >> /home/panos/scripts/temp;
    fi
    done
    The dateDiff() function is defined earlier and the script works fine when I change the HOMEDIR variable to a path where there are no spaces in directory and file names. I have isolated the problem to the ls command, so a simpler code sample that also doesn't work correctly with path names with spaces is this:
    #!/bin/bash
    HOMEDIR="/home/panos/test dir"
    for file in $(find "$HOMEDIR" -type f)
    do
    ls -lh "$file"
    done
    TIA
    Last edited by panosk (2009-11-08 21:55:31)

    oops, brain fart. *flushes with embarrassment*
    -- Edit --
    BTW, for this kind of thing, I usually do something like:
    find "$HOMEDIR" -type f | while read file ; do something with "$file" ; done
    Or put those in an array:
    IFS=$'\n' ; files=($(find "$HOMEDIR" -type f)) ; unset IFS
    for file in "${files[@]}" ; do something with "$file" ; done
    The later method is useful when elements of "${files[@]}" will be used multiple times across the script.
    Last edited by lolilolicon (2009-11-09 08:13:07)

  • How to call a oracle procedure with in/out parameter frm unix shell script?

    Hi,
    I need to call an oracle stored procedure from unix script. The procedure has 1 input parameter and 2 output parameter. Please send me the syntax for the same. Based on the output values of procedure, I have to execute some more commands in unix script.
    Thanks and regards
    A

    An example :
    TEST@db102 SQL> select ename, job from emp
      2  where empno = 7902;
    ENAME      JOB
    FORD       ANALYST
    TEST@db102 SQL> create or replace procedure show_emp (
      2     v_empno in      number,
      3     v_ename out     varchar2,
      4     v_job   out     varchar2 )
      5  is
      6  begin
      7     select ename, job into v_ename, v_job
      8     from emp
      9     where empno = v_empno;
    10  end;
    TEST@db102 SQL> /
    Procedure created.
    TEST@db102 SQL> exit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    [ora102 work db102]$ IN=7902
    [ora102 work db102]$ set `sqlplus -s test/test@db102 << !
    var out1 varchar2(30);
    var out2 varchar2(30);
    set pages 0
    set feed off
    exec show_emp($IN,:out1,:out2);
    print
    exit
    `[ora102 work db102]$ echo $1 $2
    FORD ANALYST
    [ora102 work db102]$                           

  • Problem with save as action in CS4 PS script

    Hi,
    I am just beginning to script and I am encountering an Error message when running this particular snippet, which was taken from the CS4 scripting Guide
    This is the part of script that is causing a problem, anybody know why its giving me an error message? I've been searching around a lot and cant seem to figure it out...
        app.activeDocument.flatten () ;
        jpgFile = new File( "/Temp001.jpeg" );
         app.activeDocument.saveAs(jpgFile);
    Thank you!

    Im a newbie working out of a mac so im not sure how to define the file path :/
    Since my file was originally a psd file, I tried inserting the jpeg option as you suggested, from the scripting guide as follow :
    app.activeDocument.flatten () ;
        jpgFile = new File( "/Temp001.jpeg" );
        jpgSaveOptions = new JPEGSaveOptions();
        jpgSaveOptions.embedColorProfile = true;
        jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
        jpgSaveOptions.matte = MatteType.NONE;
        jpgSaveOptions.quality = 5;
    app.activeDocument.saveAs(jpgFile, jpgSaveOptions, true,Extension.LOWERCASE);
    but its still giving me the same error message...
    thank you very much for your reply, hope you can help me some more !

  • Problems with https web pages and my iptables scripts

    [root@Arch root]# iptables -A INPUT -p tcp -i eth0 --sport https -j ACCEPT
    iptables v1.2.10: invalid TCP port/service `https' specified
    Try `iptables -h' or 'iptables --help' for more information.
    Why?
    In others distro it works perfectly ...

    the iptables comparison is performed on the packet itself, and its contents. If you sniffed the packet, you would see that the source for the packet is the machine of the person requesting the website, and the destination of the packet would be your server.
    Since the packet is allowed in the the rule, it gets to the box. The outgoing return data is either allowed by default (some people let anything out, but only filter incoming) or allowed via connection tracking (since it is part of a message that was allowed in, it gets allowed out).
    You can do a man iptables to find all kinds of other info, and searching google helps too. Best thing of all to do is just fire up a packet sniffer and watch...
    8)

  • Open Create Replace problems with saving file patterns

    Hello, I got a problem with open/replace/create function. Could you please clarify each function how it works? As you can see in my file, I try to save into the specified file path. The values appear in the text file but when I change some values in the data mainstream, it replaces the old value it has been. I want to have the whole data in one file till I close it and open another file for the operation.
    How can I do it??
    Thank you
    Solved!
    Go to Solution.
    Attachments:
    Values Measurement 1-main.vi ‏34 KB

    Hi,
    I can't see your VI as it is in a newer version of LabVIEW than I have, so if you want any more specific help you'll need to save the VI as a previous version. (File -> Save as previous version) I have LabView 2009.
    However, I have made a quick little example you could use. You don't need to use Set File Position if you use Shift Registers, as shown in the attached picture.
    David.
    Attachments:
    WritetoFile-simple.png ‏21 KB

  • Problem with total page numbers in Scripts

    Hi,
    I have a problem with total number of pages in the Script.
    I have a script of 15 pages.
    On every page, I am using &PAGE& of &SAPSCRIPT-FORMPAGES(C)&.
    Problem is : I am getting only single digit for SAPSCRIPT-FORMPAGES as long as the page number remains in single digit - like -
    1 of 1
    2 of 1
    3 of 1... till 9 of 1.
    But from 10th page, it is printing :
    10 of 15
    11 of 15
    12 of 15... till 15 of 15.
    So, i think the symbol SAPSCRIPT-FORMPAGES(C) is filled with value 15 , but it is prinitng only the first digit '1' for pages 1 to 9 and then printing both the digits '15' for pages from 10 onwards.
    So, please help me out in this problem.
    Thank you.

    Hi Ven,
    The CONDENSE option cannot be used on the program icon SAPSCRIPT-FORMPAGES
    (C) without an explicit length specification: This symbol is
    only replaced with a value after the form has been completely edited, as the
    total number of pages of a form is first known in the program function
    END_FORM or CLOSE_FORM. However, the size of the symbol (number of
    characters) is reserved correctly when the symbol first occurs, with the
    current page number. Therefore, only one character is reserved for option C
    (CONDENSE) on pages 1-9, two characters on pages 10-99, and so on.
    If you are sure that the total number of pages doesn't cross 99(i.e 2-digit number), then use the FORM pages as SAPSCRIPT-FORMPAGES(2CZ).
    Here Z will suppress the leading zeros, for the total number of pages.
    Hope this information would be useful for you.
    Reward points if this is useful.
    Pavan.

  • "There is a problem with this installer package - script is required to complete install," - please can someone clarify script supplied.

    I have downloaded EMET 4.1 but it will not install -
    "There is a problem with this Windows installer package. A script required for this install to complete. Contact your support personnel or package vendor."
    I have seen the same problem answered in the support section with a script posted as follows, and wondered if it would solve my problem - only  there is no explanation with it and I have no idea what to do with it! Forgive my ignorance but could someone
    please explain what to do with it please? Many thanks.
    (I looked up the other thread but I was no wiser.)
    This thread is probably a dublet of http://social.technet.microsoft.com/Forums/pt-BR/ab0ee94b-ce61-4a62-8478-41a1e8ac39e2/emet-40-installation-fails-with-error-code-1720?forum=emet
    Please create and check a verbose Installer logfile: msiexec.exe /?
    _FA2E7A16_A819_4F3A_AB7E_0A039BE81BD7 refers the Custom Install Action Blob _6A58D16B437E5B268B3B9D09B8746240 which conatins this vb script in EMET 4.1:
    ' Begin
    REM kill the old EMET 3.0 Notifier process if running (upgrade scenario)
    strAppName = "emet_notifier.exe"
    Set objProcesses = GetObject("winmgmts://" & strMachine).ExecQuery("SELECT * FROM Win32_Process WHERE Caption LIKE '" & strAppName & "'")
    For Each objProcess In objProcesses
        intRetVal = objProcess.Terminate(0)
    Next
    REM kill EMET Agent 4.0 process if running (re-installing scenario)
    strAppName = "emet_agent.exe"
    Set objProcesses = GetObject("winmgmts://" & strMachine).ExecQuery("SELECT * FROM Win32_Process WHERE Caption LIKE '" & strAppName & "'")
    For Each objProcess In objProcesses
        intRetVal = objProcess.Terminate(0)
    Next
    ' End

    Managed to get the installation sorted. Go to Control Panel, and where you have a list of all installed programs, repair all the Apple/Itunes related programs. Installation worked fine after that. Hopefully it helps you out too!

  • Shell Script to send email with .txt file as attachment

    Dear Al,
    Could any one help me with code, for sending email with .txt file as attachment using shell script.
    Thank You!

    978334 wrote:
    Dear Al,
    Could any one help me with code, for sending email with .txt file as attachment using shell script.
    Thank You!http://bit.ly/XHfSCz
    https://forums.oracle.com/forums/search.jspa?threadID=&q=sendmail&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

Maybe you are looking for

  • Can you use a webcam as an external iPhone 5 camera?

    Reason I ask is because it would help me out at my job, and might be helpful to someone else. I work a resident manager at a storage facility (live on site) and we have to mirror check units to make sure people aren't storing what they are not suppos

  • Flash Builder 4.6 on Mac 10.7

    I have installed Flash Builder 4.6 on my mac running osx version 10.7.4. After running plugin utility over my downloaded eclipse  32 bit Indigo Service Release 2, I dont see flash builder installed as a plugin. To confirm there is no option to create

  • How to use Java Messaging

    Hi Want to implement an SMS application. Need queues for the same I'm using java 1.5.0_04. How do i use JMS. Regards,

  • Desktop Manager crashes upon connection

    Just installed BB Desktop Manager 5.0, after removing the previous installation using the "clean uninstall" process suggested elsewhere on this Board (i.e. eliminating RIM and Puma entries in the registry). v 5.0 is syncing with my BB 8830 just fine

  • How to customize the landing page of Power BI application in a Office 365 Site?

    Hi, While we navigate to the Power BI application by clicking the icon from the Site Contents of a Office 365 site, everything is loaded in it. But we would like to customize / edit the page, so that all users will see the contents we put in. We are