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 ... 16 17 18 19 [20] 21 22
476
Beta Releases / Possible bug
« on: August 08, 2013, 16:15:12 »
FYI - Possible bug.

I have noticed a 'strange' event a couple of times with the in-line rename function.
When doing an in-line rename if I use <e> or <l> in the new name, the field will jump to edit a segment as if <ctrl> had also been pressed.
I discovered pressing <ctrl> a few times would unstick the selection focus so I can enter the new name.

477
Script / Re: Search routine
« on: August 08, 2013, 16:12:25 »
I have finally grasped which function/call & which token arrangement was needed to get my initial script to apply itself!

Code: [Select]
@var $arr = GetSourceSelectedPaths();
@var $items = arrayCount($arr);
@var $CurrentNameFullPath;
@var $OrgName;
@var $NewName;
@var $n = 0;

for( $n = 0; $n < $items; $n++ )
{
  $CurrentNameFullPath = $arr[ $n ];
  $OrgName = PathGetNamePart( $CurrentNameFullPath );
  $NewName = StrReplace( $OrgName, "." , "" );
 
  RenameFile( $arr, $NewName, "SILENT" );
  }

Now all I have to do is build my regex! :P
I am beginning to see how the different instructions need to be addressed.   

I wonder if there is already a good way to hi-lite the text for ease of editing (I've found with notepad++ I can save as a codepage & get coloured results, eg:- as .pl or .php), which helps me at the moment.

Thanks for your time & tuition Mathias.   :)

*
For regex you mention StrRegExpFind is there also StrRegExpReplace? (If so I haven't seen it in the docs) I am currently assuming that the the find command will then invoke the regex to do any necessary editing.

478
Script / Re: Search routine
« on: August 07, 2013, 15:01:44 »
I'm OK for regex's (not expert but OK) I like sites like this
http://regexlib.com/
for some ideas.
Regex is just something for me to attempt as I know I could use MC scripts with regex. 

I have been browsing your online docs.  Cannot see anything which says outright what a perfect base script looks like.  Trying to step through the script Jungle made, I can (more or less) see why it does what it does but cannot extrapolate that yet as it has a lot of operations & variables for my untrained eye.

I'm wondering about vars & 'scope' (sorry, I wasn't using correct terminology)
As you can see from the screen shot in the post above, the debugger didn't red-flag anything but it didn't rename the selected folder either. 
It shows the result but doesn't execute the change.  ???
I therefore wondered if the script requires all predefined vars to be included in {} operations before it will execute.
Apart from that I cannot see why it didn't execute...  No obvious elements like RUN or END etc jump out at me

Slightly OT

I noticed the 'regex' box in the mass rename dialog is greyed out.  That would be useful for me to have in the future. 
(It wouldn't teach me the MCS however.) :P

The addition of TIME="TODAY" etc functions in my custom search works well btw
The updated in-line rename works well, hadn't noticed the <ctrl> + <e> or <ctrl> + <l> before.  Useful  ;)

Thanks Mathias.

479
Script / Re: Search routine
« on: August 07, 2013, 09:36:59 »
...Told you I did not run it...

Yes just kidding around...  :)  I appreciate the help.


Is it necessary to include all variables in the { instruction} groups?
I wonder why it shows a change in the debugger but doesn't pass the change to the active selection.  Is it waiting for other vars to be handled?

Currently I think I will attempt to run 3 lines to emulate the regex.
1 strip "." & leave space
2 place "." following number.
3 remove space following 'v'


If \d is digit is \a letter?  Wondering about ?\a in this situation.

Better start reading a book on PHP if the forms are similar I guess.

480
Script / Re: Search routine
« on: August 06, 2013, 19:51:18 »
Thanks for the pointers Mathias.
I will try again.  The regex I posted above works in its' native environment, but I don't mind creating something different for MCS.  Just a question of seeing what I'm doing wrong...in theory.


I note you didn't test the code but I find it interesting you got the same errors as I did: 23 & 1    ;)
I don't feel so bad I failed completely now ;D

Did you say you were going to add permanent line numbers to the debugger?  (That display when debugger is stopped)

