File sorting replacing problem.

Discussion in 'AppleScript' started by 00smita, Aug 2, 2010.

  1. 00smita

    00smita New Member

    Joined:
    Jul 18, 2010
    Messages:
    11
    Likes Received:
    0
    I am have made a folder action. It works in for the most part but where I am having a problem is it will not replace the file once it aready exists.

    What I am tring to do is but files in alphabetitcal order based on the first letter of the file. and but it in the subfolder.

    also if anyone can stream line this any better I am all ears. I have tried different replace commands I could come up with but it did not work.

    Any help anyone could give I would be thankful

    This is the Code that work with out the replacing function

    tell application "System Events"
    set these_files to every file of folder "Volumes:Member Pics"
    repeat with i from 1 to number of items in the these_files
    set this_item to item i of the these_files
    set this_info to info for this_item
    if visible of this_info is true then
    set file_name to name of the this_item
    set the first_char to (character 1 of the file_name) as string
    beep 1
    display dialog first_char buttons {"OK"} default button 1
    if first_char is "a" then
    move this_item to ":Volumes:Member Pics:a"
    else if first_char is "b" then
    move this_item to ":Volumes:Member Pics:b"
    else if first_char is "c" then
    move this_item to ":Volumes:Member Pics:c"
    else if first_char is "d" then
    move this_item to ":Volumes:Member Pics:d"
    else if first_char is "e" then
    move this_item to ":Volumes:Member Pics:e"
    else if first_char is "f" then
    move this_item to ":Volumes:Member Pics:f"
    else if first_char is "g" then
    move this_item to ":Volumes:Member Pics:g"
    else if first_char is "h" then
    move this_item to ":Volumes:Member Pics:h"
    else if first_char is "i" then
    move this_item to ":Volumes:Member Pics:i"
    else if first_char is "j" then
    move this_item to ":Volumes:Member Pics:j"
    else if first_char is "k" then
    move this_item to ":Volumes:Member Pics:k"
    else if first_char is "l" then
    move this_item to ":Volumes:Member Pics:l"
    else if first_char is "m" then
    move this_item to ":Volumes:Member Pics:m"
    else if first_char is "n" then
    move this_item to ":Volumes:Member Pics:n"
    else if first_char is "o" then
    move this_item to ":Volumes:Member Pics[​IMG]"
    else if first_char is "p" then
    move this_item to ":Volumes:Member Pics[​IMG]"
    else if first_char is "q" then
    move this_item to ":Volumes:Member Pics:q"
    else if first_char is "r" then
    move this_item to ":Volumes:Member Pics:r"
    else if first_char is "s" then
    move this_item to ":Volumes:Member Pics:s"
    else if first_char is "t" then
    move this_item to ":Volumes:Member Pics:t"
    else if first_char is "u" then
    move this_item to ":Volumes:Member Pics:u"
    else if first_char is "v" then
    move this_item to ":Volumes:Member Pics:v"
    else if first_char is "w" then
    move this_item to ":Volumes:Member Pics:w"
    else if first_char is "x" then
    move this_item to ":Volumes:Member Pics:x"
    else if first_char is "y" then
    move this_item to ":Volumes:Member Pics:y"
    else if first_char is "z" then
    move this_item to ":Volumes:Member Pics:z"
    end if
    end if
    end repeat
    end tell
    .
     
    00smita, Aug 2, 2010
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. LightGear

    File sorting replacing problem

    LightGear, Nov 16, 2005, in forum: AppleScript
    Replies:
    5
    Views:
    1,567
  2. Newsbot
    Replies:
    0
    Views:
    520
    Newsbot
    Mar 28, 2007
  3. Newsbot
    Replies:
    0
    Views:
    605
    Newsbot
    Dec 22, 2007
  4. Jucius Maximus

    OSX finder sorting question

    Jucius Maximus, Aug 31, 2003, in forum: Apps
    Replies:
    1
    Views:
    216
    Jucius Maximus
    Sep 8, 2003
  5. Carl Brenner

    MT-Newswatcher sorting issue

    Carl Brenner, May 18, 2004, in forum: Apps
    Replies:
    1
    Views:
    175
    Howard Shubs
    May 19, 2004
  6. Captain Nemo

    Replacing Power Supply--fan cable problem

    Captain Nemo, Jun 1, 2008, in forum: Hardware
    Replies:
    0
    Views:
    234
    Captain Nemo
    Jun 1, 2008
  7. Peter Ceresole

    Replacing Palm Desktop User data file

    Peter Ceresole, Apr 25, 2005, in forum: UK Macs
    Replies:
    2
    Views:
    291
    Chris Ridd
    Apr 26, 2005
  8. sunakujiro

    Problem with installing OS after replacing HDD

    sunakujiro, Dec 29, 2015, in forum: Mac Notebooks
    Replies:
    5
    Views:
    554
    Cory Cooper
    Dec 30, 2015
Loading...