Multi Commander > Script
MultiScript Name selection excluding file extension?
Jungle:
Sorry, but I'm not sure I realize what is you task and expectable result. Please clarify your task and provide some examples.
Mathias (Author):
Im not sure what you want to do..
But to trim a string from white space there is a StrTrim function ( List of other string function : http://multicommander.com/docs/multiscript/functions/string )
And a jungle said.. PathGetNamePart(..) returns the filename part. and you also have PathGetFileExtPart(..) that return the file ext..
that you can store in a variable and then add it again when building the final filename
Ulfhednar:
Thanks for replies guys.
I am (once more) playing with MultiScript & hoping I can learn it properly by giving myself problems :)
The breaks between using it meant I forgot stuff :(
I had several ideas about a renaming script. So I had several problems ;)
The MultiRename feature does pretty much everything already & I can save/load the multi-step renames BUT I wanted to call a MR saved pattern into a button, rather than open the rename dialog etc each time I hit a folder that had items I needed to rename.
I couldn't see that it could be done directly so I wanted to try scripts for buttons that gave me my rename options.
In examining several types of rename I realized I could manipulate elements via the array & create more interesting name syntax.
I hit several snags
* - extraneous characters like whitespace (I found different ways of trimming these & making pattern changes with regex)
* - correctly identifying name & ext in the script (resolved when I managed to find the correct functions!)
* - this also raised questions about generating different name patterns & reassembling an array of strings to a single name string (regex works with the pattern structure but I couldn't figure out how to assemble the strings generated - StrLinesArray2String etc attracted my attention - but I failed to complete the idea. I guess I have to think about Tokens)
The result was several different routines that approached my desired results.
I then began to think about optimization that would cover more variables & do more things.
This ultimately led me to the great 'name as folder' script provided waaaay back by jungle
http://forum.multicommander.com/forum/index.php/topic,945.msg2855.html#msg2855
I am now at a point where things are as I wanted but the possibilities I encountered via errors mean that I want to make more complex & interesting scripts.
I have been looking at Jungles script to try & evaluate how it works & thus how to emulate it.
So my spare time is fast disappearing. :P
Mathias (Author):
--- Quote from: Ulfhednar on November 30, 2015, 13:05:40 ---The MultiRename feature does pretty much everything already & I can save/load the multi-step renames BUT I wanted to call a MR saved pattern into a button, rather than open the rename dialog etc each time I hit a folder that had items I needed to rename.
--- End quote ---
You can not load a saved MultiRename setup from script.
I tis on my list. But MultiRename is kind of disconnected from MC so script can't really interact with MultiRename so easy.So not sure when I get the time for it.
--- Quote from: Ulfhednar on November 30, 2015, 13:05:40 ---extraneous characters like whitespace (I found different ways of trimming these & making pattern changes with regex)
--- End quote ---
I don't think you need regex for them, There are alot of string function for most thing so for normal operations regex is not needed.
MultiScript is not pearl :) regex is not required. Most of the time
--- Quote from: Ulfhednar on November 30, 2015, 13:05:40 ---this also raised questions about generating different name patterns & reassembling an array of strings to a single name string (regex works with the pattern structure but I couldn't figure out how to assemble the strings generated - StrLinesArray2String etc attracted my attention - but I failed to complete the idea. I guess I have to think about Tokens)[/li][/list]
--- End quote ---
I'm not sure why you do this. you got the file part in one variable the extension is one.. just combine them.?
No need to flatten arrays or anything.. Not sure what you are doing.
Might be easier to help you if you post the script and explain what you expect that script to do.
Ulfhednar:
Thanks Mathias.
I am now at a point of experimenting. (& hoping to refine my MS knowledge.)
If I ref my example above - document(pdf).pdf - where I wanted to remove the (pdf) name component, I then wondered if I could do the opposite - take the .ext of any selected file & drop it into the name pattern.
So I have been playing around with ideas in the debugger to see what can happen & if I am getting syntax correct to make snippets to possibly use later.
Mostly this is now me playing about, I am just trying different things.
So other than needing a MS crash-course I am OK for now! :D :P
Turns out MS can be fun for me to mess with (!) & gives some useful possibilities that I will expand upon when I have time.
Now I have figured out how to script (some of) my renaming ideas I can wait for you to port the MultiRename functions at your leisure ;)
Maybe using a MC.Command internal-type call to run MR (possibly silently) is a better way than a MS interface?
OT
this has made me wonder if I can call MDV to open files from outside MC - e.g. as a read-only notepad replacement in certain situations.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version