Jump to content
Server Maintenance This Week. ×

Renaming file script


This topic is 7264 days old. Please don't post here. Open a new topic instead.

Recommended Posts

oh man.. i give up...

i just wanted to rename my exported filemaker file to include current datetime as part of its filename. i read somewhere in this forum that i could do this using applescript but hell.. i have only been a mac user for a month.. i guess its not a duration long enough for me to fully understand the language that apple uses and how does the scriptmaker functions...

think i need help here.. an applescript which renames file will be good and i will work out from there...

Link to comment
Share on other sites

There are standard apple scripts for the renaming of files. Look in your programs folder, apples scripts, finder scripts and try the "trim filename" or the "Add to filename" scripts.

Good luck.

Link to comment
Share on other sites

I'm attaching a file. It should be fairly simple. I ran into an odd problem, which I haven't seen before. Which was an error, type 2, when the exported text file already existed, and AppleScript was attempting to change its name.

Probably a timing problem. So I added a little AppleScript to delete the file if it exists (which is before FileMaker would export and overwrite it anyway). Then there's no error. There's no error when just overwriting from FileMaker, so it's the interaction.

The DateTime is done as text, with "_" as a separator; you can adjust to whatever.

ExportRename.zip

Link to comment
Share on other sites

Well, thanks. One reason that some AppleScripts are so complicated is that they have error checking for this and that, often because they have user interaction (and one knows what trouble that can cause).

Another is that they may not be written for FileMaker, which in this case is storing critical info, such as "where is the file?" and "what is the new name?" Also the particular form for the date & time, to be acceptable in a file name. This could also have been done in AppleScript, about the same; but doing it in FileMaker keeps the AppleScript cleaner, easier to read and understand.

Link to comment
Share on other sites

This topic is 7264 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.