Quote
Multi-Script debugger started.
Debugging started.
Debugger attched.  <<Typo you may wish to fix some time>>
Script engine error => Variable $CurrentNameFullPath not found
Script engine error => Failed to process token - "$NewName"
Script engine error - Line : 10, Error : -23 => Parameter wrong type, Code : "$NewName = StrReplace( $NewName, "." , "" )"
Script engine error - Line : 10, Error : -1 => Code : "$NewName = StrReplace( $NewName, "." , "" )"

Debugger detached.

I swapped $OrgName with $CurrentNameFullPath

Code: [Select]
@var $arr = GetSourceSelectedFileNames();
@var $items = arrayCount($arr);
@var $CurrentNameFullPath;
@var $NewName;
@var $n = 0;

for( $n = 0; $n < $items; $n++ )
{
  $CurrentNameFullPath= $arr[ $n ];
  $NewName = PathGetNamePart( $CurrentNameFullPath);
  $NewName = StrReplace( $NewName, "." , "" )
 
  RenameFile( $CurrentNameFullPath, $NewName, "SILENT" );
}
 
It steps thru & shows the name would change without errors.  the script isn't executed (Normal for debugger or should it execute on the selected elements?)  So I'm not there yet.

[I don't want to eat up too much of your time reviewing this however!]

481
Script / Re: Search routine
« on: August 06, 2013, 18:15:37 »
For purposes of learning to write a script I have a folder called  -
abc v.1.2

I want
abc v1.2

The idea being that I keep a "." following a numeral, stripping any others.  A simple regex transposition I thought....
Code: [Select]
((?:[a-zA-Z]+)+)\.
-to-
\1<space>


I have made a couple of assumptions:-
  • I need to get the selected folder name;
  • I assign it a variable;
  • I then pass that variable to my command string.
  Guessing this is something like
Code: [Select]
$s = StrRegExpFind( $s, "v." , "v", ".?\d");
As I don't know PHP & I don't have examples of regex type formulae for MCS (I tried transposing elements of Jungles script but it's too advanced for me at this point) I have been messing for several hours unsuccessfully with various combinations & assignments & getting nowhere.


I began trying a simple rename -  1.2.3.4 to 1234 & failed. :'( :-[

I managed to grab the name-
Code: [Select]
@var $arr = GetSourceSelectedFileNames();It comes up as an array correctly, then I assumed I would hand the $arr to the rename function (even tho it's technically a string)
Code: [Select]
RenameFile( $arr = StrReplace( $arr, "." , "" ) );
The debugger runs but doesn't red-flag anything (BTW is there a list of error codes somewhere?)
& of course nothing happens.....
 :-[ ???

So I think I need a walkthru or something that helps me define what I need to do in terms of framework & assignments. 
I assume Jungle wasn't born fluent in MCS,  :P so how do I get started with this?  TiA

 

482
At first glance it looks to be exactly what I need.
I need to spend some time playing around of course.  ;D

Thanks Mathias

483
Tips and Tricks / 1-click DVD Copy
« on: August 04, 2013, 18:34:57 »
Thought I'd share this idea for a button.  Occasionally I want to copy a disc - this provides a free 1-click, single button solution.
Using ImgBurn (Freeware) http://www.imgburn.com/, its' CLi & the following script to make a batch file:-

Code: [Select]
@echo off
"C:\Program Files\ImgBurn\ImgBurn" /mode isoread /src e: /dest "%temp%\disccopy.iso" /overwrite yes /eject yes /close /start /waitformedia
"C:\Program Files\ImgBurn\ImgBurn" /mode isowrite /dest e: /src "%temp%\disccopy.iso" /eject yes /closesuccess /start /waitformedia /verify yes /deleteimage yes /log "C:\Users\<<<<User>>>>\Documents\Copy_[DATETIME].log"

  • Save above code as IMcopy.bat (or some other .bat).
  [N.B. Edit the path for the imgburn install as req'd - e.g. C:\Program Files (x86)\ for x64 OS; edit the source (/src) & destination (/dest) drive letters for the RW drive(s) being used - code above assigns to drive e:.]
  • Drag/drop the .bat to the user button area of the MC taskbar
  • If req'd - Right-click on the new .bat icon - customize; Assign an icon
(I attach the free dvd_add.png converted to .ico from fatcow www.fatcow.com/free-icons that I felt was suitable.)

After job completion a date & time named .log is generated, adjust name & destination as req'd, I set the "My Documents" folder path this req's the user name to be entered between the <....>'s.  Or alter as req'd.


This will open Imgburn & cycle the tray as needed, create a temp image, verify the burnt disc & delete the temp image on completion.   Log is written & Imgburn will close.

FYI - To further modify this script - All the CLI commands are in the imgburn readme & any .bat script will always override the GUI.

484
Code: [Select]
-*.*  will select no ext files (as "-" is exclude xxx)

Not entirely clear on your suggestions but my approach to date time mods would be to use a search & then from the find dialog start making changes.

What I am currently working on is scripting something for my particular rename/re-sort needs.  I suggest you try that also.

485
Script / Re: Search routine
« on: July 31, 2013, 23:26:34 »
Thanks Jungle & Mathias, that helps.
I see I will have to pre-define my targets etc now.

It is going to take a while for me to grasp this & how the debugger interfaces, but I am now seeing how it will interact with the selected items & the custom commands list.  I hadn't understood the connection properly before. 

I will persevere & see how it goes.

486
Support and Feedback / Re: Adding buttons to multibuttons.xml
« on: July 31, 2013, 23:21:17 »
Thanks guys,  I hadn't realized that the core settings thing had been implemented since I asked about the xml some time ago.

I did try the C:\users\.... xml but it didn't work.  (I could see that that xml was recently edited as it had my existing custom buttons resident.)
I can only assume that my xml was over-ridden by the core settings - once I allowed 5 rows there, the buttons I defined all appeared.

Slowly getting there!  :)

487
Support and Feedback / Adding buttons to multibuttons.xml
« on: July 31, 2013, 19:23:42 »
I wanted to define some new buttons for my scripting trials.

I altered th 1st line -
Code: [Select]
<buttonpanel id="1" rows="5" cols="8">
I added the blue code, leaving some original code from 4/8 in place as a place holder


 <button row="4" col="8" modifier="none" acceptfiledrop="0" label="#{b,50}" cmdtype="1">
    <desc>#{b,50}</desc>
    <command options="0">Core.1070</command>
  </button>
   <button row="5" col="1" modifier="none" acceptfiledrop="0" label="#{b,50}" cmdtype="1">
    <desc>#{b,50}</desc>
    <command options="0">Core.1070</command>
  </button>
 <button row="5" col="2" modifier="none" acceptfiledrop="0" label="#{b,50}" cmdtype="1">
    <desc>#{b,50}</desc>
    <command options="0">Core.1070</command>
  </button>
 <button row="5" col="3" modifier="none" acceptfiledrop="0" label="#{b,50}" cmdtype="1">
    <desc>#{b,50}</desc>
    <command options="0">Core.1070</command>
  </button>
 <button row="5" col="4" modifier="none" acceptfiledrop="0" label="#{b,50}" cmdtype="1">
    <desc>#{b,50}</desc>
    <command options="0">Core.1070</command>
  </button>
 <button row="5" col="5" modifier="none" acceptfiledrop="0" label="#{b,50}" cmdtype="1">
    <desc>#{b,50}</desc>
    <command options="0">Core.1070</command>
  </button>
 <button row="5" col="6" modifier="none" acceptfiledrop="0" label="#{b,50}" cmdtype="1">
    <desc>#{b,50}</desc>
    <command options="0">Core.1070</command>
  </button>
 <button row="5" col="7" modifier="none" acceptfiledrop="0" label="#{b,50}" cmdtype="1">
    <desc>#{b,50}</desc>
    <command options="0">Core.1070</command>
  </button>
 <button row="5" col="8" modifier="none" acceptfiledrop="0" label="#{b,50}" cmdtype="1">
    <desc>#{b,50}</desc>
    <command options="0">Core.1070</command>
  </button> 

</buttonpanel>

Can't get it to work tho, I still have my original 4 rows - I did restart MC, maybe my install is flaky, or I'm going mad....  :P



488
Script / Re: Search routine
« on: July 31, 2013, 18:53:19 »
Thanks Mathias
The screen of my tool bar is posted - it shows the 'user commands' menu element is absent on my UI.  Can you not see it?

How do I make the debugger run a script on a file/folder to test the script? 
I need a window that allows me to run a script 'live' if you see what I mean. 

If I understand correctly I must -
  • create a button,
  • test it,
  • then, if wrong, edit it.
 

That is a lot of clicking around the dialogs so I would like a sandbox. (If it doesn't already exist in some form).

If I understand your advice, my script should be

$s = StrReplace( $s, " " , "." ?\d);

But it doesn't seem to work..  :-[



489
Script / Re: Search routine
« on: July 31, 2013, 13:05:59 »
Thanks for responding Mathias.

I was thinking my regex would be replaced by the modified string by Jungle.  But I don't think it targets spaces.
ie
1 2 3 4
to
1.2.3.4

I wanted to test it & edit (as with a sandbox), before creating a button (that didn't work several times!) - short on time... 
Just wanted to select a file/folder, run the script & if good then assign it a button.  Maybe the debugger does this & I haven't figured out how?

I thought there was something like a script test window, (maybe I recall something like that from XYplorer which I tried years ago?)
But I have just looked at my toolbar - the User Commands item shown on MC homepage is not visible!  ???  See attached
So maybe I am missing it!!  :)

490
Script / Re: Search routine
« on: July 30, 2013, 19:20:25 »
Continuing my rename & SAR experiments, I'm wondering about regex to MC script transposition.
e.g.
Number & space to number & '.'
((?:[0-9]+)+)\
\1.

I'm stealing Jungles earlier code & using a . :-
$n = StrRegExpFind( $s, ".?\d+$" );

& I've just realized I appear to need to define a button to run this or is there a field I'm missing/misusing that allows me to run a script on a selected file/folder.  Is there a script input window & if not, can I have one to play with in a future build?  :D

491
Script / Re: Search routine
« on: July 29, 2013, 17:20:27 »
Thanks for the info, I will need to try this out!   ;)

492
Script / Re: Search routine
« on: July 26, 2013, 23:22:34 »
Guess I'm not really surprised I decided to try the impossible, & so it's back to the drawing board for script ideas.... ;D

Good to know about the F1 - F10 feature I hadn't realized that was in there.  That will be useful. Thanks.

How many other features are there I don't know about, I wonder?  :P

493
Script / Search routine
« on: July 26, 2013, 19:11:46 »
Decided to attempt a script  -
I decided to try to script a button to search for todays jpgs

Code: [Select]
MC.FileSearch.Search SEARCHIN="${sourcepath}" SEARCHFOR="*.jpg"
This will get all jpgs in the active pane.  Date & tree-depth aren't pre-loaded.
What I wish to add is the search dialog parameters
a) for today from 00:00:00.
b) to search x subfolder levels.

If it is possible to send values to the search dialog I assume I will need something like
Code: [Select]
@var $t = GetTime();Then I need to import that & ignore hours/minutes values.
can I EXCLUDE= non $t values or StrIsEqual the 't' to select date matches?

Then I'd want to poke that into the search dialog settings....

That's as far as I have got & it shows how little I have of the language logic at the moment.

But if there was a saved/favorite search function I guess I wouldn't need this :)


494
Feature Requests and Suggestions / Re: Name as Folder?
« on: July 26, 2013, 18:11:15 »
@Mathias -
I will keep playing about.  Hopefully I will figure it out  ;)

@Jungle
That has worked perfectly.
I think I will use your example to try & learn this scripting a little.  :)


