Problem with rename file with applescript

It seems very stupid to ask, but I am VERY new to the apple scripts and trying to learn it.

I get an error with the following script. I'm setting up of automator to take a file placed in a folder with folder actions implemented. But I get an "unknown error".

It should take the file and rename it to the content of the text in the Clipboard and preserve the extension.

tell application "Finder" to activate
tell application "Finder"
   set theExt to name extension of theFile
   set the clipboard to «class ktxt» of ((the clipboard as text) as record) # remove styles from the clipboard
   set theNewname to the clipboard
   set name of theFile to theNewname
   set name extension of theFile to theExt
end tell

You don't need to activate the Finder unless you want to come to the fore and, as you are already down a file in a folder, I think it's already there!

I don't really understand your workflow to understand what you put into the Clipboard, so it would need to be a tweak if this script does not work for you.  While you can set the name explicitly extension, I just built the new name, including the extension in the newName variable.

NOTE: I put a test in preventing the name change goes forward.  If you don't want that, remove the otherwise.  As always, make sure that you have a backup!

say application 'Finder '.

the value theExtension for name extension of dittos

oldName put to the name of dittos

set newName to (Clipboard) & "." & theExtension

display the dialog box 'Are you sure you want to rename' oldName & "to" & newName buttons {"Yes", "No"}--delete this line and two others below if you do not want to check

If the button returned of the result is 'Yes' then - delete

the value name of dittos to newName

end If - remove

end say

Tags: Mac OS & System Software

