Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Ulfhednar

Pages: 1 ... 7 8 9 10 [11] 12 13 14 15 ... 21
251
Script / Re: MultiScript Name selection excluding file extension?
« on: December 07, 2015, 17:28:42 »
You forgot end parentheses
Nooooooooo!  ::)  How the hell did I manage that?!?!!?

@var $pos = StrRegExpFind($text, "\s[a-z]" );

Mathias - do you think you will have time to polish/extend the debugger functionality or is it a non-priority?  I don't know how many of your users use it, even little things like having right click menu functions would be helpful to me sometimes.
Depends on what in the debugger that are missing need fixing. and what right click on it should do

However.. What are you trying to do.  Make First letter after space uppercase ? So "My small string" =>  "My Small String" ?
Then loop string if you find space then make the next character uppercase.. and continue..
Yes that is what I am trying to do, & I will soon be trying to get the loop right...  Have only had about 10mins today tho as the missing ) shows!

I didn't really have anything super-special in mind for right click, standard commands for when I forget I have to use <ctrl>+X C A etc.
I would like to see the error codes defined. (That would be a cool tool-tip or right click option!!)

252
Script / Re: MultiScript Name selection excluding file extension?
« on: December 07, 2015, 13:58:28 »
OK thanks guys.
Yes I can see my false expectations assumed a position value not just y/n (1/0) response.   ::)

Jungle has seen my expectation/the correct idea in saying "StrRegExpFind function ...to return array of (pos; len)"
(pos; len) was the value I was wanting to pass along, but couldn't see how.
I will certainly try StrRegExpFind & see what happens.

My approach had moved to breaking the string (StrSplit) into sections using " " <space> as the delimiter (I also think a regex with \W would be more useful in some cases)
Having generated an array I just needed to figure out how to manipulate & 'reassemble' the modified string.  Maybe tokenize.

I hope I am getting a better sense of things though!  ;) 

OT
Mathias
- do you think you will have time to polish/extend the debugger functionality or is it a non-priority?  I don't know how many of your users use it, even little things like having right click menu functions would be helpful to me sometimes.


Update
Code: [Select]
@var $text = "My string";
@var $pos = StrRegExpFind($text, "\s[a-z]";
$text[$pos] = StrToUpper($text[$pos]);

gives error
Script engine error => Failed to initialize variable "$pos" with "StrRegExpFind( $text
Script engine error => Failed to define variable - "@var $pos = StrRegExpFind( $text , "\s[a-z]""
Script engine error - Line : 1, Error : -1 => Code : "@var $pos = StrRegExpFind( $text , "\s[a-z]""


Tried different regex eg \w also fails.  :-\

253
Script / Re: MultiScript Name selection excluding file extension?
« on: December 07, 2015, 09:28:55 »
It seems I can give the script a specific command for a fixed position but not one for a variable. 

I have been trying to get the StrToUpper to rename multiple matches, but I couldn't get the command to work correctly with this -
Code: [Select]
@var $text = "My string";
@var $pos = StrIsRegExpMatch($text, "\s[a-z]";
$text[$pos] = StrToUpper($text[$pos]);

// $text == "MY string"
Should this regex work?  I can't see why it chooses position 1, if the regex can be passed to it.

I've ended up looking at an array of parts - haven't cracked it yet though.  ::)
Apologies in advance if I'm being a muppet!   :)

254
Script / Re: MultiScript Name selection excluding file extension?
« on: December 06, 2015, 14:54:00 »
Ahhh I hadn't got as far as thinking I could set a position qualifier on that command! 
I assumed my option was either all lower or all upper when looking at the StrToUpper & StrToLower commands.

Thanks for taking the time to show me that info.  ;)

Seems I can do bad things in all types of coding! :D
I will have a go at PHP/Java & see if that helps me see MS more clearly.

255
Script / Re: MultiScript Name selection excluding file extension?
« on: December 06, 2015, 13:25:46 »
Thanks Mathias.  C++ is on my to do list :P
I am trying to identify my best approach for best use of time.  Comparing MS with things like PHP & Java I can see some elements which seem to have a greater similarity than with C++. 
I do have an interest in C++ as I perceive it as a more powerful tool.

I haven't figured out how to use MS to parse for case!   
I suppose I'd have to split the name to an array then tell MS to capitalize each segment....
Or is there a command/routine I can call (as this feature exists in MR)? :)

I just thought about what I know.  & I find the regex tool/concept interesting so it is a game for me running those.

