AppleScript to the batch change file names

I got the following script to a Mac user previous on this forum that works very well for a folder of files, but it does not work for a folder of files. How can I modify this script to work on files instead of files. What the script does is strip leading or the characters of files contained in a specified folder.

Set Folder choose a folder

Set theResult to display dialog "delete characters in the name:" buttons {"Cancel", "End", "Beginning"} default 0 Cancel button "Cancel".

BTN set to the button returned of theResult

Set text returned by theResult nCharacters as integer

If btn = 'End', then the value of nCharacters - nCharacters

Tell application "Finder".

Repeat with thisFile (document get in Folder files)

theFullName thisFile name value

Set {oldTID, delimiters of point for the AppleScript text} to {AppleScript point text delimiters "."}

If (number of items in theFullName text) > 1 then

the properName my ((texte Articles 1 thru-2 dele de theFullName) text pad value, nCharacters)

the revisedName value to (properName (get last element of theFullName text) {}) as text

on the other

the value revisedName my trim (theFullName, nCharacters)

end if

the text value of the AppleScript point oldTID delimiters

revisedName thisFile name value

end repeat

tell the end

on the trim (t, n)

If n > 0 then

Returns the text (n + 1)-1 through t

on the other

Returns the text 1 to (n - 1) t

end if

end trim

Replace the line immediately after the tell one with:

Repeat with thisFile in (get files Folder)

(137177)

Tags: Mac OS & System Software

