Applescript - Add prefixes in file name to an array

I have a little script I am working on and I am stuck on this feature.
If I have a folder full of files with prefixes like
sm_test.png
sm_test2.png
med_test.png
med_test2.png
lg_test.png
lg_test2.png
I would like to add each unique prefix to an array without any duplicates.
{"sm", "med", "lg"}

Thank you so much Niel! Since you helped me with my other post. I have one last questions and I swear I will leave you alone. Basically I am trying to combine the two.
I have the script creating folders based on the prefixs then I need to move the files to their folders and remove the prefix. It seems to work when there is only one prefix but breaks when there is more then one.
set the_array to {}
tell application "Finder"
          try
                    set theLocation to the selection as alias
          on error
                    set theLocation to (folder of the front window as alias)
          end try
          repeat with this_file in (get files of theLocation)
                    set the_name to name of this_file
                    set the_prefix to items 1 thru ((offset of "_" in the_name) - 1) of the_name as string
                    if the_array does not contain the_prefix then set the_array to the_array & the_prefix
          end repeat
          repeat with e in the_array
                    if not (exists folder e of theLocation) then make new folder at theLocation with properties {name:e}
          end repeat
          set this_list to every file of theLocation
          set AppleScript's text item delimiters to {"_"}
          repeat with i in this_list
                    repeat with ee in the_array
                              if (name of i) begins with ee then
  move i to folder ee of theLocation
                              end if
                    end repeat
                    set name of (the result) to text item 2 of (get name of (the result)) as string
          end repeat
end tell

