mike kim Posted February 4, 2007 Posted February 4, 2007 does anybody know a free plug in that i can move , copy , delete and rename a file ? thanks , : mike
Genx Posted February 4, 2007 Posted February 4, 2007 No, not a plugin (not a free one anyway), but you can use VBScript, or send event... The following is an example of a vbscript that copies a file from a source path to a destination path: Dim objFSO, objFileCopy Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFileCopy = objFSO.GetFile("C:MySourcePathFile.exe") objFileCopy.Copy ("C:MyDestPathNewFile.exe") To run it, just put it in a text field and export the field contents to a file specifying .vbs extension and choose the open after export command. .. Or use Send Event -- I'm a bit rusty on my cmd scripting but this should move a file from point a to point b. Move "C:MySourcePathFile.exe" "C:MyDestPathNewFile.exe" Delete a file: Del "C:MySourcePathFile.exe" or Erase "C:MySourcePathFile.exe" Rename a File: Ren "C:MySourcePathFile.exe" "NewFile.exe" In FM you could format the above examples as follows in the send event calc: "Move " & Quote("C:MySourcePathFile.exe") & " " & Quote("C:MyDestPathNewFile.exe") If you really want real control and to be able to interact effectively with the OS, you might look at the GrokitTools vbscript plugin for FM -- It's cheap, but one of the best investments i've personally made.( www.grokittools.com ) OR... You could also just import into a container and then move that file wherever you want by exporting it to whatever location.
mike kim Posted February 5, 2007 Author Posted February 5, 2007 hi, genx ! i tried your visual basic code in fm send event calc and it didn't work. probably i did something wrong and can you clarify it for me. i need to move and rename and delete image file. can you give me exact formular to enter into send event calc field ? and do i need to install visual basic in my computer ? as you know if i enter Ren "C:MySourcePathFile.exe" "NewFile.exe" fm error pop up shows up and say :ren file can't be found" and so on. so i make it < "ren"&"C:MySourcePathFile.exe"&" "&"NewFile.exe" and it didn't work neither. thanks , mike ------------------------------------------------- >> Delete a file: Del "C:MySourcePathFile.exe" or Erase "C:MySourcePathFile.exe" Rename a File: Ren "C:MySourcePathFile.exe" "NewFile.exe" In FM you could format the above examples as follows in the send event calc: "Move " & Quote("C:MySourcePathFi le.exe") & " " & Quote("C:MyDestPathNewF ile.exe")
Genx Posted February 5, 2007 Posted February 5, 2007 (edited) Okay firstly, Don't get the two confused... we have cmd line scripting and vbscripting -- the simple ones are cmd line. Secondly, i forgot that you need to prefix cmd (to tell windows to use the command console to process your command) and /c to run the command and close the console or /k to run the command and show the console (useful for debugging. There are of course more options but i haven't used send event in a while so i forget them. "cmd /c Move " & Quote("C:MySourcePathFi le.exe") & " " & Quote("C:MyDestPathNewF ile.exe") Paste this into fm and just change source and dest path. Let([ SourcePath = "C:MySourcePathFile.pdf" ; Dest Path = "C:MyDestPath.pdf" ]; "cmd /c Move " & Quote(SourcePath) & " " & Quote(DestPath)") Edited February 6, 2007 by Guest
mike kim Posted February 6, 2007 Author Posted February 6, 2007 Thanks , Genx ! i will try that. mike
Genx Posted February 6, 2007 Posted February 6, 2007 Sorry, kill the last quote mark, it's just a stray Let([ SourcePath = "C:MySourcePathFile.pdf" ; Dest Path = "C:MyDestPath.pdf" ]; "cmd /c Move " & Quote(SourcePath) & " " & Quote(DestPath))
Adam Dempsey Posted February 8, 2007 Posted February 8, 2007 If you are still trying to find a solution to this, attached is a small Plugin I've been working on, which has some basic File, Folder and Zip functions. If anyone finds it useful I may do some more work on it and add some more functions. Dempsey MooPlug.zip
serzone Posted February 8, 2007 Posted February 8, 2007 got your plug-in, a little bit of documentation on that would be great!
Adam Dempsey Posted February 8, 2007 Posted February 8, 2007 Well I haven't got any documentation for it atm, the functions are pretty basic, FileMove accepts an sSource and sDest or something. Can't rememeber off top of my head and I'm on wrong computer atm. Are there any paticular functions you want some help with? They all either return a path if you ziping etc or |Err_1 etc. I'll try make a list of the errors somewhen.
serzone Posted February 8, 2007 Posted February 8, 2007 Thanks for the reply... what I've been trying to use is the file exists function and i can't seem to get it to work: I've tried: Moo_FileExists( "C:test.pdf" ) Moo_FileExists( "C:/test.pdf" ) Moo_FileExists( "/C:/test.pdf" ) Moo_FileExists( "//C:/test.pdf" ) Moo_FileExists( "file:/C:/test.pdf" ) Moo_FileExists( "file://C:/test.pdf" ) Moo_FileExists( "filewin:/c:/test.pdf" ) so i guess the question is what's the file path and name supposed to look like? 10x!
Adam Dempsey Posted February 8, 2007 Posted February 8, 2007 Moo_FileExists( "C:test.pdf" ) should work, as I say, I don't have the code here, but I'll take a look 2moro and see what's going on, I've been working on the plugin quite a bit today, I may have broken some stuff while I was tidying up some code. By the way, when you say you can't get it to work, does it return any value? I think that function just returns a text value of "True" or "False", as I couldn't figure out how to make it return an actual boolean value.
serzone Posted February 8, 2007 Posted February 8, 2007 (edited) never mind... i think i got it... "c:/test.pdf" and i think it's case sensitive. Great, thanks again! Edit: it wasn't returning anything, but returns true or false now that i'm using "c:/test.pdf" Edited February 8, 2007 by Guest
serzone Posted February 8, 2007 Posted February 8, 2007 ok! finally: if you have a script that assigns a variable the file exists command: $test_var = Moo_FileExists( "c:/test.pdf" ) then i don't get anything in return neither true nor false. BUT if i do it like this: $test_var = "my test: " & Moo_FileExists( "c:/test.pdf" ) then i get: my test: True in return (or false if the file doesn't exist). Either way this will do it for me. Great stuff, you rule!
Adam Dempsey Posted February 8, 2007 Posted February 8, 2007 Hmm I'll look at that tomorrow, shouldn't ever return blank. But glad to hear you got it working :
ino Posted February 8, 2007 Posted February 8, 2007 Hi Dempsey, is it the way to do Your Plag In: MAC OS X compatible? Regards ino
Adam Dempsey Posted February 8, 2007 Posted February 8, 2007 Its currently only for Windows, as that's all that was required at work, but I'll look into making an OS X version as well : i'm thinking of adding some more functions to this plugin, as well as making it cross platform and then charging a nominal fee for it, just to say thanks, such as $40 or so a licence, i dunno. Can't remember pricing strucutr of Troi File Plugin, but it would deff be lower than that
Genx Posted February 8, 2007 Posted February 8, 2007 Cool dude, do some more work on it. Basic functions that would be useful: Delete Folder / File Move Folder / File Copy Folder / File Rename Folder / File FileExists FileSize Create Folder / File
serzone Posted February 8, 2007 Posted February 8, 2007 maybe a getFileList(FolderName, separator) function? You'd pass the folder name to the function and a separator like ; or , and you'd get back a string with all the files in that folder separated by... the separator. That would be TOTALLY COOL and i don't know if any of the current commercial plug-ins have that ... maybe it's not possible to do?...
Adam Dempsey Posted February 9, 2007 Posted February 9, 2007 Cool dude, do some more work on it. Basic functions that would be useful: Delete Folder / File Move Folder / File Copy Folder / File Rename Folder / File FileExists FileSize Create Folder / File Yea some of these already exist, but I'll add the rest : maybe a getFileList(FolderName, separator) function? Yea that sounds like quite a cool function, I'll work on that today. :
Recommended Posts
This topic is 6566 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