Maybe this thread should go to the Scripts section now?

495
OK thanks Mathias.
I guess it's maybe because the imgburn window doesn't like things dropped in the far left pane - so it blocks the drag.

I thought the script was unique & not a derivative, I will try to persevere with the docs, I'm just not 'feeling it' yet... :P

496
Thanks for the clarification Mathias.

5 sounds like it will be useful.  I am now starting to wonder how virtual folders vs tagging compares. 
More I use MC, the more I like your approach to many problems.  Your filtering system (bottom-right of file pane) is a life-saver that I haven't seen so effectively deployed elsewhere.
I suspect MC could be a lifetimes' work however! ;)


Don't want to hijack the thread with requests but I'd considered the following a while back & never got chance to request it -
MC focus grabbing - when I drag & drop e.g. from MC to imgburn, MC will take an always on top position.  Normally I have imgburn open & it will be overlapping on my tiny 23" monitor, so it can disappear backwards when I return to MC to drag files.
Is it possible to have click-hold-drag set to allow access but keep MC in it's current position, (without MC jumping forward)?

My other request had been adjusting the default state for the find dialog - I recall you were going to look into that.

As regards the tutorials I agree that the best way to learn is to try & do something with it.  Unfortunately I still find the available parameters too opaque to be able to imagine uses for the scripting. 
Jungle has proved it has great capabilities - so I need to dig deeper.

