First public beta of version 3.5

Advanced Renamer forum
#1 : 07/06-12 20:28
Kim Jensen
Kim Jensen
Administrator
Posts: 775
I have uploaded the first public beta of version 3.5 today. If you have the time, please download it and try it out. I have changed a lot of the underlying module dependencies which means that there still might be several undiscovered bugs. If you find any bugs please write to me directly by email or here in the forum.

NOTE! This version is not backwards compatible so please run it from a different folder than any previous version. Also notice that I have only supplied a portable version of this beta release.

Changes from the version log:
+ Unicode support
+ Support for JPEG 2000
+ Support for reading EXIF and image dimensions from stereo MPO and JPS images
* Reintroduced up/down buttons for numeric edit boxes
* Fixed file size decimal point bug
* Created Date and Modified Date based tags is now using modified value if used with Timestamp method
* Support for using more than one Timestamp method
* Changed compiler and various libraries

The biggest and most ubiquitous chance is the Unicode support which is the major reason for this version. This is a capability requested by many users, especially by people in countries with different alphabets than the US standard alphabet.
Also the up/down buttons have been reintroduced on numeric edit boxes in the method panels. This might seem like a small feature, but it is probably the most requested feature ever! They were removed to allow the edit boxes to contain search patterns as an alternative to numeric values. Now I have found a way to support both textual search patterns and up/down buttons for numeric values.

Enjoy the beta! And please tell me if anything breaks. It is best to find all the major bugs in the beta stage.


07/06-12 20:28
#2 : 02/08-12 21:07
Stefan
Stefan
Posts: 264
Zitat:
"Advanced Renamer 3.5 Beta 2 - 08. july 2012
+ New method: Script. Can perform advanced actions based on custom JavaScript code."

Great improvements, thank you.

The dialog need [Save] and [Load] buttons, to save /load scripts
to /from an file, but i guess that is already planed.

Second;
if i clear the Script rule, i can't restore it.
I think AR should save the script to memory
and provide on next 'Add Script' action.

Third;
alert(); didn't work for me. It breaks the script and nothing is executed.


Here are my first test scripts for an start for others:

[code]
//First three signs to upper case:
Part1 = item.name.substr(0,3);
Part1 = Part1.toUpperCase();

//Remaining file name:
Part2 = item.name.substr(3);

//Extension:
Part3 = ".bak" + item.ext;

//Compose the new file name:
item.newName = Part1+Part2+Part3;
return item.newName;
[/code]

============

[code]
PATH = item.filename;

FifthSign = PATH[4];

PATHarray = PATH.split("\\");
UBound = PATHarray.length;

//
DRIVE = PATHarray[0].replace(":","");
TopFld = PATHarray[1];

Parent = PATHarray[UBound-2];
ParPart = Parent.substr(1,3);
ParPart = ParPart.toUpperCase();

NameExt= PATHarray[UBound-1];


//index=0,1,2,3 Counter=1,2,3,4
Counter = '' + (index +1);
//alert(Counter);
while (Counter.length <3){Counter = '0' + Counter;}


out = DRIVE + '_' + FifthSign;
out += '_' + TopFld + '_' + ParPart;
out += '_' + index+"-"+Counter;
out += '_' + NameExt;
return out;
[/code]

(very limited forum software, btw)

----------
If this tool had saved you time, perhaps you want to donate an Dollar to Kim?
See http://www.advancedrenamer.com/download >>> [Donate] button.


02/08-12 21:07 - edited 02/08-12 21:08
#3 : 03/08-12 12:50
Stefan
Stefan
Posts: 264
Reply to #1:


Suggestion:

if i have AR sized to full screen
i want to resize the code window in the height too, please.
I want to resize it down to the "Add batch method" line.



Second:
the "Show in Window" dialog
don't let me select text to copy
or to delete the selected part.

The same for the "Pre batch script..." dialog.


