stefanshotton Posted February 25, 2005 Posted February 25, 2005 Scenario I want the user to be able to copy/move a file from one location to another without having to type in the file extention in the destination path. ie. .pdf .doc etc as they keep cocking it up and are then unable to open the file. Ive looked at various plug ins for file manipulation and they do not seem to offer a script that identifies a file type. Is ther a plugin that can do this or is there a way around it?
transpower Posted February 26, 2005 Posted February 26, 2005 I suggest you write your own script and batch files. Use the Send Event script step.
stefanshotton Posted February 28, 2005 Author Posted February 28, 2005 Thanks for reply, however way out of my league as a mortgage broker! lol will have to live with unless anyone else has an option.
SteveB Posted February 28, 2005 Posted February 28, 2005 Look at the Troi File Plugin at www.Troi.com. It will enable you to rename and move files fairly easily. Steve
stefanshotton Posted February 28, 2005 Author Posted February 28, 2005 Thanks steve the problem with troi and the others ive looked at is you have to assign a file name to the copied or moved file, when prompting the user to enter the filename they dont understand which file extension to list at the end of the filename, then they complain that they then cant open the file when it has been moved.
SteveB Posted February 28, 2005 Posted February 28, 2005 You're right, users are generally clueless. Have you thought about using a temporary file to create the output (known only to you), then get a filename from the user without an extension if necesssary, and then moving an renaming the temp file? Steve
cobra Posted March 2, 2005 Posted March 2, 2005 Hi stefanshotton, You can use the TroiFile plugin to get a directory listing. Write a script that gets the list of files in the directory and compares each to the filename (excluding the extension) that the user entered (as the copy-from file). When a match is found, you extract the file's extension for the copy/move. If a match is not found within the list of files in the directory, your script presents a "File Not Found" message to the user. To accomplish this, you need to have your script loop through the list of filenames returned by Troi's ListDirectory function (it might be named something else, please refer to the Troi manual). Your script extracts one file at a time to a temporary field and compares it (minus its extension...use the middle function in conjunction with the position and patterncount functions (keep in mind that you always want to get the last "."...that's why patterncount is needed)) to the filename (again this is the copy-from filename, rather than the copy-to filename) typed in (or selected) by your user. When a match is found, you can safely copy the file to the new location (again, use the middle function to extract the original file's extension) and exit your loop. Exit your loop and display a "File Not Found" message to your user if you run out of files to check in the directory. I'm sorry for not showing you how to code this, but I've just gotten off a 12 1/2 hour work day and need sleep badly. I'm hoping one of the posters above will be able to help now that I've explained what needs to be done. To confirm that it can be done, I'm using exactly the method above to accomplish pretty much what you're trying to achieve (in my case, files are renamed and copied to new folders automatically...and the copied files retain the extensions of the original files). Hope this helps! Kind Regards, Cobra
Recommended Posts
This topic is 7274 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 accountSign in
Already have an account? Sign in here.
Sign In Now