I think it's traditional to have a 'Hello World' but something like a rename instruction would be a useful basic introductions to syntax.
I didn't entirely follow jungles script in the 'name as folder' thread & couldn't find anything that guided me through it.  (I tried the debugger but that only shows some of the loops/links).  So something that explained what was happening where would help.  I can then extrapolate that logic I hope.
Is MC script a unique language or is there something I could look at which would give me a head start?  Maybe this sounds dumb, but I keep thinking of Perl (which I don't know at all) when I look at the scripts.  ::)

497
Feature Requests and Suggestions / Re: Name as Folder?
« on: July 26, 2013, 09:42:38 »
Thanks for the explanation Jungle.
I'd looked at that line but don't understand enough MCS syntax to recognize the correct elements yet. :-[

I will run a few tests later - I am pretty sure that for me, the inclusions/adjustments you have made will be faster for my normal routine than the rename tools, so again thanks a lot.  :)

498
I have a few thoughts on the requests lists:-

4 - would be something I'd also like to see.
5 - Is this like a 'virtual folders' kind of thing?
12 - I can see good reasons for the , vs ; debate, but would this impact the other uses of ; in MC?  (e.g. Multiple search locations)


As I usually only want features that require a lot of work  :P I am reticent about asking for/expecting them but -

  • I would like to be able to do multiple in-line renames without hitting <enter> between files.
    i.e. When I have one name in edit mode I can use the arrow keys to move the live edit field to another file.   The file left behind would auto save it's new name state.  Currently the arrow keys don't allow movement & focus shift.
  • I still would like the dialog mods I suggested elsewhere.  http://forum.multicommander.com/forum/index.php/topic,930.msg2834.html#msg2834
  • Generally I think I would benefit most from some scripting tutorials.


I don't want much do I?  ;D

499
Feature Requests and Suggestions / Re: Name as Folder?
« on: July 25, 2013, 18:43:50 »
Thanks Jungle  :) 
I tried it & used a date named folder & some "img_###.jpg" files.
I found I got
img_0040.jpg
to become
17-04-20130040.jpg