Third:
Open "Pre batch script..." dialog.
Context menu > Add tag
> double click e.g. on <IncNr:1>
> OK

getting:

---------------------------
Advanced Renamer
---------------------------
Access violation at address 00000000. Read of address 00000000.
---------------------------
OK
---------------------------

But still can continue work.


---

This is on W7 64-bit

.

----------
If this tool had saved you time, perhaps you want to donate an Dollar to Kim?
See http://www.advancedrenamer.com/download >>> [Donate] button.


03/08-12 12:50
#4 : 03/08-12 12:55
Stefan
Stefan
Posts: 264
Reply to #2:

I wrote:
-------------------------------
Second;
if i clear the Script rule, i can't restore it.
I think AR should save the script to memory
and provide on next 'Add Script' action.
-------------------------------


Add:

But the "Pre batch script..." dialog remembers the written code.


.

----------
If this tool had saved you time, perhaps you want to donate an Dollar to Kim?
See http://www.advancedrenamer.com/download >>> [Donate] button.


03/08-12 12:55
#5 : 05/08-12 21:24
Kim Jensen
Kim Jensen
Administrator
Posts: 775
Reply to #4:
Hi Stefan

It is really great that you have been playing around with the scripting functionality. Since this functionality is so new it might be a little buggy but I hope it will be a great addition to the existing methods and a way to extend Advanced Renamer. I have been real busy the last week so I haven't had time to consider your input. I will take a look at your descriptions and give you a proper answer in a couple of days.


05/08-12 21:24
#6 : 06/08-12 21:05
Kim Jensen
Kim Jensen
Administrator
Posts: 775
Reply to #4:
I will try to answer all your comments in this reply.

The load and save buttons have been left out on purpose. Instead you should use the regular method list load and save buttons. This way both the script and the pre batch script will get saved to the same file.

I will fix the issue where the previous script content is not saved for the next use.

Alert() is a method from web development found on the window object. The alert method, as with all web DOM methods, is not available in Advanced Renamer. Right now there is no good way of printing out debug information. This might change in the future.

I also want to be able to resize the script panel all the way down. But for now it will not resize vertically.

I will make sure the access violation gets fixed. Thank you for noticing this bug.


06/08-12 21:05
#7 : 07/08-12 09:21
Stefan
Stefan
Posts: 264
Reply to #6:

KJ> The load and save buttons have been left out on purpose.
Ahh, i see. Pretty fine!

---

Just an hint:
In your reply i miss the problem with the "Show in Window" dialog.
But i guess you have heeded it anyway.

---

Problem: Since you implemented the scripting feature
as an function to execute, instead of an whole script to execute,
i think we can not add an another own function since function
inside of functions are not allowed, afaik.

If i am right, please consider to change this behaviour
since it is often needed to use own functions.

----


Wish: if possible please disable the virtual-space option.

I mean, if i click into the script dialog, the cursor should
be just behind the last sign, instead at the position i have
clicked, even far behind the last sign. Because right now
i have to do some work always to get my cursor just behind
the last sign.

---

FYI:

i don't know why currently, but often i get this error message:

Invalid script: line 0: _itemFunc is not defined

Just mentioned.

---

----------
If this tool had saved you time, perhaps you want to donate an Dollar to Kim?
See http://www.advancedrenamer.com/download >>> [Donate] button.


07/08-12 09:21 - edited 07/08-12 09:30
#8 : 07/08-12 10:11
Kim Jensen
Kim Jensen
Administrator
Posts: 775
Reply to #7:
The "Show in Window" selection bug will get fixed before the final release.

It is possible to use functions. Consider this script, where the extension gets reversed:
var reverse = function(str)
{
var retval = '';
for (i = str.length - 1; i > -1; i--)
retval += str[ i ];
return retval;
};
return item.newName.substr(0, item.newName.lastIndexOf('.')) + '.' + reverse(item.ext);