256
Script / Re: MultiScript Name selection excluding file extension?
« on: December 05, 2015, 19:25:30 »
Thanks for the info Mathias.
Wasn't sure how deeply linked MC.Command & MS are.  I am interested in how you created the system & whether it is possible for someone to add to it.  I assume one needs to know a lot of your code though & that you are the only Expert.

I wondered about camel case for renaming in scripts.  I can see it would be easy to identify in a filename e.g. \s[a-z]+ but would I need to manually add the 26 options a-A to z-Z as I don't see a command that is case changing?
Although it is only 26 lines :P

257
Script / Re: MultiScript Name selection excluding file extension?
« on: November 30, 2015, 19:28:52 »
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.

258
Script / Re: MultiScript Name selection excluding file extension?
« on: November 30, 2015, 13:05:40 »
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




259
Script / Re: MultiScript Name selection excluding file extension?
« on: November 29, 2015, 16:05:09 »
 ::)  OK I think I should just have recalled the discussion on
PathGetFileExtPart
 :-[
 ;)

260
Script / Re: MultiScript Name selection excluding file extension?
« on: November 29, 2015, 14:16:34 »
I managed to do what I wanted by using several passes in the script.
The biggest question I had was trimming extraneous characters like a trailing whitespace or brackets.

I used
Code: [Select]
@var $re = "(docx$|pdf$|txt$)";
@var $reWS = "\s+\.";
to identify file exts to a regex & then ".$1" to ensure a dot was next to that ext.

Wondered if there was a better way. 
I know it is possible to exclude the ext from the rename pass outside MS, & that this way means I must specify the exts for the regex.

I had wondered about StrSplit, but having got the array I couldn't get it to re-assemble after the renaming pass on array element 0.
i.e.
file-name.ext
output to -
0 = file-name
1 = ext

Is there a function to rejoin 0 & 1 + add/keep a . delimiter?
Thanks in advance!

261
Script / Re: MultiScript Name selection excluding file extension?
« on: November 28, 2015, 18:37:36 »
Thanks Jungle. 
I had finally got round to that when I saw your post!  ::)
I thought I recalled something of the sort but was not looking in the right section!

262
Script / MultiScript Name selection excluding file extension?
« on: November 28, 2015, 16:22:19 »
I'm wondering about how to exclude the file extension with multiscript.  (Obviously MultiRename has a switch for this.)

If I use GetSourceSelectedFileNames or similar, I get a complete name.
I thought about generating a list of files to clipboard without extensions & I thought about renaming using a regex but excluding the extension.

Whilst I can imagine using something like (pdf$|txt$) in the regex to force to an end of name, this is quite restrictive.
It would be nice if there is a way to target the process to the different parts <file>.<ext> to avoid some clashes.
e.g.
I have a pdf which the user has labelled document(pdf).pdf as the creator has their Windows settings on exclude showing extensions & uses extra filetype identification signals.
If I run a normal SAR in MS for pdf I'd lose both elements.


Is there anything like e.g. GetSourceSelectedFileNamesExcludeExt script function for file name selections? 
Or have I not found the way this is done?  ::)

EDIT
I am going to try StrSplit & a $anchor to see if I can target it to the correct regex selected elements... & PathGetNamePart is one of the things I should be thinking about!

263
Beta Releases / Re: Multi Commander 5.8 RC
« on: November 18, 2015, 19:34:12 »
Thanks for reminding me of your post on new script functions Mathias & for providing these terrific tools in MC.

I will have to experiment a little.  I can see that I have a number of options. 
I quite like using regexs & I have used them in other MS scripts I have knocked together  :P :)  But the option of using things like MC.Explorer.SetFilter means I have a lot to try out. ;)


When you mention CustomCommand (MC.xxx.xxx ) is there/will there be a way of using the saved rename profiles using that method?
You have provided a great way to implement some quite complex renames, it would be nice to pull them out for use on a button.

264
Beta Releases / Re: Multi Commander 5.8 RC
« on: November 17, 2015, 15:14:23 »
Having seen the new MC.Explorer.SetFilter + parameter FILTERID command. 
I wondered if something similar could exist for the user-saved Rename profiles.  Or does it already exist?



265
Beta Releases / Re: Multi Commander 5.6.1 Beta
« on: November 10, 2015, 18:50:34 »
Quote
maybe for selections where it select items based on different filters many times after each other

Yes that was my thinking.
A multipass script that would allow me to filter out different groups of entries within files/folders.