Which is 'almost' what I would like.  I saw you were able to use "_" as a separator in your 1st script.

Obviously I do not know how to write MC script (!!!) but I thought adding it as you have in #66 :
Code: [Select]
$s = StrReplace( $name, $mask, "_" + numtostr( $c ) );should work.
Looking through it I guessed entering the _ with the $prefix or the $name might deploy the _ correctly.
e.g "_" $prefix,
but it didn't work.


Having looked at the currently posted docs I am unclear what I might do to alter my output string with added fixed characters.  (In this case _). 
I can see that being able to script patterns of characters added to folder names could be really useful for things like image files. 
The scripting of buttons offers me a lot of possibilities & is an interesting tool. But logically, I probably should use the batch rename instead. 

I would appreciate any advice if you have the opportunity.  I'm not seeing what I personally need in the current script documentation.  I'd like a few walk-thrus.  (Maybe that needs to go on the request list for the next release?)








500
Feature Requests and Suggestions / Re: Name as Folder?
« on: July 24, 2013, 23:30:06 »
Thanks Jungle for a nice script! :)
I see  it contains more functions than just getting & implanting the dir name. 
I like the numbering/counter for multiple files of the same type - especially as the numbering allows for pre-existing files of the same name.

The following is worth noting as it could cause issues:-
It isn't exclusive of folders, if I 'accidentally' click a sub-folder it will rename as parent dir also.
When I renamed a bunch of jpgs, it dropped the already present numbers & used it's own counter. 

I mention it as something a scripting wizard might consider, an advisory to anyone else trying this & as something I should try & figure out... 

For pre-existing numerals - how easy is it to exclude already present numbers?  (e.g. as with a regex)
Maybe I'd need a 2nd script...
Not saying you should write me one, just wondering as I want to play around with this but need some pointers.  ::) :P
-I must find time to learn this multi-scripting & this is an incentive!!

You have given me a good start to look more closely at the MC scripts & a great new functionality for my MC.   ;D

Pages: 1 ... 16 17 18 19 [20] 21 22