After creating this script I realize that it is a bit difficult to get the name without the extension. I will create a item.newNameWithoutExt property. Also I realize that the scripting control doesn't allow the TAB key. That will get fixed too.

I might make various configuration options for the script editing. That way you can configure how you want to editor to behave.

The error related to _errorFunc will happen when the script is malformed. Behind the scenes the program will take your script and concatinate it with other script parts to form a full script. I have chosen to do it this way because I found it to be faster than alternative methods.


07/08-12 10:11 - edited 07/08-12 10:12
#9 : 07/08-12 20:54
Stefan
Stefan
Posts: 264
Reply to #8:

Thanks for the answers.

- - -


KJ> I will create a item.newNameWithoutExt property.

Just an veto against such an long string
(i guess it's just such long to make it clear...,
but anyway, here my suggestion before i am too late ;-) )

item.Base




 

----------
If this tool had saved you time, perhaps you want to donate an Dollar to Kim?
See http://www.advancedrenamer.com/download >>> [Donate] button.


07/08-12 20:54
#10 : 19/06-13 08:53
Stefan
Stefan
Posts: 264
Information collection:

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

http://www.advancedrenamer.com/forum_thread?for um_id=934

More about scripting with date timestamp in that thread.

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

http://ww.advancedrenamer.com/forum_thread?foru m_id=1217

var wsh = new ActiveXObject("WScript.Shell");
wsh.run("notepad.exe", 1, True);
but it seems this doesn't works from within AdvancedRenamer? Kim?

Kim Jensen Reply:
The beautiful thing about the current script implementation is that everything is handled from within the script sandbox. There are no way to jump out of this narrow sandbox. When opening up for running more complex scripts and interact with the system environment, you also open up for serious security problems. I really don't want Advanced Renamer to be a multi purpose batch processing tool. That is the subject of another program.

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #


http://aren.advancedrenamer.com/forum_thread?fo rum_id=929

FROM:
_____12pe4ort_349kkfl_qpe.txt

TO:
!!!!!12pe4ort_349kkfl_qpe.txt


-------8<--------------------8<--------------------8<-------------
SubPattern = item.name.match(/^(_+)(.+)/);
exclamatio = SubPattern[1];
exclamatio = exclamatio.replace(/_/g,'!');
return exclamatio + SubPattern[2] + item.ext;
-------8<--------------------8<--------------------8<-------------


Explanation:
"item.name" is a ARen var for each current file name processed.
"SubPattern" = Match one-or-more of leading underscores, and then the rest into an array.
"Exclamation" = Replace each matched underscore by an exclamation mark.
"return" = New filename will be exclamation marks and the original rest.
"item.ext" = the original file extension.


Kim Jensen Reply:
This script will also work:
var match = item.newName.match(/[^_]/);
return new Array(match.index+1).join("!") + item.newName.substr(match.index);

The match.index contains the first index in the string that is not _.
The newArray() part will create a string of ! in the length of the amount of _ in the beginning of the filename.
Because this script use item.newName it does not need to worry about the extension.

Relevant documentation can be found here:
http://developer.mozilla.org/en-US/docs/JavaScr ipt/Reference/Global_Objects/String/matc h
http://developer.mozilla.org/en-US/docs/JavaScr ipt/Reference/Global_Objects/String/repl ace
http://developer.mozilla.org/en-US/docs/JavaScr ipt/Guide/Regular_Expressions

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

Code snippet:

get / use what other used methods have created BEFORE as output.

-------8<--------------------8<--------------------8<-------------
//get calculated name from methods above
calcName = item.newBasename;


h = " Hi there";

return calcName + h;
-------8<--------------------8<--------------------8<-------------


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #



# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

----------
If this tool had saved you time, perhaps you want to donate an Dollar to Kim?
See http://www.advancedrenamer.com/download >>> [Donate] button.


19/06-13 08:53 - edited 19/06-13 12:18