AppleScript file path difficulties

I'm trying to create a script that will do two things: 1) check for the existence of certain files, and 2) move those files to the trash. I need to do #1 so that I can tell the user that a particular set of files was found and removed, and I need to do #2 using a shell script with admin privileges.
The code I've written so far works great, as long as I use absolute paths. As soon as I try to refer to the user folder using the tilde ('~') symbol, though, it all falls apart. Although I can hard-code the paths for the most part, I cannot hard-code the username.
How can I make this work for a path in the user's home folder? The code in question is below:
-- Given a list of path strings, returns a list of POSIX paths, quoted for use in shell scripts
on CreateQuotedPOSIXPathList(pathStrings)
          set thePOSIXPaths to {}
          repeat with thePath in pathStrings
                    set thePOSIXPaths to thePOSIXPaths & {quoted form of the POSIX path of thePath}
          end repeat
          return thePOSIXPaths
end CreateQuotedPOSIXPathList
-- Given a list of quoted-form POSIX file paths, moves all files in the set to the trash
-- Returns true if at least one file was found, false if none existed
on MoveFilesToTrash(fileList)
          set someWereFound to false
          repeat with oneFile in fileList
                    if exists oneFile then
                              set someWereFound to true
                              set theCommand to "mv " & oneFile & " ~/.Trash"
  do shell script theCommand with administrator privileges
                    end if
          end repeat
          return someWereFound
end MoveFilesToTrash
set fileList to {"/Users/thomas/Desktop/test", "/Users/thomas/Desktop/test file"}
set pathList to CreateQuotedPOSIXPathList(fileList)
MoveFilesToTrash(pathList)

Here:
-- Given a list of path strings, returns a list of POSIX paths, quoted for use in shell scripts
on CreateQuotedPOSIXPathList(pathStrings)
set thePOSIXPaths to {}
repeat with thePath in pathStrings
set thePOSIXPaths to thePOSIXPaths & {quoted form of the POSIX path of thePath}
end repeat
return thePOSIXPaths
end CreateQuotedPOSIXPathList
-- Given a list of quoted-form POSIX file paths, moves all files in the set to the trash
-- Returns true if at least one file was found, false if none existed
on MoveFilesToTrash(fileList)
set someWereFound to false
repeat with oneFile in fileList
if exists oneFile then
set someWereFound to true
set theCommand to "mv " & oneFile & " ~/.Trash"
do shell script theCommand with administrator privileges
end if
end repeat
return someWereFound
end MoveFilesToTrash
set fileList to {"/Users/thomas/Desktop/test", alias (((path to desktop) as string) & "untitled")}
set pathList to CreateQuotedPOSIXPathList(fileList)
MoveFilesToTrash(pathList)
(105794)