I imagine looking for specific values in multiple txts -
  • run a filter/selection, then move the selection to a specific folder
  • next search/select pass sent to different folder
  • ....etc

Haven't thought much about how I will try to do it yet but it seems like it would be possible.

266
Beta Releases / Re: Multi Commander 5.6.1 Beta
« on: November 08, 2015, 18:12:24 »
Thanks for the latest build Mathias. 
I see what you mean about possibility of problems with filters.  I had been thinking of tight selections but that didn't take account of the MC possibility of settings creating clashes/odd behavior.  & I guess there are plenty of opportunities for crazy behavior ;)

MC.Explorer.SetFilter will be useful

I am currently using find & then running multiple passes with different terms (regex etc.) I imagined the possibility of turning that into a single filter. 
Maybe a script would allow multiple pass searches...?  I haven't given myself a headache for a while :P
 
Nevertheless it is fun using MC to play with my data :D

267
Support and Feedback / Re: Regex in Find Dialog broken?
« on: November 07, 2015, 18:28:21 »
OK Thanks Mathias.
I am giving it too many terms perhaps  - my entries have been based on c++ 2013
in a C++ example it would be inserted as -
std::regex re("(?:word)", std::regex_constants::icase);
I will try without the (?:
Hope the | works as I want to find multiple variable terms...  :P
Update
Yes I can make it work  ;D  Didn't like me using ?: I guess.
It passes the regex to the hi-lite & find fields in MDV, but MDV can't use it.
It would be useful if it could - is that beyond it's scope?

268
Beta Releases / Re: Multi Commander 5.6.1 Beta
« on: November 07, 2015, 10:38:16 »
I look forward to the time when it is working :D

Also having the filters applicable to delete function is a great idea. ;)  8)

269
Support and Feedback / Regex in Find Dialog broken?
« on: November 07, 2015, 10:36:38 »
I'm entering the following in the find dialog but cannot get it to work
e.g.
Find = *.txt
File Content= (?:word)
+switch= regexp
Returns nothing

Find = *.txt
File Content= word
+switch= (none)
Returns files containing 'word'

That form of regexp normally works or am I going mad again?
   :o
 ???

270
Beta Releases / Re: Multi Commander 5.6.1 Beta
« on: November 02, 2015, 15:02:44 »
If using filters>advanced filters> (preset option)
MC.Explorer.SetViewFilter FILTER="*.*" no longer works to restore the view, necessary to reopen filters dialog & choose 'all'.

I see what you mean about filter name display.  It does work & serves as info.  You already have a tooltip for switches, maybe another tooltip for these preset named functions?
Don't know how easy it is to add specific tool-tips option for Advanced Only filters (this would also allow user to annotate custom filter functions).

Like it all so far & really want to play about with it. :P  The Filter id # is a very useful addition too.  ;)

271
Beta Releases / Re: Multi Commander 5.6.1 Beta
« on: October 26, 2015, 14:23:39 »
Thanks for the explanation Mathias.
I do use the find dialog +contains field currently.

The prospect of seeking multiple terms & being able to use regex's in a search got me excited  ;D

BTW I am enjoying playing with the regex aspect of the new rename dialog as it makes so many possibilities available.

272
Beta Releases / Re: Multi Commander 5.6.1 Beta
« on: October 25, 2015, 12:37:47 »
Sorry Mathias, I wasn't clear.  ::)
I meant 'internally' to allow use on smaller files until the issues are resolved.  i.e . so I can play around with it  :P
Or maybe I should try a script function to search txt content & filter as per your Advanced Selection with Script code.  Or am I going in the wrong direction?

273
Beta Releases / Re: Multi Commander 5.6.1 Beta
« on: October 25, 2015, 12:23:09 »
OK Thanks for clarifying that.
Would it be possible to restrict the matching side to a specific file & file size e.g. .txt <100kb?

Most of my initial ideas for using it would be on multiple txts none of which would be likely to exceed 20kb.

274
Beta Releases / Re: Multi Commander 5.6.1 Beta
« on: October 25, 2015, 11:55:53 »
The new filter dialog is awesome. 
Really want to use it with the content match active ;D

Thanks for all your efforts Mathias

275
Beta Releases / Re: Multi Commander 5.6 RC
« on: September 22, 2015, 17:50:42 »
I noticed a possible error in MDV.
When opening multiple txts with shift-select <F1> the number
[#/#]
for file count, x of xx files, shows
[#/zd]
zd is a constant, # is the number in the selected group.

Pages: 1 ... 7 8 9 10 [11] 12 13 14 15 ... 21