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 2 3 4 5 [6] 7 8 9 10 ... 22
126
Script / Re: Title Case
« on: July 09, 2018, 22:07:04 »
I managed to plagiarize that piece  of code Mathias, I hadn't been sure how/where to insert it but I figured it out :P

Code: [Select]
@var $arr = GetSourceSelectedPaths();
@var $NameA = PathGetNamePart( $arr );
@var $newText = TitleCase($NameA);
@var $NameB = $newText[0] = StrToUpper( $newText[0] );

{
RenameFile( $arr, $newText, "RENAME_RO" );
}

Thanks again. ;)

BTW do you use any specific syntax coloring to help when when coding with MS?  I find it helps me if I can use colors when I'm trying something.  ATM I am using notepad++.  Any recommendations for coloring?   (It's probably a big job but maybe you can add syntax coloring to the MS Debugger some time....?)

127
Script / Re: Title Case
« on: July 08, 2018, 22:30:57 »
Thanks Mathias.  I appreciate the help. :)

My solution was more verbose.  My primary focus was to get a working version.  Now I can use this as a reference whilst I am playing about trying to tweak & tidy my code.
I had looked at the
Code: [Select]
$textPart[0] = StrToUpper( $textPart[0] );entry & was going to try it, but decided that I would probably create a conflict/problem.    ::)
So I went with what I knew would work with this task as a logical progression/last check on the first word case status. :P
I'd also wondered about adding a line equating to something like "ignore exceptions array if word starts with/at character 0" within your function.

I intend to come back to your function code as I need to understand how you have used scope & therefore how to use that $textPart[0] to check first word capitalization as the last operation before generating $NewText..

I think I understand about $n, that is interesting & raises more questions for me. I'm glad you have shown me that this can happen or I am sure I would have been driven crazy had I accidentally discovered it alone :)   

128
Script / Re: Title Case
« on: July 08, 2018, 14:59:16 »

Sorry,. I don't understand your reasoning how that should work, it make no logical sense :)
I know!  :D

Thanks to your input, I realized I hadn't assigned iterations & needed more references for the arrays & got it to work - I am still finding it hard to balance how smart code can appear with how dumb the machine really is  :P

Code: [Select]
@var $exceptionsArray[] = { "a", "as", "an", "and", "any", "at", "for", "from", "into", "is", "of", "on", "or", "the", "to", };
@var $n;
@var $oldN;

function TitleCase($name)
{
   return  _TitleCase($name, " ");
}

function _TitleCase($name , $splitchar)
{

  @var $result = "";
  @var $parts = StrSplit($name , $splitchar); // space and - will split string
 
  @var $cnt = arrayCount( $parts );
  for( $n = 0; $n < $cnt ; $n++ )
  {
    @var $textPart = $parts[ $n ];
    // To Lower
    $textPart = StrToLower( $textPart );
 
    if( StrFind( $textPart , "-", 0 ) > 0)
    {
      // Becuse of recursive bug, $n is is overwriten
      $oldN = $n;
      $textPart = _TitleCase($textPart , "-");
      $n = $oldN;
    }

    if( arrayFind( $exceptionsArray, $textPart ) == -1)
    {
    // Uppser case on first
    $textPart[0] = StrToUpper( $textPart[0] );
    }

    if( StrLen( $result ) > 0 )
$result += $splitchar;

    $result += $textPart;
  }
  return $result;
}
 

@var $arr1 = GetSourceSelectedPaths();
@var $items = arrayCount($arr1);
@var $CurrentNameFullPath;
@var $OrgName;
@var $NewName;
@var $n1;


for( $n1 = 0; $n1 < $items; $n1++ )
{
 
@var $arr = GetSourceSelectedPaths();
@var $NameA = PathGetNamePart( $arr[$n1] );
@var $newText = TitleCase($NameA);



  $CurrentNameFullPath = $arr1[ $n1 ];
  $OrgName = PathGetNamePart( $CurrentNameFullPath );
  $NewName = StrReplace( $OrgName, $NameA, $newText );
 
RenameFile( $CurrentNameFullPath, $NewName, "RENAME_RO" );
}

