Jump to content

VB Script To Change Import File Extensions


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

Recommended Posts

I'm still looking for the best way for users to change the file extension on a file to be imported from ".xxx" to ".csv".

Someone suggested this would be possible using a VB script.

I did a google search for one and came up with this:

oFS.GetFile( sFSpec ).Name = sName & ".csv"

oTS.Close

Are there any VB script experts out there who can confirm that this will work in a Filemaker Pro 11 Adv runtime or suggest how it might need to be changed to accomplish the goal.

Also, what would be the Appelscript equivalent for my Mac runtime users?

Thanks.

Dave

Link to comment
Share on other sites

No, the bit of VBScript syntax you have there won't work. It's very incomplete and does not include a rename command.

Using a VBscript is a bit overkill for this simple task. It would be much easier to execute a command line with the Send Event script step.

The syntax to execute would look something like this:

cmd /c ren c:\somePath\someFile.xxx someFile.csv

Link to comment
Share on other sites

No, the bit of VBScript syntax you have there won't work. It's very incomplete and does not include a rename command.

Using a VBscript is a bit overkill for this simple task. It would be much easier to execute a command line with the Send Event script step.

The syntax to execute would look something like this:

cmd /c ren c:\somePath\someFile.xxx someFile.csv

Thanks. I like your approach.

One more ?. How should I deal with the issue that someFile.xxx will have a different name for each time the user downloads a new one? Today might be AP063011.xxx, and tomorrow could be FL070111.xxx.

Link to comment
Share on other sites

Thanks. I like your approach.

One more ?. How should I deal with the issue that someFile.xxx will have a different name for each time the user downloads a new one? Today might be AP063011.xxx, and tomorrow could be FL070111.xxx.

Using Send Event, on the Windows side it turned out to be quite as simple as.....

cmd /c ren "C:\Folder\*.xxx"; "*.csv"

But, what will the equivalent be on the Mac side?

Thanks.

Link to comment
Share on other sites

Thanks. I like your approach.

One more ?. How should I deal with the issue that someFile.xxx will have a different name for each time the user downloads a new one? Today might be AP063011.xxx, and tomorrow could be FL070111.xxx.

The send event lets you specify a calculation to produce the command string. So you can easily use a variable in there that holds the name of the particular file...

Link to comment
Share on other sites

This topic is 4680 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.