Trying to write a simple apple script to reveal a file.

This is what I have now:
tell application "Finder" to reveal POSIX path of "/Users/lloyd/Desktop/my file.txt"
but I get this error:
error "Finder got an error: Can’t make \"/Users/lloyd/Desktop/my file.txt\" into type item." number -1700 from "/Users/lloyd/Desktop/my file.txt" to item
Any help is much appreciated

Thanks for the quick answer.  Tried changing to file but am now getting this error:
error "Can’t get POSIX file of \"/Users/lloyd/Desktop/my file.txt\"." number -1728 from POSIX file of "/Users/lloyd/Desktop/my file.txt"
btw, I meant to type reveal instead of open but don't think that should be a problem right?  The file exists on the desktop, does the space in the file name create a problem?

Similar Messages

  • Where can I learn how to write my own Apple Script?

    I am trying to write a script to enable me to schedule email message delivery for a later time for those instances where I'm not around to physically push the send button.  I am leary of downoading scripts written by someone else, for all I know they could be Cc'ing thesmelves on every message I send using their script.
    So, I'd like to write my own.  That is, unless someone has a better and secure way of going about this.
    This is somewhat pressing.  I would appreciate any feedback you can offer.

    There are two parts to your request - generating an email, and sending it on a set schedule.
    Generating an email in AppleScript isn't hard - there are numerous examples online of how to do this, but the scheduling element is the tricky part. There's no built-in task scheduler in AppleScript (other than the simple 'delay' command), which is why people often opt for iCal which can run an AppleScript as part of an event alarm. That can get cumbersome, though, depending on the frequency and volume of emails you're sending.
    There are a few third-party tools such as iDo or PowerManager, so they might be worth checking out. If you want to roll your own you'll need to work out some method of asking the user when a message should be sent and integrating that into your own task manager - not a trivial topic.

  • Trying to write an SQL import script

    Hello All,
    I am trying to write a bulk importer for data for my clients and I am just about there. However I am running into a problem updating records in a second table.
    I want to do all this through the SQL Server for resource purposes.
    The SQL statement will go through the entire temp table (users to be added or updated) and compare it to the main existing table. First it will compare records and determine who are exactly the same (no changes) and then delete those records out of the temp table. Now it will find the records that are in the table (by employee ID), but have changes in their profiles (name, number, etc.).
    This is my problem:
    When I compare the phonenumbers in a separate table, which are connected by a sub_id. Example
    Main Table: (Fields) sub_id, fname, lname, address, groups, subgroups, etc.
    Phonenumbers Table: sub_id, account_id, sub_user_number, active
    Right now, I am performing update statements:
    -- Update sub_user_number
    print('Update sub_user_number');
    print('  -sub_user_number3');
    UPDATE WENS..SUBSCRIPTION
    SET sub_user_number = i.sub_user_number3
      FROM WENS_IMPORT..IMPORT_INSPIRON i INNER JOIN WENS..SUBSCRIPTION s
       ON i.misc1 = s.misc1
      LEFT JOIN WENS..ACCOUNT_USER_GROUPS g
       ON g.sub_id = s.sub_id
      WHERE s.account_id = @account_id
      AND isnull(i.sub_user_number, '') <> isnull(s.sub_user_number, '')
      AND g.group_id IN (@group_id)
    The problem is that if I have three numbers, it updates all three numbers with the same number.
    Ideally what I would like to do is completely delete the numbers and then re-enter them. For example:
    Perform a DELETE of all numbers out of PHONENUMBERS table where maintable.sub_id = temptable.sub_id
    LOOP through numbers found in temptable
    INSERT new number into PHONENUMBERS (sub_id, account_id, active, sub_user_number)
    END LOOP
    Therefore at the end of the loop, we will have entered three numbers (two that were originally in there and one that is new)
    Could someone help me with the SQL syntax that will work in SQL Server Query analyzer?
    Thank you VERY much for anything you all can do.

    LOOP through numbers found in temptable
    I have only skimmed this thread, but I would say do not loop unless it is truly needed.  Databases are designed to work best with "sets" of information. So it is usually more efficient to process a group of records than one record at a time.
    What I usually do with imports is run a series of bulk updates on my #temp table(s) to identify which items are "new" which ones are "changed". When finished I can easily JOIN to the base tables and do a single UPDATE for changed records and INSERT for new records.  Usually a lot more efficient than looping one record at a time.
    I want to do all this through the SQL Server for resource
    purposes.
    BTW: Not to ignore your question, but database questions are usually best answered in a database forum (in your case MS SQL).  Because once you get the information into the #temp table, it is strictly sql from there and any database guru could assist. They do not have to know anything about CF ;-)
    Message was edited by: -==cfSearching==-

  • Apple script to batch rename files by deleting tags on front and back of the file name

    Hi, I'm trying to rename a couple thousand files from their current format:  "01074_Something Of A Dreamer_Mary-Chapin Carpenter.lrc"
                                                                                                                           "01075_Where Did We Go Right_Lacy J. Dalton.lrc"
                                                                                                                           "01076_Everybody's Reaching Out_Crystal Gayle.lrc"
                                                                                                         To simply:  "Something Of A Dreamer.lrc"
                                                                                                                           "Where Did We Go Right.lrc"
                                                                                                                           "Everybody's Reaching Out.lrc"
    I just want to delete the number tag on the front and the artist name at the end for all of the files.  I imagine a Script to do this wouldn't be too hard to write, something along the lines of read file name after the first '_' character it reads until it reads a second '_' character and rename the file to the string it reads between those two underscores with .lrc at the end.
    Unfortunately I know nothing about Apple Script other than it seems like the thing I would need to automate this process based on my limited google searches.  If someone could help me out with some advice on how to go about making this script or obviously if you simply have and/or can quickly write a script to do this it would be greatly appreciated!

    Here:
    tell application "Finder"
    repeat with this_file in (get files of window 1)
    set the_name to name of this_file
    set temp_name to items ((offset of "_" in the_name) + 1) thru -1 of the_name as string
    set temp_name to (items 1 thru ((offset of "_" in temp_name) - 1) of temp_name as string) & items -4 thru -1 of the_name as string
    set name of this_file to temp_name
    end repeat
    end tell
    (123647)

  • Automator or Apple Script To Move Multiple Files to Multiple Folders

    I was just wondering, is there any sort of automator workflow or maybe apple script that will allow me to automate the following:
    I have a folder named SCANS containing multiple different files that need to go to multiple different folders.
    So Say I have:
    SCANS
    and in this folder I have ten files named A,B,C,D,E,F,G,H,I,J and I want each of these files to be moved to different folders eg.
    A I want to go to folder 1
    B I want to go to folder 2
    C I want to go to folder 3 etc etc.
    Anyone know if there is a way of doing this please?
    I have tried a workflow where I find finder items in the Scans folder and move to another but that only seems to work for one file.  When I add more it does not seem to work.
    Any help/guidance would be appreciated.
    Thank you!

    Hi Niel,
    Not quite what I wanted because I missed some information from my question....
    What I actually want is to search for files containing certain text in the name and if positive to then move that file to the specified folders.
    Cheers.

  • Apple Script to rename single files in folders

    Hey guys, I am trying to write a script to automatically rename a lot of files.  Here is the situtation:
    I have a MainFolder with many SubFolders inside.  Inside each SubFolder is 1 word document.  Is there a way to write a script that automatically renames each of of those word documents to its folder's name.  Example.
    BEFORE:
                      -SubFolder1 - 1.doc
                      -SubFolder2 - 1.doc
    -MainFolder -SubFolder3 - 1.doc
                      -SubFolder3 - 1.doc
    AFTER:
                      -SubFolder1 - SubFolder1.doc
                      -SubFolder2 - SubFolder2.doc
    -MainFolder -SubFolder3 - SubFolder3.doc
                      -SubFolder3 - SubFolder4.doc
    Thanks.

    The following script should do what you are asking for:
    set mainFolder to choose folder
    tell application "Finder"
        repeat with thisFolder in (get folders of mainFolder)
            try
                set name of (file 1 of thisFolder whose name extension is "doc") to (name of thisFolder & ".doc")
            end try
        end repeat
    end tell
    If there's just one file in each subfolder (wich is not exactly the same as “one Word document”), you could remove the “whose name extension is "doc"” filter.

  • Tidy -- simple python script to clean annoying files and directories

    Hi all,
    recently I opened a much-used flash drive and there was a lot of files like Thumbs.db, Mac OS' ._*, .DS_Store, etc all over it, making using it really annoying.
    So I decided to mimic a simple utility I saw as a plugin in Rockbox, which takes all of these files and deletes them.
    The result is a simple python script which you can find at:
    http://github.com/houbysoft/short/blob/master/tidy
    Usage should be self-explanatory. Be warned, by default, it deletes everything that matches the regular expressions without warning (this should be fine though, so if you want to be safe, try the -s and -v (simulate, verbose) or -p (prompt) options first.
    As usual, any feedback is welcome, and if you know of other files it should clean, please post them here!

    Hi all,
    recently I opened a much-used flash drive and there was a lot of files like Thumbs.db, Mac OS' ._*, .DS_Store, etc all over it, making using it really annoying.
    So I decided to mimic a simple utility I saw as a plugin in Rockbox, which takes all of these files and deletes them.
    The result is a simple python script which you can find at:
    http://github.com/houbysoft/short/blob/master/tidy
    Usage should be self-explanatory. Be warned, by default, it deletes everything that matches the regular expressions without warning (this should be fine though, so if you want to be safe, try the -s and -v (simulate, verbose) or -p (prompt) options first.
    As usual, any feedback is welcome, and if you know of other files it should clean, please post them here!

  • Hi i am trying to write a program which reads from a properties file the pr

    hi,
    this is ayesha.
    I am trying to write a program wherein i will be reading the value of a property from a properties file which will be true initially. I want to loop in there till the time when the value of the property is false.
    The code is as follows:
    public static void main(String[] args) {
              ReadingAPropertiesFile propers=new ReadingAPropertiesFile();
              propers.ReadingFileRegularly("F:\\ayesha.properties");
    public String ReadingFileRegularly(String FilePath){
              Properties props = new Properties();
              String message;
              String filePath=FilePath;
              try {
    props.load(new FileInputStream(filePath));
    message = props.getProperty("ayesha");
         boolean theValue = Boolean.parseBoolean(message);
         while(theValue){
              System.out.println("trueeeeeeeeeeeeeeeeeeeeeee");
              Thread.sleep(60000);
              ReadingFileRegularly(filePath);
              catch(Exception ex){
                   ex.printStackTrace();
              String messagean="something";
              return messagean;
    The contents of ayesha.properties are :
    ayesha=true
    After 5 minutes it will be set to false so i want to loop in there till the value of ayesha=false at which time i will return
    But i dont know how to loop in there for that time:
    while(theValue) ?????????????/ what after this???????????
    Any suggestons are awaited.

    ayeshaparween wrote:
    hi,
    this is ayesha.
    I am trying to write a program wherein i will be reading the value of a property from a properties file which will be true initially. I want to loop in there till the time when the value of the property is false.
    The code is as follows:
    public static void main(String[] args) {
              ReadingAPropertiesFile propers=new ReadingAPropertiesFile();
              propers.ReadingFileRegularly("F:\\ayesha.properties");
    public String ReadingFileRegularly(String FilePath){
              Properties props = new Properties();
              String message;
              String filePath=FilePath;
              try {
    props.load(new FileInputStream(filePath));
    message = props.getProperty("ayesha");
         boolean theValue = Boolean.parseBoolean(message);
         while(theValue){
              System.out.println("trueeeeeeeeeeeeeeeeeeeeeee");
              Thread.sleep(60000);
              ReadingFileRegularly(filePath);//recursive call this is a bad idea might result in stack overflow error
              catch(Exception ex){
                   ex.printStackTrace();
              String messagean="something";
              return messagean;
    The contents of ayesha.properties are :
    ayesha=true
    After 5 minutes it will be set to false so i want to loop in there till the value of ayesha=false at which time i will return
    But i dont know how to loop in there for that time:
    while(theValue) ?????????????/ what after this???????????
    Any suggestons are awaited.I think you better rethink your design , do not use recursion, I would normally use a loop like you did but without loading the content of the file each time, I would use File.l lastModified() method and compare with previous results from this method to see if the file was modified. Then if it was modified then load the new File and check if the property value has changed.

  • Simple BASH script to update subversion files

    This is just a simple BASH script that will update all .svn files in a specified directory.  If an update fails, it will attempt to update all the subdirectories in the failed one, so as much will be updated as possible.  Theoretically, you should be able to supply this script with only your root directory ( / ), and all the .svn files on your computer will be updated.
    #! /bin/bash
    # Contributor: Dylon Edwards <[email protected]>
    # ================================
    # svnup: Updates subversion files.
    # ================================
    #  If the user supplies no arguments
    #+ then, update the current directory
    #+ else, update each of those specified
    [[ $# == 0 ]] \
        && dirs=($PWD) \
        || dirs=($@)
    # Update the target directories
    for target in ${dirs[@]}; do
        # If the target file contains a .svn file
        if [[ -d $target/.svn ]]; then
            # Update the target
            svn up $target || {
                # If the update fails, update each of its subdirectories
                for subdir in $( ls $target ); do
                    [[ -d $target/$subdir ]] &&
                        ( svnup $target/$subdir )
                done
        # If the target file doesn't contain a .svn file
        else
            # Update each of its subdirectories
            for subdir in $( ls $target ); do
                [[ -d $target/$subdir ]] &&
                    ( svnup $target/$subdir )
            done;
        fi
    done

    Cerebral wrote:
    To filter out blank lines, you could just modify the awk command:
    ${exec awk '!/^$/ { print "-", $_ }' stuffigottado.txt}
    very nice; awk and grep: two commands that never cease to amaze me.

  • Simple Apple Script Required

    Hey
    Im looking for a simple AppleScript i can run on client workstations , The Script ideally needs to do the following ..
    - Find any files in the User's Home folder with a Creation date older than 3 years ago.
    - Display the files and allow user to delete.
    Im sure this is quite simple for someone who knows what there doing with AppleScript ! , anyone have any simple scripts they could suggest ?
    Cheers

    Well, getting a list of files is one thing (there are several shell utilities), getting them in a Finder window so you can do various things with them is another. There isn't much AppleScript support for the Finder's Find…, and saved searches don't appear to be portable. GUI scripting is more akin to voodoo, but I figured I would give it a shot to see if I could get close.
    The following script pastes the appropriate search term in the Search item in a Finder window's toolbar. Getting the search to start in a specific place is a bit goofy, but if you have navigated to the desired folder, running the script should start the search from there:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 340px;
    color: #000000;
    background-color: #FFDDFF;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    -- enter a search term in the Finder's search toolbar item
    -- set the search date
    tell ((current date) as «class isot» as string)
    (get text 1 thru 4) - 3 -- the current year - 3
    set SearchDate to text 6 thru 7 & "/" & text 9 thru 10 & "/" & result
    end tell
    -- make sure there is a Finder window and the toolbar is showing
    tell application "Finder"
    activate
    if (get windows) is {} then set target of (make new Finder window) to path to home folder
    if not toolbar visible of front window then set toolbar visible of front window to true
    end tell
    -- enter the search term into the search text field, if present
    tell application "System Events"
    if UI elements enabled then
    get value of attribute "AXRoleDescription" of text field 1 of group 1 of tool bar of front window of application process "Finder"
    if (result as text) is "search text field" then -- toolbar search item exists
    set value of text field 1 of group 1 of tool bar of front window of application process "Finder" to "created:<=" & SearchDate
    else -- oops
    activate
    display dialog "This script needs to use the Search item on the toolbar - please customize the Finder toolbar to include Search." with title "Find by creation date" buttons {"OK"} default button 1
    end if
    else
    tell application "System Preferences"
    activate
    set current pane to pane "com.apple.preference.universalaccess"
    display dialog "This script needs UI element scripting enabled. Check \"Enable access for assistive devices\" and try again." with title "Find by creation date" buttons {"OK"} default button 1
    end tell
    end if
    end tell
    </pre>
    HTH

  • Create a simple shell script thing?

    Hey,
    I'm trying to make a simple command script thing. I have no idea what I'm doing though.
    I just want a file that I can click and open in terminal that will:
    1. ssh [email protected]
    2. auto enter the password (if this is really complicated then it can be skipped)
    3. cd public_html/blog
    4. svn up
    5. like 5 sec delayed exit (if possible)
    I'm thinking this is a really easy thing to do for someone who knows what they're doing.
    So can someone tell me what I have to do to make this? I would really like to learn how to do this.
    Thank you
    Last edited by FLCLFan (2008-10-12 20:06:20)

    Instead of making a script, you could just as well write a bash function for this and put it in your .bashrc.
    something like this:
    update-svn-on-domain ()
    ssh -t [email protected] 'svn up public_html/blog'
    when the svn up is done, the ssh command stops, and the function returns.  it does everything you want except auto entering passwords. 
    i strongly discourage auto entering passwords.  i recommend you to setup rsa key authentication

  • Install and uninstall of dmg file using Apple script in Mac 10.6 and higher version.

    Hi ,
    Could anyone please help me to write a Apple script to Install dmg file and do clean uninstall in Mac 10.6.8 and higher version.
    My requirement is:
    When i run script : it has to install the dmg file which is located inside one desktop folder say 'New Folder'
    I need to do clean unistall when i run the script: i need to delete the folder in ~/Library- locate folder say  'CPSPCSHOWSERVER'' move to trash and from Terminal type in command "rm -r ~/.CPS' to completely delte this folder.
    Really appreciated all ur help!!
    Thanks,
    KT.

    http://macfidelity.de/2008/08/30/how-to-mount-a-dmg-from-terminal-in-mac-os-x/in dex.html
    http://osxdaily.com/2011/12/17/mount-a-dmg-from-the-command-line-in-mac-os-x/
    http://hints.macworld.com/article.php?story=20030614230204397
    http://www.commandlinefu.com/commands/view/2031/install-an-mpkg-from-the-command -line-on-osx

  • Using c++ variable in apple script

    Hi all,
    I am just calling the apple script from my indesign plugin.
    I need to pass the c++ variable to apple script for opening a file
    This in my apple Script which i have embedded in c++ code
    tell application "TextEdit"
    activate
    open "Users:User1:Library:Preferences:Adobe Indesign:Version 5.0:MathEQ.txt"
    end tell
    The filepath "Users:User1:Library:Preferences:Adobe Indesign:Version 5.0:MathEQ.txt" is stored in the C++ variable char* textFileName.
    I need to use the variable textFileName in apple script which has the path.
    How to go about it?
    Thanks
    Sakthi

    I have a similar problem trying to get data from any field into an AppleScript variable.
    Something like *set phoneNumber to cell "Phone Number" of current record* works fine if you are using the script from a layout that has this field on it.
    But I have a lot of fields on different layouts and I want to have access to all fields in the table, no matter what layout they are on, or what layout is currently active.
    And I want to do this without having to specify on what layout each field is located.
    In the past (FileMaker 6) I used something like *set phoneNumber to (cell "Phone Number" of current record of database 1)* but this is no longer working in FileMaker 9.
    So I was thinking to use something like *set phoneNumber to cell "Phone Number" of current record of table "Table Name"* but that doesn't seem to work.
    The only thing that seems to work is *set phoneNumber to cell "Phone Number" of current record of layout "Layout Name"* but as I said, I don't want to specify the layout for each field.
    Any ideas anyone?
    Message was edited by: khasmir

  • Text Editor (trying to write my own)

    I am trying to write a simple text editor with a 'Find' option.
    Is JEditorPane the right class to use?
    How would I search for a certain string and then scroll to make it appear at the top of the window?
    Thanks,
    Elena

    Hi Elena,
    JEditorPane is 'just' showing contents which are actually coming from a Document. So class Document and its descendants would be the one to be searched.
    Keeping performance and optimization out of sight, using class ElementIterator to iterate through all Elements of a Document could be a way to start with. Each Element can represent content, which then would have to be tested on the text to be found.
    Once an occurence of the searched text portion is found, the Element having the respective content has properties (getStartOffset and getEndOffset) to find out the position within the Document to scroll to.
    Pls see the API docs for the mentioned classes too.
    Hope this helps.
    Ulrich

  • Help! Trying to write to a BLOB column

    I am trying to write to a BLOB column.
    I insert a row with an empty BLOB (using the emppty_blob())
    I then get the locator of the blob by using a select statement
    that is marked 'for update' (autocommit is set to 'false')
    I use the blob.getBinaryOutputStream() method to get an
    outputstream and when I write outputstream.write(byte[], 0,
    length) nothing happens!?
    (I am trying to write a simple byte array {1,2,3,4,5,6,7,8,9,0})
    Please help!
    Thanks,
    Eli
    null

    Hi,
    just to exclude a simple possibility:
    did you call "commit" after you've inserted/updated
    the blob field?
    If yes, could you please post your code?
    Eli (guest) wrote:
    : I am trying to write to a BLOB column.
    : I insert a row with an empty BLOB (using the emppty_blob())
    : I then get the locator of the blob by using a select statement
    : that is marked 'for update' (autocommit is set to 'false')
    : I use the blob.getBinaryOutputStream() method to get an
    : outputstream and when I write outputstream.write(byte[], 0,
    : length) nothing happens!?
    : (I am trying to write a simple byte array
    {1,2,3,4,5,6,7,8,9,0})
    : Please help!
    : Thanks,
    : Eli
    null

Maybe you are looking for

  • Adobe Output Designer Migration

    Hello, our customer has implemented Adobe Output Designer version 5.6 in Poland. We were asked for outsourcing of their Adobe printing solution. Could somebody help us please to answer the following questions: 1) Is it possible to migrate content of

  • Save game and load game??

    i wrote a simple word base Rpg game, try to save some data and positions to a file, but dont know why it just allows me to save integer from 0-255?? why?? can anyone help? the code is following, public void Save () throws IOException {           x =

  • When I'm running Firefox 4, I can't run Adobe Photoshop (message reads "attempt to access invalid address" - what can I do?

    When I'm running Firefox 4, I can't run Adobe Photoshop Elements 5.0 at the same time. I get an error message which reads "attempt to access invalid address". When I stop running Firefox, I can use Photoshop again. What can I do?

  • Proration not working?

    I was on a 4 GB data plan, had used 2.89GB in the first 29 days.  29/31 of 4GB is 3.74GB, so I had already paid for that and could not avoid those charges.  I had .85 GB left, paid for, and can't avoid paying for.  I wanted 2GB for next month, and fi

  • Video files are slow to respond with "get info"

    When trying to change the file information with the Get Info, it takes 40/41 seconds for each file to open. If I change one file from movie to tv show and select next, it will also take 41 seconds to load the next file. I dont know if its the new itu