I obviously haven't made it as clean as it might be, but it is a start. 
Think I have abused the { } .  ::)

I am now wondering about capitalizing the first word where the first word is in the exceptions list e.g.
For MultiScript coding disasters this is the place
becomes
for Multiscript Coding Disasters This is the Place

I may need to plagiarize some of that function you created...  ;)

UPDATE
Added this
Code: [Select]
@var $char1 = StrSub($NewName, 0, 1);
@var $char2 = StrToUpper( $char1 );
@var $NameB = StrReplace( $NewName, $char1, $char2 );
 
RenameFile( $CurrentNameFullPath, $NameB, "RENAME_RO" );

so now the emergency is over, I can go to sleep :D :P



........I also wondered about the recursive bug $n/$oldN is that something that only manifests in this type of function?

129
Script / Re: Title Case
« on: July 07, 2018, 17:51:57 »
OK I'm incorrectly thinking that because
Code: [Select]
for( $n = 0; $n < $items; $n++ )works for multiple files - it will call the same thing ($arr) in 2 different ways --- which it won't  :o

I need to differentiate...  Thank you Mathias, I will try again & stop destroying your weekend now !   :D

130
Script / Re: Title Case
« on: July 07, 2018, 16:08:20 »
Thanks for the advice & info Mathias.
This is how I employed your function & it works well. I can see that it will be straightforward to expand on this for a number of other operations so I might actually learn how to use MS properly one day  :P ;)  It has (again) impressed on me that it is quite different from my school experience of Basic, this system feels like it contains a lot of macros in comparison.

Code: [Select]
@var $exceptionsArray[] = { "a", "an", "and", "any", "at", "for", "from", "into", "of", "on", "or", "the", "to", };

function TitleCase($name)
{
   return  _TitleCase($name, " ");
}

function _TitleCase($name , $splitchar)
{

  @var $result = "";
  @var $parts = StrSplit($name , $splitchar); // space and - will split string
 
  @var $cnt = arrayCount( $parts );
  for( $n = 0; $n < $cnt ; $n++ )
  {
    @var $textPart = $parts[ $n ];
    // To Lower
    $textPart = StrToLower( $textPart );
 
    if( StrFind( $textPart , "-", 0 ) > 0)
    {
      // Becuse of recursive bug, $n is is overwriten
      $oldN = $n;
      $textPart = _TitleCase($textPart , "-");
      $n = $oldN;
    }

    if( arrayFind( $exceptionsArray, $textPart ) == -1)
    {
    // Uppser case on first
    $textPart[0] = StrToUpper( $textPart[0] );
    }

    if( StrLen( $result ) > 0 )
$result += $splitchar;

    $result += $textPart;
  }
  return $result;
}

 
@var $arr = GetSourceSelectedPaths();
@var $items = arrayCount($arr);
@var $NameA = PathGetNamePart( $arr );
@var $newText = TitleCase($NameA);
@var $i = 0;


for( $i = 0; $i < $items; $i++ )


{
RenameFile( $arr, $newText, "RENAME_RO" );
}


EDIT
If I select multiple files it only runs on the first file... is this the recurse bug or is my recurse instruction bad... thought I had that one OK  :-\ ???

131
Script / Re: Title Case
« on: July 06, 2018, 18:31:42 »
Thanks very much Mathias.  ;D  8)
I didn't realize I could use this array form in MS -
Code: [Select]
@var $exceptionsArray[] = { "a", "an", "and", "any", "at", "from", "into", "of", "on", "or", "the", "to", };
The function you have provided is very helpful in making me see the break-down of events & how MS can be used to run different tasks.  I will have to study/learn your style. 