Similar Messages

  • File path applescript broken after snow leopard

    I was using this script in illustrator cs4 on a mac running 10.5 and all was good
    tell application "Adobe Illustrator"
    activate
    set theName to name of current document
    set theNamecount to count of theName
    set thePath to the file path of current document as string
    set pathCount to count of thePath
    set pathCount to (pathCount - theNamecount)
    set newPath to (text 1 thru pathCount of thePath)
    set newName to "Die for " & theName
    set finalPath to newPath & newName
    save current document in file finalPath as eps ¬
    with options ¬
    {class:EPS save options, compatibility:Illustrator 8, preview:color Macintosh, embed linked files:true, include document thumbnails:true, CMYK PostScript:true, PostScript:level 2, embed all fonts:true}
    beep 2
    activate
    end tell
    Then I upgraded to Snow Leopard now when i run the script I get this message
    error "Can’t make «data fss 9CFF84A2B8001F4F75747369646520436F7665722046696E616C2031234238413241332E61690000000064E76 706D8298F1EE9D902207CE1FFBF28E1FFBF88578F1EE9D90220» into type string." number -1700 from «data fss 9CFF84A2B8001F4F75747369646520436F7665722046696E616C2031234238413241332E61690000000064E76 706D8298F1EE9D902207CE1FFBF28E1FFBF88578F1EE9D90220» to string
    Thanks in advance.
    Rod

    G'day Rod
    Your script returns...
    error "Can’t make POSIX path of «data fss 9CFF6D0609001B33303234302D3930343537205B436F6E7665727465645D2E657073CDCC00000001616946532 3ECF0381D9748CC1D5E0A34BFFFCE70636F72650000000A033B» into type string." number -1700 from POSIX path of «data fss 9CFF6D0609001B33303234302D3930343537205B436F6E7665727465645D2E657073CDCC00000001616946532 3ECF0381D9748CC1D5E0A34BFFFCE70636F72650000000A033B» to string
    I'm running an intel iMac, so perhaps it's something to do with that.
    I'm now using this very cumbersome approach...
    on FetchFileContainer()
    tell application "Adobe Illustrator"
    set fp to do javascript "activeDocument.path"
    end tell
    set fp to my convertString(fp, "%20", " ") as text
    set newerPath to (POSIX file fp) as text
    set newerPath to newerPath as text
    if "Desktop" is in newerPath then
    set newerPath to newerPath & ":"
    repeat 3 times
    set o to offset of ":" in newerPath
    try
    set newerPath to items (o + 1) thru end of newerPath as text
    on error
    if newerPath = "Desktop:" then set newerPath to ""
    end try
    end repeat
    set ptd to path to desktop as text
    set newerPath to ptd & newerPath
    end if
    set C to newerPath
    if "desktop" is not in newerPath then
    set o to offset of ":" in newerPath
    set newerPath to items (o + 1) thru end of newerPath as text as alias
    tell application "Finder"
    try
    set C to container of (newerPath)
    end try
    end tell
    end if
    return C as text
    end FetchFileContainer
    on convertString(tString, ToFind, Tochange)
    set {oAStid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ToFind}
    set tString to text items of tString
    set AppleScript's text item delimiters to Tochange
    set tString to tString as string
    set AppleScript's text item delimiters to oAStid
    return tString
    end convertString

  • Using AppleScript/Automator to get file path and create AFP hyperlink

    Hi All,
    A colleague has asked for a service (contextual menu item in Finder) to get a selected item's remote (afp://) file path and copy it to the clipboard...  Pretty sure I've got that part down. 
    What I need advice on is how to make the resulting pasted file path into a serviceable hyperlink.  AFP keeps telling me there was an error connection to the server....  Does the copied path have to include mounting commands and user credentials for this to work??
    Thanks,
    Nathan

    Hi Richard - here's the script:
    tell application "Finder"
              set sel to the selection as text
              set TempTID to AppleScript's text item delimiters
              set AppleScript's text item delimiters to space
              set sel to text items of sel
              set AppleScript's text item delimiters to "%20"
              set sel to sel as string
              set AppleScript's text item delimiters to TempTID
    set the clipboard to "file://" & POSIX path of sel
    end tell

  • Applescript problem - file path

    I have an applescript file that I have often used.  I am trying a new approach to calling it.  My test script is as follows:
    set scriptAlias to "HImacInternal:Users:HI:Desktop:Applescripts:EXPORTiCAL12" as alias
    run script scriptAlias
    The response I get is File not found, but I have checked the path on my computer and can't understand why it is not found. 
    Any ideas?

    Niel:
    Thanks for the tip..l added the extension and it worked!
    Herb

  • Snow Leopard 10.6.2 CS4 InDesign can't open files with a "#" in file path

    Snow Leopard 10.6.2 CS4 InDesign can't open files with a "#" in file path using any of these perfectly normal methods:
    1. double-click file in the Finder (e.g in a Folder on your Mac or on your Mac desktop etc.)
    2. select file and choose "File... Open" command-o in the Finder
    3. drag file to the application icon in the Finder.
    4. Select file in Bridge and double-click, choose File.. Open.. or Drag icon to InDesign icon in dock.
    If you try to open an ID file named with a "#", you will get an error message "Missing required parameter 'from' for event 'open.'"
    This happens to any InDesign file that has a "#" (pound sign, number sign, or hash) in the filename or in the file path (any parent folder).
    To reproduce
    Name an InDesign file Test#.idd Try to open it in the Finder or Bridge (as opposed to the "Open" dilaog of InDeisng itself).
    "Solution"
    The file WILL open using File... Open... command-o while in InDesign application.
    Rename the file or folders that have a "#" (shift-3) in the filename.
    Report to Adobe if it bugs you.
    This does not occur in "plain" Leopard 10.5 nor Tiger 10.4
    Untested in Panther or before and
    Untested with CS3 and earlier in Snow Leaopard.
    Anyone have those and want to try this... ?

    In case this really bothers you: we've added a workaround for this into Soxy. If you enable the option, these documents will open fine on double-click.
    You need Soxy 1.0.7 from:
    http://www.rorohiko.com/soxy
    Go to the 'Soxy' - 'Preferences' - 'Other' dialog window, and enable 'Open InDesign via Script'
    (Irrelevant background info (it's all invisible to the user): the workaround works by special-casing how Soxy opens documents in InDesign: instead of using AppleScript, Soxy will use ExtendScript to instruct InDesign to open the document - which works fine).

  • Getting the following error while attaching a .applescript file to a button

    Hi. I hav created a xcode project using cocoa application. Also I hav add a .applescript file to that project. I hav attached dat file to a button. When I build the project, got the following error . Can anybody help me out this?
    [Session started at 2010-03-02 13:02:03 +0530.] GNU gdb 6.3.50-20050815 (Apple version gdb-966) (Tue Mar 10 02:43:13 UTC 2009) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-apple-darwin".sharedlibrary apply-load-rules all Attaching to process 1705. kill
    The Debugger Debugger is attaching to process [Session started at 2010-03-02 13:03:31 +0530.] 2010-03-02 13:03:31.452 test[1717:10b] An uncaught exception was raised 2010-03-02 13:03:31.453 test[1717:10b] * -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (ASKNibConnector) 2010-03-02 13:03:31.453 test[1717:10b] Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: '** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (ASKNibConnector)' 2010-03-02 13:03:31.454 test[1717:10b] Stack: ( 2510958571, 2520804923, 2510958027, 2510958090, 2486042959, 2486048301, 2486049449, 2486041504, 2486039829, 2489002358, 2486041504, 2486039829, 2488999761, 2488998172, 2488997215, 2488997021, 2488996172 )
    [Session started at 2010-03-02 13:03:31 +0530.] GNU gdb 6.3.50-20050815 (Apple version gdb-966) (Tue Mar 10 02:43:13 UTC 2009) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-apple-darwin".sharedlibrary apply-load-rules all Attaching to process 1717. kill

    Hello Thomas,
    I am sorry but I haven't check this forum in the last weeks because of lack of time. Thanks for your hint regarding a potential solution. Taking a look a the note I have some problem in "using" it.
    This note contains a number of potential solutions regarding our problem.
    Solution 1.) one could use the modification as described. Surprising to read that SAP is saying: do a modification to solve the problem. => this is only possible "manually"  I am not sure If I will follow this approach
    Solution 2.) Change the URL: This solution scenario I do not understand. The solution path is "very" short and not very instructive. This is the story:
    You can do this by adding "_OLD" to the name of the application of the URL created for the configuration: Use "CONFIGURE_APPLICATION_OLD" instead of "CONFIGURE_APPLICATION"
    and "CONFIGURE_COMPONENT_OLD" instead of "CONFIGURE_COMPONENT". If you want to use this function as your standard, you have to change the original application. To do this, set the parameter "OLD_TR" to "X".
    This solution path is "to short". I do not get the "message" what to do.
    Furthermore: Does that mean you have to use this peculiar solution any time durnig software development of webdynpro components using configurations? In my opinion yes. This is therefore only a "workaround solution" and nothing else.
    And there can I find this parameter "old_tr" they are talking about?
    Sap note 1060287 is the "same" kind (Symptom of this note:
    If you use the configuration editor, there may be errors during transport handling or
    DYNPRO_SEND_IN_BACKGROUND crashes.).
    Here they are saying:
    "Solution
    A final solution will be provided for Release 7.0 BASIS Support Package 13."
    So in SP13 there seems to be a solution (I haven't found up to now the corresponding note). But does that now mean I must implement the complete support package?
    So I am sorry: No progress on my side up to now. May be you have had some success?
    With best regards
    Christoph

  • File path limitation across lan shared storage

    Friends,
    I realize that the mac os does not have a file path limitation and a file name limit of 255 char.
    But, Is there a path length limitation specific to adobe products ( in order to make projects more cross platform ).
    I have adobe InDesign and have projects (files) on a NAS  I am experiencing difficulties with the files on the nas.
    [ crashing the app , running slow ]  I am wondering if having files nested 10 -14 levels deep could be a problem.
    My file path length are about 80 - 200 char.
    the nas is a buffalo terrastation [ xfs ] attached 1000 mbps
    thanks

    Service that run Application Server specifies in Log
    On Tab, Log on as Local System account.
    And when I run the servlet through its url, user.name
    JAVA property is SYSTEM.
    When I log on to the server with Admin user and invoke
    the servlet's doGet method from other java class
    locally, writing is succeeded. user.name JAVA property
    in this case (when I logged on) is Admin.
    Probably I should be logged on to the system before I
    can perform operations with files on the local
    network?So Admin has permission to write to that share but 'Local System' doesn't.
    Option 1 (recommended): Check out jCifs, if you use that you can specify a different user to write to the share from that which the system is running under.
    Option 2: run the service as a user who does have appropriate permissions.
    Option 3: run the application server in the foreground instead of as a service.

  • File path to metadata

    Hi,
    Anyone knows if it´s possible to set the file path of an image to it's metadata keyword field using a script in Bridge?
    Thank you!

    maybe with a script, to pickup the path "photos/landscapes/summer/beach/shore.jpg" and put it in the keywords like this "photos;landscapes;summer;beach;shore.jpg"
    There is a dedicated Bridge Scripting forum that might have an answer on this:
    https://forums.adobe.com/community/bridge/bridge_scripting
    But to be honest, you could do a lot of this yourself in a relatively easy way.
    You have to know that you can add keywords to multiple files at once just by selecting them.
    However, your first goal should be to create your own keyword tree. This is a bit of work and needs good planning but is needed for future use and comfort. You can also use parent and child (keywords and sub keywords) and in Bridge prefs select to auto apply parent keywords for more ease of use (see further on).
    You can create your list in Bridge keyword panel by using right mouse click menu and choose keyword or sub keyword. Or use a simple text application, you need to start a new line at the beginning for each main keyword, the next line (use enter) with 1 tab creates a sub keywords, again enter with 2 tabs a sub-sub keyword.
    In your case it would mean to create the main keyword landscape, inhere the sub keyword summer, on this again a sub keyword beach, again shore and you are done for this folder.
    Now all you have to do is to select the folder shore and select all files, click on the last sub keyword shore to select it and with the correct preferences setting per above all parent keywords beach, summer and landscape are auto selected. You only have to wait for the task to be finished completely (the metadata has to be saved to the files) before starting the next task.
    There is no need for jpg as keyword and also not for photo's because all images are photo's and mostly jpeg. otherwise the result of the search could be easily filtered for correct file type.
    You can create as many keywords as you like and also many sub keywords. For instance under landscape you can create a new sub keyword for all seasons, just hold the cursor above the parent word and choose new sub keyword. This can also done for beach, you can make it as large as you wish or want.
    Be sure to back up your keyword list regularly (use the tiny menu icon top right in keyword panel and chose export) save it with a proper name and open it in a text application to view how it looks when you have several sub keywords.
    The benefit of creating first a keyword list is that you can easily select new images with existing keywords instead of creating them again and again.
    And it looks far more difficult then it is in reality, just try it and give it a go.
    When done you can use the Search command and choose a main folder, include subfolders and non indexed files and for criteria use keyword and fill in the keyword you want to search for. Having written all keywords to the files other applications can search for them also.

  • File Path Names

    I want to put the File path name of our documents to the head of files as a reference. I know this can be done with Macros on Word/Excel, but is there a way to achieve this with applescript in pages/numbers?

    Insert Filename was one of the features that made it's appearance in iWork '09. The feature has an option to include the entire path. I imagine that with a script it might be possible to insert the filename path in a Pages '08 document.
    Jerry

  • Trying to return filename, not file path

    I'm trying to set up an automator app that will create a folder with a matching name to the input. I was able to find an Applescript (below) which copies the file path to the clipboard. I can get the rest of it to work, if I can figure out how to copy only the filename and not the entire path.
    on run {input, parameters}
              set thePath to quoted form of POSIX path of input
              do shell script "basename " & thePath
      set the clipboard to the result
              return input
    end run
    My appologies if this is obvious or if I'm going about it the wrong way, I know nothing at all about AppleScript. Any help that anyone can give will be appreciated. Thanks

    on run {input, parameters}
            set thePath to quoted form of POSIX path of input
            set theResult to  do shell script "basename " & thePath
            set the clipboard to the theResult
            return theResult
    end run
    I think you want the applescript to return the basename of the path you pass.
    I made the changes to do this.  I have not tested the applescript.  If you do not want the result on the clipboard get rid of:
    set the clipboard to the the_result
    Robert

  • Applescript: file.open("r") returns empty in jsx

    Hey guys,
    i am having a bit of a scripting problem here. The big goal for me at the moment is creating a UI script to control aerender.
    To achieve getting feedback from the terminal about when an aerender process is completed, i let the terminal trigger an applescript running a jsx inside after effects (since the terminal can't run a jsx inside after effects itself).
    However, this particular script needs to eval the contents of a text file that is outputted during the render process (its just a log file put into a fixed location). No matter what i do: I can't get a proper response from the script. Here is what should happen when a render is done:
    function RenderEnd () {
    var report = new File ("Macintosh HD/Users/macname/generallog.txt");
    report.open("r");
    var reportstring = report.read();
    report.close();
    var reportendindex = reportstring.indexOf("Total Time Elapsed:");
    var reportcloseindex = reportstring.indexOf("aerender version");
    var reportendstring = reportstring.substring(reportendindex, [reportcloseindex]);
    var regex = /Finished composition/gi, result, indices = [];
    while ( (result = regex.exec(reportstring)) ) {
        indices.push(result.index);
    var ItemStringArray = new Array ();
    for(var i=0; i<indices.length; i++){
        ItemStringArray.push("Finished Item " + (i+1) + ": " + reportstring.substring(indices[i]-32, [indices[i]-2]));
    var AlertString = "Rendering done." + "\r" + reportendstring + "\r" + ItemStringArray.toString().replace(",","\r");
    alert(AlertString);
    RenderEnd ();
    Running this script by itself properly returns an alert containing a message "Rendering done." plus additional info about the render time and item completion.
    But whenever i have the following applescript triggering the above jsx script...
    set scriptfile to (POSIX file ("/Applications/Adobe After Effects CS5.5/Scripts/AERenderEndTrigger.jsx"))
    tell application "Adobe After Effects CS5.5"
      DoScriptFile scriptfile
    end tell
    ...the line report.open("r") just returns empty.
    Same goes when i place the jsx in the startup folder and just call the function RenderEnd () via applescript. It's as if the file open/read stuff does not work when using applescript.
    Does anybody have an idea about this or knows the reason for why this obviously wrong behaviour happens? Maybe someone knows a different approach of how to get feedback from a completed aerender process back into a UI script.

    Ok, i finally found the issue:
    Applescript apparently does not recognize file paths beginning with a drive designation:
    When i change the file path part of the report file from
    var report = new File ("Macintosh HD/Users/macname/generallog.txt");
    to simply
    var report = new File ("/Users/macname/generallog.txt");
    everything works as it should.
    It's still a bit weird and i don't understand this. Maybe someone can explain this to me, please?

  • Missing Photographs - 5,000 in total - is there a programmatic way to get the complete file paths missing?

    HostOS : Mac OS X
    LightRoom version : 4.4
    I accidentally moved linked files over the past few years, and just discovered (via "Missing Photos" view) that I have 5,000 missing photos.
    I know the master photos are on my hard disk drive ... so, that is the good news.
    BUT I do not want to have to click to re-link all 5,000 missing photos one at a time.
    Is there a way to programmatically get the list of file paths of those 5,000 missing photos on my MacOSX system  -- so that I can write an AppleScript to extract the unique image file name from the full file path extracted from LightRoom, locate the image in Finder, and move it back to the expected file path where Lightroom expects to find it?

    If most of your reorganization consisted of moving whole folders rather than individual pics,  you can quickly relink entire folders, or even folders of folders, rather than individual pics.  In the Folders pane on the left, right-click the missing folder and select Find Missing Folder.
    If you moved individual files rather than entire folders, then to get a list of the file paths of all the missing files, first do Library > Find All Missing Photos. Then use the ListView plugin to get a list of the photos' file paths into a text file.

  • Change file path of embedded pictures

    I'm sort of a beginner with Applescript, but I created an application in it that takes screenshots of different web pages and saves them in my Pictures folder. I have a proposal template in a Word document that has these pictures linked and embedded into it. Whenever I want to create a new proposal, I run the application and get the specified images I need, and update the links in the Word doc so that the new images display. I then break the links and save the doc as something else. 
    Anyway, I have a colleague who would like to use this application. The files in the Word doc are linked to Macintosh HD/users/Me/Pictures. How can my colleague easily set all the images in the Word doc to their own file path, ie Macintosh HD/users/MyColleague/Pictures?
    Something like
              tell application "Microsoft Word"
                        set the path of active picture to "Macintosh HD:Users:MyColleague:04-ReportMenu.jpg"
              end tell
    Multiple salespeople will eventually be using this script. If I could add a function into my Applescript app so that whenever the proposal template is opened, the path to the images is changed to that users's picture folder, that would be amazing. Other solutions are welcomed.

    Sure, thanks for the reply. My organization created a sales proposal generator in Word. It creates a sales proposal based on some user inputs. Embedded in the proposals are demonstrations of our product in the form of screenshots of our product from our website. One of our designers updates the standard images with customized branded images for the client we are pitching. It's very time consuming to get these new branded images from the web, crop them and swap them out in the Word proposal, so I created an app that will do it. The app visits a list of pages, takes a screenshot of the Safari window and pastes a named image in my Pictures folder. I embedded the images in the Word doc so that they link to my Pictures folder. All I have to do is update the links and I have a new branded proposal. It works great on my own machine, but if I share it, the path obviously breaks and the Word image update doesn't work.
    Here's a snippet of my code. The following takes a screenshot of our site and saves it in Pictures:
      -- Report Screenshot
      delay 1
                        tell application "Safari" to set the bounds of the front window to {0, 20, 915, 935}
                        delay 0.1
                        tell application "Safari"
                                  tell window 1 to set URL of current tab to "https://website.com/demox?rm=report"
                                  delay 4
                        end tell
                        do shell script "screencapture -o -l$(osascript -e 'tell app \"Safari\" to id of window 1') ~/Pictures/05-Report.jpg"
              end tell
    The links in Word update to the brand-specific images I just grabbed once I select Edit -> Links -> Update Now
    I need a quick way, in Applescript, to update /Users/me/Pictures/photo.jpg to Users/MyColleague/Pictures.jpg in Word. Does this help at all??

  • ITunes on macbook pro - resetting music file path when not on my network

    Hi there!
    I suspect I know the answer to this already, but I hope I'm wrong! :-D
    I have my macbook a while now, but I've only recently started using iTunes properly.
    I have a home network, which consists of my macbook pro, a dell laptop running XP, a Nintendo Wii, a Sumvision Netbox NAS 1TB drive and a Logitech Squeezebox Boom.
    I'm using the NAS as my music storage, iTunes rips music and stores it here.
    This is all good.
    The Squeezebox Boom (for anyone who doesn't know) is a neat little Wifi radio/mp3 player, it streams radio from the web, and also music from the NAS.
    The software that controls it is called the Squeeze center.
    At the moment I have this software linked to iTunes, so when I add music to my library via iTunes the squeeze center automatically scans the music library and updates itself taking in music details, play lists, art work and all, it's a great system.
    The problem I have is when I take my laptop anywhere, iTunes changes the iTunes music folder location automatically to the internal hard drive, which means when I get home again I have to reset the file path and iTunes then has to scan the folder and organise everything again.
    not only that, as soon as the squeeze center sees the file path has changed it points at the new location (on the macbook hard drive) and looses the library.
    so when I reset iTunes, the squeeze center has to rescan everything again also.
    It's quite annoying.
    I have a work around in that I can tell the squeezecenter not to look at iTunes and hard wire it to the location, but I'd rather not do that.
    Is it possible to get iTunes to keep the NAS music folder as the iTunes Music folder location even when the macbook isn't on the network?
    Or will it always change the folder when I leave the network.
    Many thanks for your help.
    Paul.

    I've had this problem for ages, only now it seems as though iTunes is no longer restoring my music folder to the NAS if I start it when the NAS is connected. This is proving a pain in the a** because I keep forgetting about it, going online and buying a load of music from the store and then I find I've got a gig to consolidate when I realise my music folder has filled up! Funnily enough, I've downloaded and edited an applescript that automatically checks every half hour whether or not I'm on my home network, if I am it mounts my network drive for me. I really miss the airport disk utility's automatic mount feature. What I think I'l do is create another one for iTunes, to serve as a shortcut to iTunes, but when it's run it will check to see if you're on your home network, if so mount the NAS (if it isn't already), if not, or if it can't mount it will ask you whether you want to run iTunes after warning you that your NAS isn't connected. The only potential problem I could see is when iTunes runs as a result of you opening a music file in Finder. However I'm sure we could associate the applescript 'shortcut' with music instead of iTunes? I'll post here if and when I'm successful.

  • Getting File Path to Open

    Is there a way to copy a full file path from a cell in Microsoft Excel to the clipboard and have Finder open it using another program?
    the Microsoft Excel cell looks like this...
    Primary Hard Drive:Microstock 2.0:Automation Processes:Automating Folder System:Bright:Bright Series Choices Circles.jpg
    the script I have looks like this but won't work...
    tell application "Microsoft Excel" to copy range (cell "B1" of worksheet "Keywording 2.0" of workbook "Metadata")
    set thefile to (the clipboard)
    tell application "Finder" to open thefile using "Primary Hard Drive:Applications:Adobe Bridge CS4:Adobe Bridge CS4"
    tell application "Adobe Bridge CS4" to activate
    I get an error "Can't make "Description" into type item.

    There are several flaws with your script, which are compounding your problem.
    First off, you're using copy range within Excel, which isn't what you want - that's intended to copy a range of cells within a worksheet to another worksheet.
    Secondly, even if that did work, you really don't want to use the clipboard for this. There's no need, for a start, and it disrupts whatever else the user may have had on the clipboard. Just think of AppleScript variables as being an infinite number of named clipboards and you can see that you could easily use an AppleScript variable to pass the data between Excel and the Finder.
    So, first off, getting the data out of Excel, you want to get the value of the cell and put it in an AppleScript variable:
    tell application "Microsoft Excel" to set myFilePath to value of (cell "B1" of worksheet "Keywording 2.0" of workbook "Metadata")
    Now myFilePath has the path data, which you can pass to the Finder:
    tell application "Finder" to open file myFilePath
    (although there may be no need to use the Finder at all for this - you can open the file directly, or tell Adobe Bridge to open the file, but the point of using AppleScript variables still stands)

Maybe you are looking for

  • AP Account Analysis Report USD not converting to Functional Currency

    When I am running AccountAnalysis Report , USD not converting to SGD\ 08-JUN-09 3D NETWORKS SINGAPORE PTE TI10050729 Invoice Nonrecoverable GST Yes USD 8,395.36 8,395.36 530000844 Regards, Ajit Edited by: Ajit Raut on Jul 27, 2009 8:10 PM

  • Shopping cart item not appearing in sourcing cockpit

    Hi, I have an issue which is related to sourcing activity. I ordered a shopping cart and the status is approved the product category is set to sourcing always carried out after ordering when I check the status of the line item it is showing that the

  • Movie compilation

    Hey, I have lots of music compliations, but I can't seem to do the same (iTunes Windows 11.0.0.163) with my movies.  Such as Schoolhouse Rock! disc 1 and 2.  I want 1 set of album art showing the 2 shows as tracks.  Can iTunes not handle this?  I've

  • Screen light dim?

    Just yesterday after adding new albums to my ipod, when turning on the screen (while playing music) the screen light was dim. I tried several times to turn off and on, sometimes it was fine, sometimes it was dim. And when it was dim it could last a s

  • HT5271 Safari will not quit to allow the install updates

    I received notice that updates were available.  I clicked to install the update.  I got a message that Safari was not closed and would need to be before the update could be implemented.  I tried quitting Safari through the File:Quit bar across the to