Similar Questions

  • How can I get the 8.3 file name short AND way?

    We use some old DOS programs and need to use the old format back (filename.xxx). When the files are in the long trees, it is very difficult to find the names of files under Windows.

    There was a response published in Google (http://answers.google.com/answers/threadview/id/522710.html) which works very well under XP, but when I use it in Windows 7, I get the long file name.

    Does anyone know how to do this?  The program can be changed?  Here is the program of this flajason-ga posted, but it must be updated for Windows 7 (I only know how to program in Foxpro).  Thank you, Alan

    Topic: Re: how to get the 8.3 file name short AND path?
    From: flajason-ga on May 27, 2005 10:45 PDT
     

    After my last comment, I read your details a little closer.
    The last script I posted was to list out a whole directory in 8.3 format.
    If you are looking for a friendly way of Clipboard to recover the 8.3
    for individual files, that will be more to your liking.

    Same thing as before. Copy the below into Notepad and save it with a .vbs extension.
    Except that this time, you can simply drag and drop a folder or file icon
    on the .vbs file and it displays the short path in an input box.
    where you can copy the value and use anything you want to.

    If you're industrious, you can also save the .vbs file in your
    Folder "send to" (C:\Documents and Settings\ [yourname] \SendTo) to have
    It is available in your context menu with a right click.

    Set fso = CreateObject ("Scripting.FileSystemObject")

    ' Is a file or a folder?
    If fso. FolderExists (WScript.Arguments (0)) then
    "It's a folder
    Set objFolder = fso. GetFolder (WScript.Arguments (0))
    Refund = InputBox ("this is your short path:", "SHORT PATH", objFolder.ShortPath)
    End If

    If fso. FileExists (WScript.Arguments (0)) then
    "It's a file
    Set objFile = fso. GetFile (WScript.Arguments (0))
    Refund = InputBox ("this is your short path:", "SHORT PATH", objFile.ShortPath)
    End If

    Hello

    Read the following article.

    How Windows generates 8.3 names to long file names
    http://support.Microsoft.com/kb/142982

  • Not possible to change file name

    In LR 5.7, I have a group of images .jpg of another photographer and am unable to change file name. I get the message: "some pictures will not be renamed because they are absent or not accessible in writing." All of these images are present in the correct folder on my mac.

    I went to individual within the folder of image files, and those who showed that I had only read permission. I could then change to read & write and file name change allowed.

    Thank you for pointing me in the right direction.

  • Problems with the "use tiny file names...". "checkbox in the settings of WebHelp box

    Given that the RH 9 is only able to run on Windows, the checkbox "Use tiny file names..." ' (see image below) can cause some unexpected problems when generating output for a unix (or linux) platform. I found this recently when generating output of web for a project that is visualized on a linux platform machine and met hundreds of broken links unexpected help.

    WebHelp Settings - User LowerCase for Unix.jpg

    If this is the first time you generate your project output, this function works very well - it converts all topics, image files and all what it takes to display help, lower case. However, if for some reason, you had generated previous outputs without this box, and now you have decided that you want all your files output in lower case, just check this box and regenerating the output will not work.

    The reason is simple - the Windows operating system does not distinguish between upper and lower case in file names (e.g., fichier.htm name is the same as the FILE name.) (HTM). UNIX (and linux) are case-sensitive and treat these files are two separate files. Therefore, HR fact not (cannot) change existing file in your folder names with this checked out and gives no message indicating such when generating the output. In this case, the only way to solve this problem is to delete the folder containing your output files and have HR to regenerate your project from scratch.

    I had an additional problem which has made things even worse. In a project for a linux platform, I have unchecked the box during the creation of project by accident (perhaps over a period of days or weeks). Then, due to another problem, I had to restore my project at an earlier stage. At this point, I discovered that my necessary help links of the files using lowercase and uppercase the filenames for all work very well.

    I've seen no mention of this in the HR documentation, so I thought that I must draw the attention of the HR community.

    Yes - just to clarify, I'm taking everything I publish on.

    Reminder - just those who publish in a Unix/Linux warning environment if you need to change the case of file names in your folder you post on and you already have stuff in there with the same name, you will need to delete the files first before you republish.

  • How can I change the font color on the title of file name list in a folder?

    When you do a "file save as"..., type a document name... Can have the police on this document at a red name round (or other color) fonts for the list of files in the folder.  I want to be able to open the folder and have a file name "stand out" in other securities of black font in grip my eyes with red font?

    Vista does not have this capability.  There may be some 3rd party programs that might work for you, but I could find no one who were free and no coming to add this feature to Windows Explorer.

    Here "a s business option: http://www.xyplorer.com/index.htm but it's a pretty radical change (it is just to add the ability to change the fonts, colors file, and includes many other options, but it is not Windows
    Explorer - this is a totally different file manager) and it costs money so I do not recommend because I think that it is better to use a totally different program Windows Explorer, even if it means not to change the font color of file names.  And if you check, it's a bit expensive just to get this functionality (and who knows the other features of Windows Explorer that you like that you may lose with this alternative - don't really know us much and that it works well with Vidta or causes problems - maybe even serious problems as far as we know - because I know anyone who has ever tried it).

    Sorry if this isn't what you wanted to hear, but it's like that. I think the right answer is that Vista is not supported this feature, and then remove it.

    Good luck!

    Lorien - MCSA/MCSE/network + / has + - if this post solves your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • Change file name; DW automatically updates all the links that it

    I read on another forum that if a web site links to a file on 30 different pages, for example, and a user has changed the name of this file, so rather than go through each web page and refresh it to link to the new name of the file, DW could automatically update pages to link the file name again. Is this true? It is possible on DW MX 2004? Currently, when I change a file name in a web page, DW shows the image as a gray with a black X square on it, until I have the point DW to the new name of the file.

    If I change a file name in the Dreamweaver files Panel, all references to the file will change automatically

    Yes. Try it. This works.

    or do I then have to go to the Site. Change the link to the site level to change all the links of the old file name to the new?

    N °

    If all goes well, there is a better way to do...

    See comment 'Yes' above.

  • The HTML - output folder Option and the path of file name change question

    In the HTML Options to file and output file name I was wondering if I can change the name of the .chm automatically listed when I click on properties?

    For example, when I click on properties for ABC_v456, which is a SSL in the project ABC123, I see "C:\Projects\ABC_v123\!" SSL!\Help_v456\ABC123.chm' in the output folder and file name field.  I would rename ABC123.chm in ABC456.chm for the love of light. When I compile it will then create a file .chm by ABC456.chm name rather than the name of the ABC123.chm file? I would have then two SSL in the HTML project called Help_v123 and Help_v456each and their respective .chm would be within each folder.  I speak of the sense or is this clarification requiring gibberish on my part? I use Robohelp HTML v7.

    Hi karima

    You should be able to freely appoint the CHM everything that makes sense for you in the field.

    I remember that too, you are perhaps involved in the development of CSH. If the name of the file could play an important role in that. But even after you generate the help, you should be able to rename it if you wish.

    See you soon... Rick

    Useful and practical links

    Wish to RoboHelp form/Bug report form

    Begin to learn RoboHelp HTML 7 or 8 times now - $24.95!

    Adobe Certified RoboHelp HTML Training

    SorcererStone blog

    RoboHelp EBooks

  • Sort the photos by file name (and change the order of photos)

    After working on my photos in PS I ordered in a slightly different order in Bridge, before you rename them all in the sequence number in the order.

    Now, I have added JPEG files resulting to the LR catalog and I want to see them in the order I put them (IE by file name). In LR, however, they are still on display in order of date (time). It's probably very obvious (usually is!), but what I have to change to show the order of their file name?

    I'm also guessing, it would have been possible to sort/rename in Lightroom, but cannot understand the rescheduling part - anyone know?

    Thank you

    NIC

    You select a package and click the plus sign on the button Collections.

  • Is it possible to sort the images by file name?

    I imported a record of 200 images in Photos for OS X (El Captain). Image files have been appointed in the order - I want them to appear in a slide show: photo_01, photo_02 etc...

    Once I imported the images - I found them all out of order - and the only options I can find in the view menu are somehow 'oldest first', 'newest first' or ' title '. Please, someone tell me I'm missing something obvious - he and not that Apple chose to omit the possibility to sort the images by name? If this is the case - I'm speechless - how is f - ing stupid!

    Sort by file name is not an option in the Photos. Albums and smart albums you yourself set can be sorted by name, date of capture, or manually.

    Sorting through the predefined albums is automatic:

    • 'Photos' display with moments and collections is sorted by date of capture and the location.
    • 'All the Photos' display is sorted by the date of the import session.
    • Other built-in smart albums are sorted by the date of capture.

    You can see the current sort order, preset, if it is grayed out in the "view > sort ' menu.

    As a workaround:

    1. If you need to want pictures to be sorted by file name, copy the name of the file in the title field. Then, create a smart album of the items and sort by title. We have posted a trick to copy the name of the file in the title field for the selected photos: Script: change the title filename without Extensionor: Script: batch change the titles of the Extension/w
    2. Or view your photo library in pictures of power.  This versatile tool lets you browse photos as a list or thumbnail while looking the other metadata under the thumbnails or displayed as list with columns selected and sorted by columns.

    You can do a lot with the free trial: download PowerPhotos here: Fat Cat Software-PowerPhotos

  • Change file names

    I have some videos imported Photos.  I put titles for videos, but when I click and drag them to my office, he still has generic file names (i.e. IMG_0013.m4v).  Is there a way to change the file names of videos and photos from photos?

    When I click on read the information, I can see both the titles and the names of files, but I can't change the file names.

    Thank you!

    J Hevel

    There are two ways to change the filenames of a photo or a video and two require export out of the library.

    The first method is to put the file in the title field name below the thumbnail and export the original

    with the following parameters:

    The second method is to export the original with this setting:

    If you put in "XXXXXX" you will get

  • The batch change date and time

    I have a lot of photos which, for some reason, have lost their correct dates and hours of creation, so I was eager to correct in an easy and enjoyable way.  I unfortunately discovered that Photos is not the batch option to change that used to be in iPhoto.

    When you try to find a solution to my problem, I fell on this batch Change Date and time on a fixed Date, which works well, but not quite how I want it.  What I want to do, that's exactly what the script above does, but rather than increment by 1 minute of each photo, I want to increment by 1 second intervals by photo.

    Having not really used AppleScript before, I tried to change the references to the 'minutes' to 'seconds' but that did not work.  Is it possible to do using above seconds instead of minutes?

    Any guidance would be greatly appreciated.  Thank you.

    Just delete the text "" * minutes ' in the lines where the date is changed. "

    Then time will be incremented seconds.

    For example, for the first version of the script use:

    the value timeIncrement to 1 - increment of time in seconds

    (* select at least 2 images in Photos *)

    say application 'Photos '.

    activate

    game imageSel for (get selection)

    if ({ is } imageSel) or (the length of imageSel < 2) then

    error "Please select at least two images."

    on the other

    defined first_image to the point 1 of the imageSel

    the value first_date to (the date of first_image) as date of

    Repeat with I from 2 to the County of imageSel

    put next_image to the point I of imageSel

    the value next_date to (the date of next_image) as date of

    the value time_difference to (first_date - next_date) + ((i-1) * timeIncrement)

    say next_image

    the value le Date of next_image to (next_date + time_difference) as date of

    end say

    end Repeat

    end if

    return "Set the date and time of" & (the length of the imageSel) & 'photos. The last date is "& ((the date of next_image) as date)"

    end say


  • Breaking - change file name of attachment

    I finally managed to configure burst so that a report is sent by mail using settings stored in a table.

    But the attachment file name is "Output_xxxx.pdf", where xxxx is a number.

    How can I change the file name of the attachment? I found some suggestions on the Internet, but nothing useful.

    I use BI Publisher 11.1.1.7.150120

    Thanks in advance!

    Problem solved - there is a setting for this purpose (output_name).

  • There the opening Style "File names" &amp; "Names of Version" in LR?

    I (finally) move to Aperture and LR plans. My opening workflow was to import the original image file (a file camera RAW or TIFF file scanned) under its original name, make changes (which creates one or more 'versions'). I then rename the version based on a date-sequence numbering system, so that the original (unaltered) maintains its "original name.

    This method is possible in LR? Is there a file system and similar versions? It seems pretty basic info, but couldn't find anything in the forum search.

    Thanks, Dave

    If the version that you want to rename a file as a second saved from the original TIFF file, you can change its name by editing the file name field in the metadata Panel. If you want to rename by using a file name template, you can choose library > rename Photo (or press F2).

    If the version that you want to rename is a virtual copy, you must use the feature to copy name to name this virtual copy (a virtual copy being its own name any file). You will see the name field of the copy in the file name field when the metadata Panel is set to "Default" or "EXIF and IPTC.

    If you want to export a virtual copy as a new file version and have this new file using the name of the copy, include the name of the copy token in the filename template that you use for the exported file.

    Here is an example that I used recently:

    Original raw file. File name: 0001.RAW

    Virtual version of this raw file, cropped to 1:1 copy. Copy the name: Instagram

    Virtual copy exported JPEG file is automatically named: 0001 - Instagram.JPG

    (because I exported using a template configured with chips 'File Name' file name and then '-' then 'copy name')

  • Remove the prefix of file name when exporting to PDF

    Hello

    Here I found a script that exports the current document in PDF format on the desktop.

    I would like for it to change the file name as the first two characters are deleted.

    Example:

    The existing file name is: X_pagelayout.indd

    I want this script to create a PDF file called: pagelayout.pdf

    Thoughts?

    Your help is very appreciated.

    var = myFolder ' ~ \Desktop ";

    myDoc var = app.activeDocument;

    var myDocname = myDoc.name.split (".indd");

    myDoc.exportFile (ExportFormat.PDF_TYPE, file (new file (MyFolder + "\" + myDocname.join (".pdf")));)

    I just tried this and it works fine now...

    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;

    var = myFolder ' ~ \Desktop ";

    myDoc var = app.activeDocument;

    var myDocname = myDoc.name.split ("_") [1];

    var myNewName = myDocname.replace(/.indd/gi);

    myDoc.exportFile (ExportFormat.PDF_TYPE, file (new (MyFolder + "\" + myNewName + ".pdf")));

    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;

    Thank you both for your help - you are gentlemen, scholars and philanthropists

  • Changed file names, can now be updated files

    Help!  This morning I changed my file names domain name I purchased. In doing so, however, seems to prevent me from updating my pages. Now when I click on modify > library > Update Page, I get a message that says, "access file... error file not found (error - 43).

    I * think * the problem is with the name of the model. 60 pages I designed first of all have been built on the name of the original model, '2000 '. All of these pages still say "Templates/2000_template.dwt" at the top of the pages, as shown in this code snippet:

    < ! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional / / IN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > ""
    " < html xmlns =" http://www.w3.org/1999/xhtml "> <!-InstanceBegin template="/Templates/2000_template.dwt ' codeOutsideHTMLIsLocked = 'false'->
    < head >
    < meta http-equiv = "Content-Type" content = text/html"; Charset = UTF-8 "/ >"
    <!-InstanceBeginEditable name = "doctitle"-->.

    I am guessing that, because I changed the name of the template (as well as the file that is stored), the pages of the child does not recognize the new model and then not allow me to update the page.

    How to get out this correction? I can't change the name of the template on each page, as it is in a non-editable area. I have to travel and all my files rename to the original (and now incorrect) name I was working on some?

    Thanks to all those who can help you.

    If layout.css is listed twice, that probably means you have bound him

    twice in the code of your document. Look in the cephalic region of your

    source code of the page for a link twice. Make sure that you remove it

    duplicate with the incorrect file path.

    --

    Al Sparber - PVII

    http://www.Projectseven.com

    Menus in Dreamweaver | Galleries | Widgets

    http://www.Projectseven.com/go/HGM

    The Ultimate Web 2.0 carousel

Maybe you are looking for

  • Windows Firewall problem

    The Windows Firewall is disabled and I need to activate whenever I turn on my PC?

  • Links 2001 cannot verify your drive.

    having installed and uninstalled several times and continue to receive this error after you insert the disc 1

  • Create the custom using elements of Page filter

    HelloI am trying to create a custom of sorts using page elements filter date picker.I want a report to have a where clause clause that says something like this:WHERE the table. Date >: P1_Date1AND the table. Date..: P1_Date2I need to do it this way b

  • Pavilion laptop g7 lists different information after the registration of the first

    Can someone help me understand why my notebook lists a different model and the serial number through automatic detection he did when I signed everything first a year + ago?  It is a Pavilion g7-1150us, but lists another model g7t-1100 CTO. I had the

  • Lenovo system Toolbox breaks down

    Whenever I try to use the application on my T61p it ceases to work, saying that the computer running too many items for the diagnosis information system - even if nothing else is used! Restart the diagnosis/computer (depending on the sreen tips) has