Also I think I may have under-estimated MS & that that combined with my inexperience with ('modern') programming, causes trouble.
I have been looking at Java & C++ so I recognize these structures of code - just not well enough...! 
Better go & read those books I bought I guess ;)

OT Is it possible to create a StrRegExpReplace function for MS?  Or better to combine functions that are already there? 
I liked the idea of using StrRegExpFind to enumerate $<instance> & StrRegExpReplace to step through & replace each $<instance>.  Maybe that couldn't work in practice tho?

132
Script / Re: Title Case
« on: July 06, 2018, 13:34:17 »
Thanks for the replies.  :)

I am using StrToUpper and StrSub .  The trouble probably is my finding the right approach.

This was a way I'd looked at word capitalization, but a regex gives me all the instances quicker.
Code: [Select]
...
@var $arrN = StrSplit( $NameA, " ");
@var $Words = $arrN[1];
@var $Char1 = StrSub($Words, 0, 1);
@var $arrN1 = StrToUpper($Char1);
...

Via regex I can have the number of instances output, hence my search for a regex replace function.
Using StrRegExpFind & a simple \s[a-z] gives me all the lower case words, I should in theory be able to take each instance ($1 $2 etc) & handle it with the StrToUpper - but that doesn't seem to be possible (tho it may be just me not getting the <str> &/or <arr> code right!) so I wondered if there might be a StrRegExpReplace function... 
Can I pass the instances found by StrRegExpFind to the StrToUpper  function?  :-\ 

The exception list should be straight forward enough - I can just run them one by one, would be nice if I could pass the exception array as in the C# above tho!   The C# seems to require a lot less steps to achieve the result.

My plan was
  • acquire the selected file name(s)
  • select the words ignoring 1st word
  • all words to lower case
  • capitalize all words
  • find words in the exception list & make them lower case
  • write the new title case string to the filename.

I don't know if I'm misunderstanding you Mathias ref  - ToTitleCase - could just be how the author has labelled the process the code invokes & displays on the GUI as opposed to a specific C# function....?

The idea was to take a title eg
ANT-MAN AND THE WASP  | ant-man and the wasp | Ant-Man And The Wasp
& convert it to Title Case = Ant-Man and the Wasp
(Altho I think in this case it may need to be Ant-Man and The Wasp...  ::) :P)

This process obviously applies to many titles where simply using Camel-Case doesn't look pretty/over-emphasizes secondary prepositions etc.
I liked the idea so thought it might be fun (!) to try to recall how to script with MS   ::)  ;D


133
Script / Title Case
« on: July 05, 2018, 20:24:16 »
I saw this the other day
Code: [Select]
using System;
using System.Collections.Generic;

public static class ClipboardFusionHelper
{
    public static string ProcessText(string text)
    {
        //Words that will not be capitalized; add words to this list as required
        string[] exceptionsArray = { "a", "an", "and", "any", "at", "from", "into", "of", "on", "or", "the", "to", };
     
        List<string> exceptions = new List<string>(exceptionsArray);
     
        //Break the input text into a list of capitalized (not upper case) words
        text = System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(text.ToLower());
        List<string> words = new List<string>(text.Split(new char[] { ' ' }));

        //Always leave the first word capitalized, regardless of what it is
        text = words[0];
        words.RemoveAt(0);
       
        //Check each remaining word against the list, and append it to the new text
        foreach (string s in words)
        {
            if (exceptions.Contains(s.ToLower()))
               text += " " + s.ToLower();   
            else
               text += " " + s;
        }

        return text;
    }
}

I thought I'd like to translate it to MS & add it to a button.

I can grab & split a filename, I can see how I could use the str selection to alter the words I want in lower case to lower case ... but I'm wondering if I need something like a regex version of
Code: [Select]
<str> StrReplace(<str> input, <str> find, <str> with );
Maybe I just haven't figured out the ordering of commands to modify the arrays yet but I'd really like something that would give me a [a-z] -> [A-Z] function :P