Similar Questions

  • Problems with file renaming Applescript

    Hello all and thanks in advance! I am currently working on a set of scripts that will work in tandem, and I got everything settled except this little AppleScript. It is essentially supposed to rename all the files in a given location at just the last two "words" in a folder (which are essentially the UID) and I used it several times in the past with success, but now that I have removed the guests 'choose folder' and instead of giving a specific path, I ran into the question after question. Here is my script up to now:

    Tell application "Finder".

    Repeat with this_folder in "Macintosh HD:Users:Server:Desktop:Test"

    name of the value folder_name this_folder

    Tell me to define the word - folder_name 2 contract

    Tell me to define the word entity - folder_name 1

    Set final_name to contract & "-" & entity

    If not (file final_name) then

    Set the name to this_folder to final_name

    end if

    end repeat

    tell the end

    say

    I'm now see "unable to get the name of \"M\. ' number-1728 name of "M".

    I thought it was a problem with the path at first, so I commented on the remaining elements of and had no problems from there. As I said, this script worked well when there was a prompt "choose a folder '; the only change that has been made is the reference to the file prompt. Thank you once again.

    As a first step, you should have written:

    Repeat by this_folder in the file "Macintosh HD:Users:Server:Desktop:Test"

  • Download a file should implement an option to open the file or save it - for some reason any now just downloading it straight to the download folder. Why? Problem with Firefox or something else?

    Download a file would normally bring up an option to open the file with the appropriate program or save it - for some reason any now just downloading it straight to the download folder. Why? Problem with Firefox or something else? It is very frustrating - sometimes, you want the first opened file so it can be discarded or stored in a different location.

    Find the type of file in the Firefox -> Options -> Applications Panel, open its menu drop-down and select 'ask '. To reset all the actions of download, delete the mimeTypes.rdf file in your Firefox profile folder (or rename the mimeTypes.rdf X if you want to save as a backup). The file will be regenerated with all types of files, restore the default actions.

    For more information, see application Panel - set how Firefox handles different file types and change what Firefox does when you click on or download a file .

  • I have problem with a .iso file that when I want to use I face the error "the file name is too long.

    Original title: name of a file

    Hello

    I have problem with a file .iso that when I want to use I'm dealing with error "the file name is too long" and I can't use this file anywhere for example: vmvare ' untraiso and even if I cannot write to cd or make a boot USB.

    I don't know how fix it.how I rename the file iso, shorter that I can use?

    Please help me.

    Thank you.

    Right-click on the ISO > rename > give a short name

  • What is the problem with my files, they don't move, copy or delete? #@?!!

    ..... It is not as easy as you think, either! I am not a novice, but I can't understand how to solve this problem! If I try to move the copy or rename them, Windows XP said 'Impossible. Access denied. Even the disk is not full or write protected and the file is not in use."  Well NO, the hard disk is NOT write protected and far from complete.  No other files in "My Documents", or if otherwise, give me problems. In addition, the files themselves are not protected in writing! They don't have ANY special attributes (IE. 'Read only' and 'Hidden' are NOT defined). Needless to say, I did not define all attributes on them myself, they are not in a shared folder, and I am the administrator of my own computer. When I restarted the computer the next day, it changes nothing! The problem with these particular files remained!

    I was able to move, rename, or delete only with UNLOCKER. But it's not my problem. My problem is when I try to burn any program I use, burns keep in check the end and I keep losing DVD - R, one after the other! I understood the reason for the failures of engraving is because of this problem of reading / writing weird with the files!  WINDOWS XP created this write protect it somehow, because he wasn't on the original files! However, this limited access status is invisible! There is no set special attributes on these files!

    They are just media files, I downloaded, as well as text files (FIVE files different, slightly different formats, ALL from different sources!). They have been downloaded to FIVE different subfolders created in 'My Documents'. And it's not just the affected media files. It's all the files that are in the same folders (ie. txt, jpg) (even if I can at least open the jpg, while I can't read multimedia files).  I've never had this problem with any other similar files downloaded in the same folder. These files are NOT protected by copyright, OR infected by viruses, AND I do not have the virus on my system. (I stopped Kaspersky, my virus program, but it made no difference. "So there was no lock file). Yet, I can play is no longer the files (so that I could before the etc..). VLC says "cannot open the file", WMP says similar. I created a new folder in My Documents, moved to the new folder with UNLOCKER, it made no difference! Same problem! Even using UNLOCKER to transfer them to the desktop, not in any folder in itself does not change a thing! Here is another beauty: software "UnlockIT" says "the file is not locked by any conducted! I have to be to imagine...

    ... This whole thing really made me realize how Microsoft Windows helps my carpal syndrome problem...

    Hey PieterVO,

    I've seen this in a few other threads before. Although I don't have a FixIt for you, I have a few discussions to look over.
    I would like you to try to take possession of the individual files that you work with and try again. I didn't see the error codes listed above, so if you get the error codes, please report it to their.
    See Kieron June 9 Post and post Stickywulf November 14 in the second thread I listed above.
    Give those a try and let us know the results. I hope this helps. Thank you!
  • Problem with the playback of an audio .asx file in Windows Media Player.

    Hello

    I'm not able to play an audio .asx file in Windows Media Player on the Windows Vista-based computer.

    I get the following in a pop-up error message:

    Windows Media Player cannot play the file because the specified protocol is not supported. If you typed a URL in the open URL dialog box, try using a different transport protocol (for example, "http:" or "rtsp:").

    Help, please.

    My email address is * address email is removed from the privacy *

    Thank you.

    -HimAlandi

    Hello

     
    1. facing this problem with the .asx format?
    2. you remember to make changes to the system?
    3. where is the file?
     
    Error message: "Windows Media Player cannot play the file because the specified protocol is not supported. If you typed a URL in the open URL dialog box, try using a different transport protocol (for example, "http:" or "rtsp:"). »
    Windows Media Player cannot play the file because the specified protocol is not supported by the player or not supported by the server.
    If you encountered this error by clicking a link on a Web page, the link isn't valid.
    If you encountered this error by typing a URL in the open URL dialog, try opening the file using a different transport protocol (for example, "http:" or "rtsp:").
    The following is a list of protocols supported by the player and the correct URL syntax examples:

    (a) MMS://serveur/nom_fichier (for example, a file with a .wma, .wmv, .asf, or .mp3 extension)
    (b) http://server/filename
    (c) rtsp://server/filename
    (d) mms://server/sami.asf? SAMI = http://server/sami/sami_demo.smi (SAMI file)
    If the Player supports the protocol you used in the URL and you can't always read the content, check that the drive is configured to use all of its supported protocols.
     
    To configure the protocol settings
    (a) in the Player Windows Media, on the Tools menu, click Options.
    (b) in the Options dialog box, on the tab of network in the Streaming protocols area, select all the checkboxes (Multicast, UDP, TCP, and HTTP) Protocol, so that a check mark appears in each.
    (c) note that the supported protocols can be used only to distribute digital media files. Windows Media Player cannot be used as a browser.
    If the fixes above don't work, you can rename the folder of information network for the drive so that it can rebuild its information network files after restarting it.
     
    To rename the folder of information networking of player.

    (a) close Windows Media Player. (To do this, on the file menu, click on exit).
    (b) to make the changes that you will be able to see the hidden files and folders
    Show hidden files.
    http://Windows.Microsoft.com/en-us/Windows-Vista/Show-hidden-files
    (c) click Start, and then click computer.
    (d) open the disc drive Local (c :)), open to users.
    (d) open your user account.
    (e) open %APPDATA%\microsoft\windows\sendto and open Local.
    (f) open Microsoft and open Windows Media.
    (g) click on the file and rename it.
    (h) if the file is name12.0, edit as file name as old 12.
    (i) restart the computer and check
  • Problem with the files in the folders

    When I'm renameing my music files they automatically categorize by alphabetical order, so I have to scroll to the top to work on the next file. How to stop them from doing this. I didn't have this problem with Windows XP, they remained in order until I closed the file then they in alphabetical order.

    Mr-music

    Windows Explorer has been redesigned from scratch for Vista and works a lot differently.  Try this: before you rename it, sort the folder by a property which will not change as the size of the file.  After name change is done, sort the file by name.

    Mr. Doug in New Jersey

  • There seems to be a problem with the soft ware.  We use the CS6 for Records services and when we try to save the record, part of the record is stored. The record to be saved as an mp3 file is 70 to 100 KB but recently only 3 KB are generally

    There seems to be a problem with the software.  We use the CS6 for Records services and when we try to save the record, part of the record is stored.  Usually the recording to be saved as an mp3 file is 70 to 100 KB but recently only 3 KB are recorded.  What should I do to fix this?

    You may need to reset your preferences of hearing files stored in C:\Users\"username"\AppData\Roaming\Adobe\Audition\5.0. If you rename this folder in 5.0.bak that hearing won't find it when you open the next time if it will recreate a new settings with the default settings folder. See if hearing then works as expected.

  • Problem with import *. The 60 fps MTS files

    Hello! I have a problem with any dry imported into Premiere Pro CC 2014. Files created by camcorder Panasonic AG-160, fullHD 60 fps, Dolby Digital sound. When I try to tax, program tell me that files was not supported for compression type. (CS5 and CS6) previous versions worked with these files correctly (and now work).

    Rename the folder in the files, and then try again.

  • Problem with first decoding or preview files using Canon DSLR on PC

    Use: First CS5.5

    Problems on laptops and desktop

    Laptop: 12 GB RAM

    Intel: i7

    1.5 GB of Nvidia

    Office: 16 GB of RAM

    Intel: i7

    SSD: 256

    GTX 470

    Is not all clips, but probably 1/5th clips will have 3 or 4 frames of the clamp of the screen randomly corrupt pixels.  See this gif (ignore the interlaced effect), on the lower part. http://i.imgur.com/Kx5Yb.gif

    It is with DSLR no transcoding to 1080 p, 23.976

    If I go into the source file, it plays fine on VLC and Quicktime.  If I delete and re-import the clip, it does the same thing.  If I delete, rename, import the clip, it does the same thing.

    Need help please, it is a puzzle to me.  Transcoding is not an ideal solution.

    Your file is broken. Despite having said that it plays in QuickTime, it does not work:

    It's a little more difficult to notice in QT Player, but it is there; It is easier to notice if you move through levels, frame-by-frame in the clip with the arrow keys left and right.

    So, it's not a matter of Premiere Pro; There is something causing your clips corrupted. My first guess would be a bad CF card, but it could be something as Benin as a copy process borked (CF on hard disk) to something as serious a problem with your digital SLR. I don't think there is anyway to fix these files; My usual stuff did not work, which suggests that it is not a problem of container, but a problem with the video stream itself real.

    Bad luck.

  • Live data / problem with the permissions of files

    Just try an old version of Dreamweaver MX 2004. I use my service for server/test remotely webhosting server functions. It is running PHP 4.3.10 and MySQL 3.23.58. I was able to set up the database connection and test - retrieve a recordset with no problems. By following the tutorial, I found that visualized wouldn't work, he just gave me a warning about file permissions be wrong. It turns out that when Dreamweaver creates a temporary file of the work-in-progress to upload to the remote server, the file is created on the server with owner = rw, group = rw, r = world, which explains why it does not-group must be set to group = r. The file is created on the fly and then immediately deleted by Dreamweaver so it is impossible to manually set permissions on the server and probably pretty useless too.

    I tried just to save the file and the preview in the browser that forces again to be uploaded to the remote server. The first time, it resulted the browser offering a download of the file box instead to run the page. The reason is - again - that Dreamweaver updates downloaded file permissions to include the Group = rw. If I manually set permission for the group the r = group that it works very well.

    It turns out that Dreamweaver always puts the permissions of files on the downloads of files (checked php and html) on the remote server / tests to include the Group = rw. Once I have it placed manually on the remote server / tests to the Group = r for a php file, everything's fine and later additions of the same file do not change it again.

    I checked with the Web hosting company and their second line reported back that the default file permission they put on downloaded files includes group = are so DW that causes the problem of definition of group = rw first. I was confirmed using WS - FTP to download the same (renamed) file in the same directory target and the set of permissions were owner = rw, group = r, world = r.

    Then

    Can someone tell me please how to change permissions that DW sets on the files written on a remote server, because I spent countless hours on it without success. Go looking at other posts in this forum, it could be that other users hit the same kind of problem with DW8

    Specifically, Dreamweaver supports the ability to use a remote server for testing purposes. It seems reasonable to test the site locally using the real remote environment in which it must be applied if the site is not already online.

    It turns out that the problem for me is related to what the remote server and tests of server connection configured to use SFTP. This caused the files created on the remote server to have RW set for the group that has been causing all the problems. When the value to use FTP standard, is very well - prepare file permissions properly when downloading and data online works as expected.

    Another SFTP side effect was that the site FTP log contained the Interline - am added to many of them whenever the remote server has been consulted but no text. On the configuration of the connection to standard FTP log fills up with messages as expected.

  • I can't access some websites using Firefox. For my own site, I get "file not found". My Yahoo downloads in the form of text. No problems with browsers IE or Chrome

    I can't access some websites using Firefox. Pages say "File not found" or in the case of Yahoo and Facebook, they resemble the on-screen text files. No problems with my computer and it is not the case with my browsers IE and Chrome. Already deleted and reinstalled Firefox and it has not solved the problem

    You can also do a check of malware with some digitization programs of malicious software on the Windows computer.

    Please scan with all programs, because each program detects a different malicious program.

    All of these programs have free versions.

    Make sure that you update each program to get the latest version of their databases before scanning.

    Alternatively, you can write a check for an infection rootkit TDSSKiller.

    See also:

  • I'm having a problem with the FireFox browser. I have attached two files that describe the problem. I have marked their A & B. A is the way it should lo

    I'm having a problem with the FireFox browser. I have attached two files that describe the problem. I have marked their A & B. A is how it should look like and B what happens once I have, I opened several tabs. I can get it back to normal if I click VIEW, click Customize. When the window customize appears that Firefox returns to its normal state. I have to click on the done button and go back to what I did. I tried to reset FireFox back to the default settings, but that has not fixed the problem.
    It started happening a month. Is there a way I can fix this? Thanks for your help. I don't know how to fix my 2 attachments that shows the problem I'm having.
    [email address removed to protect your privacy and security]

    Try disabling hardware acceleration in Firefox.

  • Hello, I have a problem with Mozilla Firefox 14 and now also Firefox 15. When I click on .html files on my desktop, firefox will open a new window twice. Where is the th

    Hello, I have a problem with Mozilla Firefox 14 and now also Firefox 15. When I click on .html files on my desktop, firefox will open a new window twice. Where is the problem? Thank you

    That may be a problem with the DDE.

    Try to undo and redo Firefox as default browser.

    Make a different browser like IE browser by default and then let Firefox do it again.

    See:

  • M200 problems with the file properties

    M200 with a GB of memory and all the usual gubbins. Recently applied SP2. also, I tried (without success) to uninstall this P in sw A Norton anti-virus. I usually prefer a combinaiton of McAfee and Zone Alarm 2

    Problem is that when I try and select the properties of a file (that is send via an infrared connection or attach it to a message recipient), the crashses of the Explorer window. I find myself also get accidents such as

    Delay (30000 milliseconds) waiting for a response from the WZCSVC service transaction.

    I thought at some point it might be a problem with ZoneAlarm but who have turned off with no improvement.

    Any ideas?

    Hello

    I don't know, but as far as I know you can remove the Norton if you check all entries in Add and remove programs in the control panel. One of my friends told me that there are a few entries, and you must be lucky to pick a good one. As TOS said trying to work through.

  • 550 d NB: problem with HD file restore (files video edit)

    Hi, I have a problem with my TOSHIBA NB 550 d. (Win7)
    I have the graphics card Ati Radeon HD 6250. Pack Codeck K-lite Mega, matroska I Core AVC)
    2 GB Ram memory

    Driver ATI 8.812 2.1000 installed by the manufacturer.
    Files in format HD (mkv 1080) will not restore and play smoothly (audio and video) even the 720 p files are at a standstill.
    In the course of a CPU is busy at 100%.

    Looks like he's going only through processor, not through the graphics card.
    The driver does not support playback of HD files.

    How to solve this problem?
    Please

    Mariusz

    What Media Player do you use?

    Try VLC or MPC and try different codecs MPEG4 as FFDShow (first uninstall K-Lite).