Similar Messages

  • Add prefix to file names using AppleScript

    Hello,
    I'm trying to write a script that when ran, will add the prefix "R" to all file names within a folder called "1 Reverse Footage". I've tried two different scripts (below) and they aren't working. Any help is much appreciated!
    1st attempt
    property folder_path : "/Users/rdarton/Documents/SloMo/1 Reverse Footage"
    repeat
              tell application "Finder"
                        set name of items of folder "Documents:SloMo:1 Reverse Footage" of home to "R" & name
              end tell
    end repeat
    This changes one file name to "RFinder" instead of adding "R" to the original file name and then stops with an error saying "Finder got an error: The operation can’t be completed because there is already an item with that name."
    2nd attempt
    property folder_path : "/Users/rdarton/Documents/SloMo/1 Reverse Footage"
    set prefix to "R"
    repeat
              tell application "Finder"
                        set name of items of folder "Documents:SloMo:1 Reverse Footage" of home to prefix & name
              end tell
    end repeat
    This also changes one file name to "RFinder" instead of adding "R" to the original file name and then stops with an error saying "Finder got an error: The operation can’t be completed because there is already an item with that name."

    Try something like:
    tell application "Finder"
    set the_folder to folder "path:to:folder"
    set the_file to item 1 of the_folder
    set extension_hidden to extension hidden of the_file
    set extension hidden of the_file to true
    set the_name to displayed name of the_file
    set extension hidden of the_file to extension_hidden
    the_name
    end tell
    the_file can be specified by index, or by name, or by matching a specific set of criteria. Provide the folder's actual path in line 2, with : characters separating each element of the path.
    (15333)

  • Move Excel file to Archive and add timestamp to file name

    I have SQL Server 2012 and using Excel Source and OLE DB Connection to import Excel data to DB.
    Currently file is located on C:\\Excel\filename.xlsx. I'm using File System Task to move file to C:\\Excel\Archive\filename.xlsx after Import Task.
    Now I would like to add timestamp to file name after moving file to archive. I would like to modify file name as C:\Excel\Archive\filename_timestamp.xlsx
    How to add timestamp to filename?
    Kenny_I

    Hi, 
    here you go with example
    http://consultingblogs.emc.com/jamiethomson/archive/2005/09/14/SSIS-Nugget_3A00_-Move-and-rename-a-file-in-one-operation.aspx
    thank you
    Aamir
    http://sqlage.blogspot.com/

  • Please add options for file names on camera or PlayMemories import (ie: 00001 DateTaken DSC)

    Please add options for file names on camera or PlayMemories import (ie: 00001 DateTaken DSC=   00001 2014_10_21 DSC )

    if(!getNewContactsName())
                   createNew();
                   return;
              if(!getNewContactsSurname())
                   createNew();
                   return;
              String checkName = newName;
              String checkSurname = newSurname;
              if(!checkIfDuplicate(checkName,checkSurname))
                   createNew();
                   return;
              if(!getNewContactsHomeNum())
                   createNew();
                   return;
              if(!getNewContactsWorkNum())
                   createNew();
                   return;
              if(!getNewContactsCellNum())
                   createNew();
                   return;
              if(!checkAtLeastOneNumEntered(newHome, newWork, newCell))
                   createNew();
                   return;
              }This can all be done in 1 if statement just use the or operator (||) will save some room
    private void deleteFromList(String nameOfContact, String surnameOfContact)
         {//Start of deleteFromList()
              int confirm = JOptionPane.showConfirmDialog(null,"Are you sure you wish to delete the contact from the phonebook?","Please confirm",JOptionPane.YES_NO_OPTION);
              if(confirm == JOptionPane.NO_OPTION)
                   return;
              elseWhy do you have a return statement in a void method? there's no need for this you can cut out the no part and just keep the yes

  • Add Counter to File name when using Tran Protocol as FTP

    Hi There,
    Was wondering if there was any way to achive the same "Add Counter"  functionality used for File names in Reciever file adapter when we are using FTP as the transport protocol, this option is only provided in NFS,
    My requirement is ..
    Write files using counter on to ftp..
    say if three files already exists on the ftp server with names ...fname001, fname002 and fname003
    then the next time a file is written it should have a file name fname004 else fname001 if no file exists.
    Any help would be greatly appreciated

    No such standard functionality is available in communication channel...
    But you can try customizing ur scenario in one of the following ways...
    Case 1: If a field in source data carries the information regarding the sequence.
    You can map this value ( Directly .. or using some transformation ) in some temporary field in the target and then use a Variable substitution at the receiver communication channel.
    Case 2. If the source file name carries the sequence information. then you can enable the Adapter specific settings in the Sender communication channel , and then get the information of the source file name using the Container object in the mapping. Then assign the sequence number to a field in the target , use a Variable substitution at the receiver communication channel.
    Case 3 : If Case 1 and Case 2 are not applicable ... then you have to use a Ztable to store the sequence number , a function module to fetch the number , and then use a UDF in which you will implement the RFC call logic.Then the same process .... assign the sequence number to a field in the target , use a Variable substitution at the receiver communication channel.
    BR,
    Sushil.

  • Need script to add path and file name to fillable  form

    I have a fillable pdf form that I would like to have a script that adds the path and file name to the form. This script would be in a field at the end of the document.
    I am a newbie to javascript and formcalc. The script will be the only one in the form.
    Thanks for any assistance.
    Lisa

    Hi,
    I have a sample that attach a file to the PDF and write in a text field the file name. I don´t know how to get the full path and it only works in Acrobat. To work in Adobe Reader is necessary the LC Reader Extensions to give some special permissions to the document. But, regard this, you still want the sample send me a email to [email protected]
    Best Regards,

  • AppleScript System Events Choose File Name Statement Broken?

    Re: OS X 10.9.2, AppleScript Editor 2.6.1:
    Why does the following AppleScript statement hang the Script Editor?
    tell application "System Events" to ¬
      choose file name with prompt "Output File" default name "Output File" default location (path to desktop)

    see Applescript Release Notes, Scripting Addition Security.
    Applescript, unlike other scripting languages, relies heavily on functionality being provided by client applications. This makes it much harder to keep consistent behavior across different contexts, because it's up to individual providers to implement applescript commands. A fact of Applescript life.
    However, it seems your real problem is not with System Events, but with the fact that your dialog is getting lost off-screen. This works:
    tell application "System Events"
      activate
      choose file name
    end tell

  • Applescript to take a file name element to change Date Created

    This so beyond me but I have been led to believe is can be done. Can anyone help me please?
    I have thousands of archive files. ALL of these files' names start with the date in dd-mm-yy format. eg. 31-01-11 File Name.pdf or 25-12-09 Filename-02.pdf
    I would like to be able to drag a folder onto an application and for that app to search through the folder and all sub-folders, for these files and change the files' Date Created to the date at the start of the filename.
    This feels so easy to type but I fear much more complicated to do however I do thank you very much in anticipation for your help.
    Best wishes
    John

    Hello
    Here's something you might try if the problem is still open.
    It uses SetFile(1) command in Developer Tools, which you need to have intalled.
    cf.
    http://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/m an1/SetFile.1.html
    It can set creation date to any date between 1970-01-01 to 2038-01-18 inclusive.
    Simple check for date in file name is implemented so that error log is written to a log file on desktop when given date is considered invalid or SetFile raises error.
    One thing to note.
    It will process both files and directories under given directory tree in order to process package file. But it is not smart enough to leave the package contents alone, which means if a package contains a file or directory with name matching the pattern, it's creation date will be also changed.
    Minimally tested under OSX 10.2.8 at hand.
    But NO WARRANTIES of any kind. Please use it on test folder first.
    Good luck,
    H
    --SCRIPT
    on open aa
    main(aa)
    end open
    on run
    open ((choose folder) as list)
    end run
    on main(aa)
    list aa : alias list of source directories
    set logf to (path to desktop)'s POSIX path & "creationdate_error_log" & (current date)'s time & ".txt"
    repeat with a in aa
    set a to a as alias
    if (a as Unicode text) ends with ":" then -- directory
    set p to a's POSIX path's text 1 thru -2 -- posix path without trailing /
    set sh to "path=" & p's quoted form & ";
    logf=" & logf's quoted form & ";
    find "$path" -name '[0-9][0-9]-[0-9][0-9]-[0-9][0-9]*' -print0 | while read -d $'\0' f;
    do
    fn=${f##*/};
    dd=${fn:0:2}; ((d=10#$dd));
    mm=${fn:3:2}; ((m=10#$mm));
    yy=${fn:6:2}; ((y=10#$yy));
    if [[ ($d -ge 1 && $d -le 31) && ($m -ge 1 && $m -le 12) && ($y -ge 70 || $y -le 38) ]]; then
    if [[ $y -ge 70 ]]; then
    cc=19;
    else
    cc=20;
    fi
    res=$(/Developer/Tools/SetFile -d "$mm/$dd/$cc$yy 00:00" "$f" 2>&1);
    if [[ -n $res ]]; then
    echo "# $res ; failed for : $f" >> $logf;
    fi
    else
    echo "# invalid date in name : $f" >> $logf;
    fi
    done"
    do shell script sh
    end if
    end repeat
    end main
    --END OF SCRIPT

  • AppleScript: Add a HTML file in the body of Email by the clipboard

    I would like to insert a HTML file into the body of Email by the clipboard action.
    This is my cord below:
    set the clipboard to (read (choose file) as «class RTF »)
    set theBody to "Hello"
    tell application "Mail"
    activate
      set theMessage to make new outgoing message with properties {content:theBody, visible:true, subject:"mysubject"}
    end tell
    tell application "System Events"
      tell process "Mail"
      set focused of UI element 1 of scroll area 1 of window 1 to true
      keystroke "v" using command down
      end tell
    end tell
    This code enables only rtf file rather than HTML.
    Also I don't want to use the html content by the function of Mail.
    Because if using it, you won't insert both  a html file and body at the same time.
    So what I would like to is to insert a HTML file by the clipboard action into a body.
    Thank you!

    Hi,
    One solution is to use Safari to copy the document:
    set x to choose file -- a HTML file
    tell application "Safari"
        open x
        delay 2
        repeat while source of document 1 does not contain "</html>"
            delay 1.5
        end repeat
        activate
    end tell
    tell application "System Events"
        tell process "Safari"
            set frontmost to true
            keystroke "a" using command down -- select all
            delay 0.3
            keystroke "c" using command down -- copy to clipboard
        end tell
    end tell
    set theBody to "Hello"
    tell application "Mail"
        activate
        set theMessage to make new outgoing message with properties {content:theBody, visible:true, subject:"mysubject"}
    end tell
    tell application "System Events"
        tell process "Mail"
            set focused of UI element 1 of scroll area 1 of window 1 to true
            keystroke "v" using command down
        end tell
    end tell
    Also try this:
    set the clipboard to (read (choose file) as «class HTML») -- a HTML file

  • Adding DVD File to Library - File Name Changes

    When I add a DVD file name to my library, iTunes changes the name of the file. How do I retain the name of the file that is in my iTunes sub-directory?

    According to MacWorld the following terminal commands should restore that behaviour for you:
    *defaults write com.apple.iTunes play-songs-while-importing -bool TRUE*

  • Shortening file names

    Hi all,
    Does anyone know of a way to shorten file names to the same length?
    Here is my problem...
    I receive hundreds of InDesign files named with a common file naming convention. for example ABC001_jobtitle / ABC002_nextjob / ABC003_etc. I use a great software package to automate the majority of the tasks that I need to do in the pre-press environment, to speed up repetitive jobs to pre-flight and produce PDFs for proofing and printing.
    I then end up with a folder of files: ABC001_jobtitle.PDF / ABC002_nextjob.PDF / ABC003_etc.PDF
    What I need to be able to do with Apple script or Automator is to truncate the file names to the same length to remove all the characters AFTER the code so that I end up with files named ABC001 / ABC002 / ABC003 (but NOT renaming them as these codes have to match up to a code on a packing list elsewhere).
    Is this possible? There are plenty of file renaming options within Automator but none (that I can see) that solve this problem.

    I just happen to have an Automator Run AppleScript action that trims file names to the specified number of (leftmost or rightmost) characters and renames the file(s). See if this will do what you want (I recommend testing on some copies):
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 335px;
    color: #000000;
    background-color: #FFDDFF;
    overflow: auto;"
    title="this text can be pasted into an Automator 'Run AppleScript' action">
    on run {input, parameters}
    -- rename Finder items (aliases), keeping the left/rightmost characters in the name
    -- names with fewer characters are not trimmed - errors are skipped
    -- input: a list of Finder items to rename
    -- output: a list of the renamed Finder items
    set output to {}
    set SkippedItems to {} -- this will be a list of skipped items
    -- prompt for the number of characters to keep and set the start and end limits
    display dialog "Enter the number of characters to keep:" default answer "all" buttons {"Cancel", "LeftMost", "RightMost"}
    set {TheButton, TheNumber} to {button returned, text returned} of the result
    try
    set TheNumber to TheNumber as integer
    on error
    set TheNumber to "all"
    end try
    if TheNumber is "all" then
    set {TheStart, TheEnd} to {1, -1}
    else
    if TheButton is "LeftMost" then
    set {TheStart, TheEnd} to {1, TheNumber}
    else
    set {TheStart, TheEnd} to {-TheNumber, -1}
    end if
    end if
    tell application "Finder" to repeat with SomeItem in the input -- step through each item in the input
    -- get the item name and extension
    set {TheName, TheExtension} to {name of SomeItem, name extension of SomeItem}
    set TheContainer to (container of SomeItem) as text -- the containing folder
    if TheExtension is in {missing value, ""} then
    set TheExtension to ""
    else
    set TheExtension to "." & TheExtension
    end if
    set TheName to text 1 thru -((length of TheExtension) + 1) of TheName -- the name part
    try
    set FileName to (text TheStart thru TheEnd of TheName) & TheExtension
    set name of SomeItem to FileName
    set the end of output to (TheContainer & the result) as alias
    on error
    set the end of SkippedItems to (return & TheName & TheExtension)
    end try
    end repeat
    if SkippedItems is not {} then -- handle skipped items
    set TheCount to (count SkippedItems) as text
    display alert "Error with renaming files" message "The following " & TheCount & " items(s) were skipped:" & return & SkippedItems as text
    end if
    return the output -- pass the result(s) to the next action
    end run
    </pre>

  • Java.io.File only returns similar file names

    I have written a bean which reads a directory and places the file names in an array, which can be accessed by a JSP page. At first, the files inside the directory were named wb_1.jsp, wb_2.jsp, wb_3.jsp and so on. When I change a filename to something like work.jsp, it still appears in the file list, but when I rename it to something like identify.jsp, it doesn't!
    If I count the array, it does read the correct number of files.
    Class FileHandler
    // Imports
    import java.io.File;
    // Class
    public class FileHandler
         // Constants and variables
         public File dir;
         public File[] files;
          * Returns the number of files found inside the given directory
         public int showFiles()
              try
                   setDir(getDir());     // Get file directory as set in the bean property
                   files = dir.listFiles();     // List the files found inside the directory
              catch (Exception e)
                   System.out.println(e + " : No files found to return a value");
              return files.length;      // Return the number of files
          * Returns the file name by using the in value in the files array
         public String returnFileName(int in)
              return files[in].getName();     // Return the name of the file
          * Sets dir file type to the setproperty value in
         public void setDir(File in)
              dir = in;     // Set class variable value for dir
          * Returns the dir value
         public File getDir()
              return dir;     // Return the setproperty value for dir
    }And the JSP code which reads the array
    out.println("<select onChange=\"jumpMenu('top',this,0)\" size=\"5\" style=\"width: 200\"");
    String fileName = new String();
    for(int x=0; x<file.showFiles(); x++)
         fileName = file.returnFileName(x);
         out.println("<option selected value=\"beheer.jsp?action=2&file=" +  fileName + "\">" +  fileName +"</option>");
    out.println("</select>");

    I forgot bean properties im the above code lines. Here it is, just in case.
    <jsp:useBean id="file" class="FileHandler" scope="page" />
    <jsp:setProperty name="file" property="dir" value="C:\\IBM Websphere workspace\\Project\\Web Content\\WEB-INF\\include" />

  • Fill array with file names

    What am I missing?  I've got alerts that should pop up if it works and if it fails but instead it does nothing, I'm sure its possible to create an array that is made up of all the file names of a folder.  In the past I've had to enter all the values one a time and some of these folders have 200+ files in it.
    #target illustrator
    filltotesTempArr
    function filltotesTempArr()
    var toteTemparray = new Array(toteTemps)
    var toteTempPath = Folder ("S:/Illustrator JS Palette/Direct Template Calls/Totes");
    var allFiles = artPath.getFiles(order);
    var toteTemps
    if (allFiles.length > 0)
        for (i=0;i<allFiles.length;i++)
                toteTemps = toteTemps + app.open(allFiles[i] )
              }//end for
          alert("Your array has the current values:" + toteTemps);
        }//end if
        else
        alert("Script to fill Totes Templates Array has failed");

    I need to take all the files inside of a folder, and put their file names in an array like this;
    var totesarr1= new Array ("A165331","A165332","A165333","A165334","A165337","A165338","A165344","A165348", "A165349",
    "A165352","A165353","A203","A210","A211","A214","A222","A229","A231","A232","A234","A248","A250","A252","A268",
    "A271","A272","A278","A290","A292","A322","A323","A324","A325","A327","A330","A402","A404","A405","A407","A408",
    "A409","A410","A411","A414","A415","A417","A420","A422","A423","A424","A425","A427","A430","A436","A438","A439",
    "A440","A441","A443","A446","A448","A449","A450","A451","A452","A454","A455","A456","A460","A461","A468","A470",
    "A490","A495","A497","A500","A508","A509","A510","A512","A513","A514","A518","A524","A525","A526","A527","A530",
    "A533","A534","A536","A543","A581","A582","A587","A602","A619","A624","A705","A707","A710","A714","A715","A739",
    "A740","A741","A742","A743","A744","A745","A748","A750","A751","A752","A753","A754","A755","A756","A763","A800",
    "A801","A804","A806","A811","A815","A817","A818","A819","A824","A832","A835","A836","A838","A841","A844","A848",
    "A849","A852","A854","A856","A857","A859","A861","A863","A865","A866","A868","A871","A873","A877","A879","A881",
    "A885","A888","A890","A894","A899","A900","A902","A904","A940","A941","A943","A944","A945","A948","A97307","A97309",
    "A97313","A97314","A97315","A97316","A97321","A97326","A97340","A97342","A97708","A97715","F742","F751","V6432");
    so the closest thing that I can come up with is this;
    #target illustrator
    filltotesTempArr
    function filltotesTempArr()
    var toteTemparray = new Array(toteTemps)
    var order = new RegExp(input);
    var toteTempPath = Folder ("S:/Illustrator JS Palette/Direct Template Calls/Totes");
    var totetempnames = toteTempPath.getFiles();
    var totetemps = new Array ()
    var allFiles = toteTempPath.getFiles();
    if (allFiles.length > 0)
        for (i=0;i<allFiles.length;i++)
                toteTemps = toteTemps + "," + app.open(allFiles[i])
              }//end for
          alert("Your array has the current values:" + toteTemps);
        }//end if
        else
        alert("Script to fill Totes Templates Array has failed");
    alert ("Script is Done")
    but even this dosn't work like it should
    #target Illustrator
    GetTempNames;
    function GetTempNames ()
    var toteTempPath = Folder ("S:/Illustrator JS Palette/Direct Template Calls/Totes");
    var toteTempNames = toteTempPath.getFiles()
    var totetemparr = new Array ( toteTempNames )
    alert ("script is done get ready");
        alert ("Here " + totetemparr);
    so now I'm at a loss

  • AppleScript "Add to File Names.scpt" (in Finder Scripts) adds "Prefix" to end of files rather than adding actual prefix?

    This may be a quirk with my setup, but when the file "Add to File Names.scpt" runs in Mavericks "Prefix" is appended to the end of filenames rather than the term I would like to be added as a prefix...unsure if this can be reproduced on other comptuers? Similarly, as a test, if a term is intended to be added as a suffix to a file name then "Suffix" is appended to the end of a file name - rather than the term.
    If this is a bug is there a fix?
    Thanks

    apparently this is a bug with a workaround as described here:
    https://discussions.apple.com/message/24085265#24085265

  • How to add new text and an empty space before a file name with Automator

    I can create a new service to add to multiple files some text before the file name but I need to add even an empty space; e.g. file name original  becomes: new text(space)file name original. The aim is to add this text and space to multiple files.
    I hope to be understood. Please can somebody help me?
    Thanks

    This is an old Apple-supplied AppleScript that will do the job.
    IMPORTANT: note the conditions of use: it will choose the frontmost Finder window to operate on. Therefore, open the folder you want to change the names of and make it the front finder window BEFORE running the script.
    Add to File Names
    This script is designed to add a prefix or suffix to files in the front window of the desktop.
    If no folder windows are open, the script will affect items on the desktop.
    Copyright © 2001–2007 Apple Inc.
    You may incorporate this Apple sample code into your program(s) without
    restriction.  This Apple sample code has been provided "AS IS" and the
    responsibility for its operation is yours.  You are not permitted to
    redistribute this Apple sample code as "Apple sample code" after having
    made changes.  If you're going to redistribute the code, we require
    that you make it clear that the code was descended from Apple sample
    code, but that you've made changes.
    --March 2014: Changes by Phil Stokes to make the script work on 10.9
    --these changes are simply reversing the order of parameters in the lines that have "copy" in them
    -- The following line is disabled due to a Menu Manager bug
    --set the source_folder to (choose folder with prompt "Pick the folder containing the files to rename:")
    try
              tell application "Finder" to set the source_folder to (folder of the front window) as alias
    on error -- no open folder windows
              set the source_folder to path to desktop folder as alias
    end try
    set the prefix_or_suffix to ""
    repeat
              display dialog "Enter the prefix or suffix to use:" default answer the prefix_or_suffix buttons {"Cancel", "Prefix", "Suffix"}
              copy the result as list to {button_pressed, prefix_or_suffix}
              if the prefix_or_suffix is not "" then exit repeat
    end repeat
    set the item_list to list folder source_folder without invisibles
    set source_folder to source_folder as string
    repeat with i from 1 to number of items in the item_list
              set this_item to item i of the item_list
              set this_item to (source_folder & this_item) as alias
              set this_info to info for this_item
              set the current_name to the name of this_info
              if folder of this_info is false and ¬
                        alias of this_info is false then
                        if the button_pressed is "Prefix" then
                                  set the new_file_name to the (the prefix_or_suffix & the current_name) as string
                        else
                                  set the new_file_name to the (the current_name & the prefix_or_suffix) as string
                        end if
                        my set_item_name(this_item, the new_file_name)
              end if
    end repeat
    beep 2
    on set_item_name(this_item, new_item_name)
              tell application "Finder"
      --activate
                        set the parent_container_path to (the container of this_item) as text
                        if not (exists item (the parent_container_path & new_item_name)) then
                                  try
                                            set the name of this_item to new_item_name
                                  on error the error_message number the error_number
                                            if the error_number is -59 then
                                                      set the error_message to "This name contains improper characters, such as a colon (:)."
                                            else --the suggested name is too long
                                                      set the error_message to error_message -- "The name is more than 31 characters long."
                                            end if
      --beep
                                            tell me to display dialog the error_message default answer new_item_name buttons {"Cancel", "Skip", "OK"} default button 3
                                            copy the result as list to {button_pressed, new_item_name}
                                            if the button_pressed is "Skip" then return 0
                                            my set_item_name(this_item, new_item_name)
                                  end try
                        else --the name already exists
      --beep
                                  tell me to display dialog "This name is already taken, please rename." default answer new_item_name buttons {"Cancel", "Skip", "OK"} default button 3
                                  copy the result as list to {button_pressed, new_item_name}
                                  if the button_pressed is "Skip" then return 0
                                  my set_item_name(this_item, new_item_name)
                        end if
              end tell
    end set_item_name

Maybe you are looking for

  • Installing CS5.5 Master Collection Students Edition - Error at Setup

    Hello, after I reinstalled my Win7x64 I put my Adobe DVD's in the DVD-Drive (yes , once a time starting at #1). standard stuff : serial, ID and options work fine : C:/ is to small so i select D:/ as drive and my desired products after hitting the ins

  • Search by tag not working in content search web part

    Hi, I am trying to configure content search web part that only pull result with a specific tags. I have created a document library and assign tags on some document, also configured Managed Meta data service and search service application. Schedule se

  • Youtube uploading error

    I have logged into my Youtube account, selected the publish to that account, I've even made sure I'm logged in on  my browser if that makes a difference but I can't get an upload to go to Youtube.  I just get an error saying it's not accessible? Has

  • Photoshop Elements 8 installation Error 2

    I received error message AdobeColorCommonSet RGB Error2 when installing photoshop elements 8 which was part of a bundle software package that came with my Bamboo Fun tablet.  I tried shutting down and reinstalling the software several times and conti

  • [BB 9320] Blackberry Screen Reader

    Hello.  first, sorry for bad english. i've installed the blackberry screen reader on it, and it is very functional, on calls and messaging. However, when i go to the phone book or in phone settings, the Screen reader mess up and start to read only ha