Any advice Mathias?

134
daveme7  If you are referring to the options dialogs, you can use a 'user command' to remove that (config > user defined commands) as Mathias says.
I use -
MC.Explorer.Move NODIALOG USEEXISTINGQUEUE
which I have added to the buttons at the bottom.
This will move all selected items between panes without dialogs or confirmations.  The NODIALOG switch works on other things such as delete as well.

135
Feature Requests and Suggestions / Re: Batch renaming function
« on: June 18, 2018, 13:16:14 »
Looks cool.. I just wish I had there time and budget too :)
But some of it might be possible.

When I win the Lottery I'll get back to you Mathias   ;D

136
Tips and Tricks / Re: CMD console mod (Freeware)
« on: June 17, 2018, 16:10:51 »
ConEmu looks interesting, does more than I need at the moment but am going to play around with it a bit :)

Yes MC is superior to Q-Dir, the latter is only regular explorer made more usable & so won't be taking the MC crown I think :D

I've decided I like the AutoHideDesktopIcons & GetWindowText tools from the softwareOK.

137
Feature Requests and Suggestions / Batch renaming function
« on: June 16, 2018, 11:58:02 »
Until MC, Directory Opus was my favorite file manager in terms of style & features.
I saw their 'Whats new' vid the other day & the way DO now handles batch renaming seems like a nice feature. 
https://youtu.be/ircl1OVEdaM?t=81
This is a 'bells & whistles' feature perhaps, & MC allows a lot of options with MR but I wondered how difficult it would be to add something similar in MR.... :-\ :)


138
Tips and Tricks / CMD console mod (Freeware)
« on: June 16, 2018, 11:34:54 »
I found a good cmd.exe console mod here - http://www.softwareok.com/?seite=Freeware/ColorConsole
It has color profiles, tabs, handy tree navigation, can save favorite commands etc & the exe can be dropped on MCs top bar.


The home page has a number of interesting small freeware progs - http://www.softwareok.de/?  including a 4 pane WinExplorer mod http://www.softwareok.com/?seite=Freeware/Q-Dir

139
Support and Feedback / Re: External Refresh issue
« on: May 28, 2018, 10:51:35 »
I posted this in another thread but may be relevant here...
Quote
I have been finding erratic & slow USB recognition/processing for a while with W10, after a lot of messing about it looks like it is related to w10 recent builds & USB drivers.  I have had things working perfectly, w10 update screws it, new drivers come out - fixes it; then w10 breaks it again....

Using different external hubs dramatically changes performance for me when connecting v 1.1 or v2.x to v3 ports.
v3 is supposed to be compatible with v2 but it hasn't been 100% for me this year, last year it was ok & everything was recognised correctly. 
Sometimes now I need to daisy-chain devices with a hub to get recognition/performance.

140
Support and Feedback / Re: Extremely sloooow refresh
« on: May 28, 2018, 10:50:28 »
Quote
Using different external hubs dramatically changes performance for me when connecting v 1.1 or v2.x to v3 ports.

We are not speaking here about USB sluggish performance. The thread was started about local SSD drive refresh issue.

Really? How about stating LOCAL SSD in the POST or TITLE THEN?  Hi-liting .iso doesn't tell anyone where the .iso is.

I can say I have 0 indexing speed problems with the multiple SSD & SSHD drives on this machine when using MC.

141
Support and Feedback / Re: Extremely sloooow refresh
« on: May 27, 2018, 17:45:47 »
I have been finding erratic & slow USB recognition/processing for a while with W10, after a lot of messing about it looks like it is related to w10 recent builds & USB drivers.  I have had things working perfectly, w10 update screws it, new drivers come out - fixes it; then w10 breaks it again....

Using different external hubs dramatically changes performance for me when connecting v 1.1 or v2.x to v3 ports.
v3 is supposed to be compatible with v2 but it hasn't been 100% for me this year, last year it was ok & everything was recognised correctly. 
Sometimes now I need to daisy-chain devices with a hub to get recognition/performance. ::)