Maybe you are looking for

  • Document scanning on HP DeskJet 4180 but does not OCR

    HP DeskJet 4180 9.0 OCR software with HP (IRIS) scans the document, but does not OCR. I have the gray value default values and sends the output of Wordpad. I tried everything suggested that HP and reinstalled software twice. What Miss me? With the he

  • Photosmart 6515 stopped printing black

    Printer worked fine for a year.  Low so changed black cartridge (HP only), did the setup and does not now print black. Completed all the steps, cleaned vents, print heads cleaned, etc.  Still does not work.  Tried another new cartridge, still does no

  • Bluetooth Auto Discovery

    Hi guys. I'm trying to connect my Nokia E71 via Bluetooth to my Toshiba Satellite E105-S1402. He discovered my MS mouse, but not my phone. My phone can pair with another phone, so I know that the transmitter is on. My laptop won't change its settings

  • You can create a list of files in the folder text file in Windows 7?

    I'm trying to compare files in two different folders, file name, creation date, size of the file. Is there an "easy way" to create a list of files with attributes? Thanks for the help.

  • What makes magical storage mirroring

    Hey Experts,.Can you please have your ideas below Declaration: -. Tightly integrated with the Oracle database, the Recovery Manager HP 3PAR software automatically detects and intelligently maps all elements of data - including data files, table space