142
Support and Feedback / Re: Jump to Root
« on: March 12, 2018, 14:40:25 »
Thanks Mathias, I guessed it was probably Win10 & not MC.

I am the only user, my a/c is the passworded <name>/admin a/c.  I have not allowed any other guest etc a/c's. 
Booting without password doesn't give me/anyone full access. 
'Users' group has zero permissions.

So I have full permissions, but programs installed & run by me in this single environment might not....  ::) Not logical or helpful. 

In the example of Handbrake & MC (both running in an admin environment but not admin mode) I can load a file using the 'open source' (browse) dialog, but not drag n drop.  Only possible when MC is in Admin mode.  ??? :o

I think M$ needs to streamline this muddled, contradictory & illogical behavior.  >:(
Full admin control is potentially dangerous but as sole user that should be my call.

Anyway I will keep poking about & see if there is some buried switch that I can use to improve this situation.

143
Support and Feedback / Re: Jump to Root
« on: March 11, 2018, 14:59:31 »
The 'back' movement process is behaving now, but I have discovered something about my context menu omissions.
In Win10 Pro x64 if MC is run as Admin a lot of context menu items (3rd party shell exts) disappear, when MC is not run with admin permission they appear as they do when I run win explorer.   ??? :-\

I am logged into Win as admin but Win10 still messes about with permissions so I generally need to run MC as admin.
Eg I cannot drag & drop a file into Handbrake from MC if not in Admin mode.
Any ideas how I can get these things to work at the same time Mathias? (ie all context menu items & full permissions for MC.)

144
Support and Feedback / Re: Jump to Root
« on: March 05, 2018, 14:26:15 »
Hi Mathias.
I was referring to 'back' mouse button & when double clicking on the <-... at the folder head.
But today it is magically working.  ::)  All last week it was jumping all the way up the tree.

I used ShellExView to inspect my context menu items.  It shows the ones I have issues with in red-hi-lites but not as disabled.  It will not enable them.   ???
Puzzling... :( 

145
Support and Feedback / Jump to Root
« on: March 04, 2018, 12:44:21 »
I was forced to update W10x64 to 1709 & since then I have had a couple of glitches in MC 7.7 b2404 -

  - the focus jumps to root of folder when 'back' is used 
(ref:- http://forum.multicommander.com/forum/index.php/topic,1864.msg7164.html#msg7164);
 
  - missing icons for 3rd party progs on right click menu (they are present in Explorer).

Any ideas?

146
Support and Feedback / Re: Regex in MDV?
« on: February 18, 2018, 18:54:03 »
Thanks for the confirmation Mathias ;)

147
Support and Feedback / Re: Regex in MDV?
« on: February 15, 2018, 19:08:25 »
Hi AlanJB
it's Multi Document Viewer. 
F1 on a file (eg txt ini bat)  ;)

148
Support and Feedback / Regex in MDV?
« on: February 15, 2018, 13:27:02 »
I expect this is something I have not noticed before, normally when I use MDV with the search dialog it hi-lites the search terms so I can step thru them.
Using a Regex is a bit different  :P

149
Support and Feedback / Re: Nvidia driver causing MC lockup Win10
« on: February 12, 2018, 15:18:57 »
I just received some new mobo drivers from ASUS.
They seem to have resolved the USB issue.  I am having to go through the nvda drivers one by one to see if the latest builds still cause problems.
This may have saved you!  :) :P

150
Beta Releases / Re: New Already Exists Dialog
« on: February 03, 2018, 16:44:55 »
Hmmmm   maybe it's the 'short ops' switch that's the reason...?
What defines short vs long?

You are right about the dialogs of course Mathias, I just had a lot of copy/move ops that made all these things occur in the same 5 minutes :D

Pages: 1 2 3 4 5 [6] 7 8 9 10 ... 22