It is currently Thu Apr 25, 2024 11:58 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 99 posts ]  Go to page 1, 2, 3, 4, 5  Next
Author Message
 Post subject: Test for duplicate scripts
PostPosted: Sun Nov 13, 2011 3:47 am  (#1) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
This thread is for discussion/bug reports/enhancements of the script behind Help >> Test for duplicate scripts

Download it here: http://gimpscripts.com/2011/11/test-for-duplicate-scripts/

This script came about because of this discussion, some of the problems stemmed from having duplicates of scripts.

The user interface:
(Note: I use the terms folder and directory interchangeably)
Image
The Usage box is only there to give help on how to use the script (An editable text box was the only way I could find of putting text onto the user interface)

You then have three options:
All installed scripts
This checks all the scripts that you have currently installed, by checking all the scripts in the folders specified by Edit >> Preferences >> Folders >> Scripts

Single directory within itself
This checks the scripts in a single directory don't have any duplicates within that directory. For example you could have downloaded a few scripts into a temporary folder, and before installing into GIMP you might want to check that there isn't any duplication amongst themselves.

Single directory against installed scripts
This option could be the next step for your downloaded scripts in a temporary folder. It will check all the scripts in a separate directory aren't going to duplicate any scripts that you already have installed.

The Logging options are:
None
Don't log anything, just write problems to the error console.

Duplicates only
This writes the problems into the named file as well as to the error console.

Everything
This writes details of all the scripts being tested into the named log file along with the problems.

Example entries for an "Everything" log:
<Image>/Filters/Decor/Add Bevel... | C:\Program Files\GIMP-2.0\share\gimp\2.0\scripts\add-bevel.scm | script-fu-add-bevel | Andrew Donkin | 1997/11/06
<Image>/Filters/Decor/Add Border... | C:\Program Files\GIMP-2.0\share\gimp\2.0\scripts\addborder.scm | script-fu-addborder | Andy Thomas | 6/10/97
<Image>/File/Create/Web Page Themes/Alien Glow/Arrow... | C:\Program Files\GIMP-2.0\share\gimp\2.0\scripts\alien-glow-arrow.scm | script-fu-alien-glow-right-arrow | Adrian Likins | 1997

Where the fields are separated by the "pipe = |" character and are:
Menu Location  |  script file name  |  procedure name  | Author  |  Date


The log file itself is saved to the directory one up from your personal GIMP directory, so on Linux this will usually be your home directory. The location of the file is shown in the error console (with ".." indicating up one directory).

Note that this script isn't bullet proof and won't catch everything that could cause problems; For instance it won't catch where two different scripts register themselves with the same menu text, leading to two, indistinguishable. menu items.

Kevin

ps. Apologies for the format of this, apparently indenting doesn't work properly on this forum. ;)


Last edited by paynekj on Tue Nov 22, 2011 4:41 am, edited 6 times in total.

Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Sun Nov 13, 2011 4:27 am  (#2) 
Offline
Global Moderator
User avatar

Joined: Apr 07, 2010
Posts: 14182
good idea Kevin, that thread was getting pretty long.
Anyway, I did another run with your script and it is down to 18 so called dupes now but I don't think they are really dupes.
One of them for instance is the saulgoode calendar and the saulgoode year calendar, they are two different scripts, but come up as dupes. one is to make a monthly calendar and the other one a yearly one. Not a big deal as long as I know what they are.

Other than that I think the script is ready for launching, very good job.

_________________
Image


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Sun Nov 13, 2011 4:46 am  (#3) 
Offline
Global Moderator
User avatar

Joined: Apr 07, 2010
Posts: 14182
here are the three calendar scripts and they are all different. I remember when he wrote them and they come up as dupes when I run the script.

sg-calendar.scm
sg-calendar-year.scm
sg-platonic=calendar.scm

_________________
Image


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Sun Nov 13, 2011 12:16 pm  (#4) 
Offline
GimpChat Member
User avatar

Joined: Jul 04, 2011
Posts: 395
Location: Indianapolis, IN
molly wrote:
here are the three calendar scripts and they are all different. I remember when he wrote them and they come up as dupes when I run the script.

sg-calendar.scm
sg-calendar-year.scm
sg-platonic=calendar.scm


This is were good programming practice comes into play. I went to school to be a COBOL programmer but alas no jobs when I got out. That's why I'm just a lowly mainframe operator and a novice PHP programmer of sorts (I'm ok at taking others code and just twisting it around for my needs :) ).

The fellow who wrote those scripts probably used his first and then just added on and saved with a different name. Which is not a good thing to do!

I'm about to dive into this today and start adding the scripts back in one at a time. There scripts I have that were taken from the orig in Gimp and then enhanced by somebody else without changing the registration or menu names. Not a good thing to do again!

I really need to learn how to write these scripts! I'd probably be half way descent at it .. but I need that one on one training. :hehe

_________________
"That which does not kill us makes us stronger." ~ Friedrich Nietzsche


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Sun Nov 13, 2011 1:30 pm  (#5) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
Good idea open a dedicated topic to the script , was too hard trace it along the original help topic...and good idea the script too very useful, it is really a pain search manually for duplicated scripts that may have very different file names

thank Paynicky

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Sun Nov 13, 2011 3:16 pm  (#6) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
molly wrote:
here are the three calendar scripts and they are all different. I remember when he wrote them and they come up as dupes when I run the script.

sg-calendar.scm
sg-calendar-year.scm
sg-platonic-calendar.scm

If you have the latest version of 'sg-calendar.scm' then the 'sg-calendar-year.scm' file is not needed (as both commands are provided in the file).

Please delete the file 'sg-calendar-year.scm' and ensure you are using the latest version of 'sg-calendar.scm'.

MrBiggz wrote:
The fellow who wrote those scripts probably used his first and then just added on and saved with a different name. Which is not a good thing to do!

If I recall correctly, the calendar-year script was written over a year after the calendar script was
released and in its initial beta form was a separate file requiring that the calendar script also be installed. During the development of the "year" script -- a process based largely on interaction with and feedback from the members of this forum -- it became expedient to combine the two files into one for technical reasons. The existence of 'sg-calendar-year.scm' on molly's computer is a remnant of her having participated in that development process; it does not belong there.

The 'sg-platonic-calendar.scm' file is an exceptional case. It is an optional adjunct to the 'sg-calendar' script. If installed, it requires 'sg-calendar.scm' to also be present (and thus there should be no conflict with both scripts being installed simultaneously). It is currently the only script I've published that depends upon resources not available with a default GIMP install. While the platonic script could be re-written to avoid this dependency, both scripts are already quite large by Script-fu standards (an order of magnitude larger than typical) and given the rather singular purpose of the platonic script, it would not be justified to either double the size of the calendar script or to maintain code redundancy in two separate scripts.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Sun Nov 13, 2011 3:29 pm  (#7) 
Offline
Global Moderator
User avatar

Joined: Apr 07, 2010
Posts: 14182
thank you saul, I knew there was the three but didn't know I had an antique in the midst. lol

_________________
Image


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Mon Nov 14, 2011 5:04 am  (#8) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Thanks Kevin. :)

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Mon Nov 14, 2011 2:04 pm  (#9) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4047
It would be even better if a script could utilize grep to check additionally for author/function names or register info because most FX scripts do not use identical script names.

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Mon Nov 14, 2011 3:49 pm  (#10) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
mahvin wrote:
It would be even better if a script could utilize grep to check additionally for author/function names or register info because most FX scripts do not use identical script names.


I'm not sure what you're asking for here. What is it you want to check? and can you clarify what you mean by "script-names".

Do you mean the text that appears in Menus, i.e. Filters >> Light and Shadow >> Drop Shadow...
or the procedure name (script-fu-register "script-fu-drop-shadow"... (which is what this script checks) or something else?

Kevin


p.s. grep doesn't exist natively on Window$ so that's not an option. The script could be easily modified to get all the register information but I don't understand what you want to do with it.


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Mon Nov 14, 2011 5:13 pm  (#11) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4047
I've got about 15 duplicates this script did not find. (It did not find ANY scripts at all) If this script is suppose to be catching scripts by the register function names (e.g. "script-fu-drop-shadow"), it's not working for me. Most register information has the author's name, the date the script was written, etc. Not clear why the most obvious isn't obvious to you, but if the script could exceed just looking for function names, it could be beneficial in rounding up scripts by author, etc.

Script names = the name of the script.scm

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Mon Nov 14, 2011 5:25 pm  (#12) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
mahvin wrote:
I've got about 15 duplicates this script did not find. (It did not find ANY scripts at all) If this script is suppose to be catching scripts by the register function names (e.g. "script-fu-drop-shadow"), it's not working for me. Most register information has the author's name, the date the script was written, etc. Not clear why the most obvious isn't obvious to you, but if the script could exceed just looking for function names, it could be beneficial in rounding up scripts by author, etc.

Script names = the name of the script.scm


Thank you. (script name=file name) I've just found that it doesn't work on Linux thanks to a difference in how the script-fu-paths are stored in gimprc. Windows uses a semi-colon to separate the paths and Linux uses a colon.

It might be helpful if a MAC user could type the following into the Script-Fu console and let me know what it displays:
  (gimp-gimprc-query "script-fu-path")


As a quick fix you could find this line:
          (set! source_directory_list (strbreakup source_directory_list ";"))  ; turn the string into a list


and change it to
          (set! source_directory_list (strbreakup source_directory_list ":"))  ; turn the string into a list


At the moment I can't find an equivalent to DIR-SEPARATOR to give me a platform independent way for breaking up the path.

Kevin


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Mon Nov 14, 2011 5:30 pm  (#13) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4047
Ah! I never thought outside the OS box, since I am using Ubuntu, thanks for the heads up.

Now another question, can you have this script create a log file so I can print out the list and double check?

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Mon Nov 14, 2011 5:44 pm  (#14) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
mahvin wrote:
Ah! I never thought outside the OS box, since I am using Ubuntu, thanks for the heads up.

Now another question, can you have this script create a log file so I can print out the list and double check?


Yes. But not right now. :) I will ask one question before I go to bed :zzzz . Can you please specify what you want in the log file and in what format. I tried this earlier today, logging all the register entries: Menu entry, filename and procedure name in CSV format:
_Arrow... , C:\Program Files\GIMP-2.6.7\share\gimp\2.0\scripts\beveled-pattern-arrow.scm , script-fu-beveled-pattern-arrow
_Bullet... , C:\Program Files\GIMP-2.6.7\share\gimp\2.0\scripts\beveled-pattern-bullet.scm , script-fu-beveled-pattern-bullet
B_utton... , C:\Program Files\GIMP-2.6.7\share\gimp\2.0\scripts\beveled-pattern-button.scm , script-fu-beveled-pattern-button
H_eading... , C:\Program Files\GIMP-2.6.7\share\gimp\2.0\scripts\beveled-pattern-heading.scm , script-fu-beveled-pattern-heading

Which is a bit of a mess.

Would you only want the duplicates, or all of them?

Kevin


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Mon Nov 14, 2011 5:59 pm  (#15) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4047
Wow, a good question.

Well, I was thinking the directory path of the duplicates is what I wanted. But the reason I wanted author info as well is because some people rename scripts as their own, when they are in fact NOT the original author. I was intending to remove duplicate files and rename the files to reflect the author/script.

I hate countering with another question, but without providing both file names, how else would I know what it's duplicate file is, if I have nothing to compare it to? I have a tendency to shy away from the global GIMP share folders and want to organize my single user share folders. I slightly alter register function names to avoid the GIMP warnings (99% are FX scripts), so I want to root those out and stop my bad behavior and clean up and organize my single user shares, while removing those damn FX scripts.

I'll elaborate more if none of the above made any sense.

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Tue Nov 15, 2011 1:54 am  (#16) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
Where are the dupes stored or displayed when it finds them?

OK now just did not give message in 2.7.4 win64 install message came up in 2.6.11 win32 install

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Tue Nov 15, 2011 3:48 am  (#17) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
Graechan wrote:
Where are the dupes stored or displayed when it finds them?

OK now just did not give message in 2.7.4 win64 install message came up in 2.6.11 win32 install


Just to be sure I understand, you saw messages in the error console for 2.6.11 but NOT on so called 2.7.4 ?

and @mahvin: Your explanation makes sense. I think I understand your requirement.

Kevin


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Tue Nov 15, 2011 6:22 am  (#18) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
Here's a beta of version 1.3

I think I've bodged it sufficiently to work on Windows and Linux (Need a Mac tester please)

There is now the option to create a log file of either just the duplicates, or of everything tested. the log file should appear one directory up from the .gimp directory, which might be your home directory on Linux and somewhere else on Windows.

Let me know what happens :)

Kevin


Update: We reached version 1.5, which is now on GimpScripts, see first post: viewtopic.php?f=9&t=3057&p=38900#p38900


Last edited by paynekj on Tue Nov 22, 2011 4:33 am, edited 4 times in total.

Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Tue Nov 15, 2011 6:28 am  (#19) 
Offline
Global Moderator
User avatar

Joined: Apr 07, 2010
Posts: 14182
Kevin, is this script in place of the previous one? Do I delete the one I have now before installing this one?

_________________
Image


Top
 Post subject: Re: Test for duplicate scripts
PostPosted: Tue Nov 15, 2011 6:30 am  (#20) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
molly wrote:
Kevin, is this script in place of the previous one? Do I delete the one I have now before installing this one?


Yes you do replace the old one, otherwise it will end up reporting itself as a duplicate :shock:


Top
Post new topic Reply to topic  [ 99 posts ]  Go to page 1, 2, 3, 4, 5  Next

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Juxtapose exactly duplicate paths

2

No new posts Attachment(s) GEGL Jelly - Apply on Duplicate Layer above and use eraser

3

No new posts Attachment(s) pm_create_a_depthmap_image.py (Test)

8

No new posts Jewelry Text Test

8



* Login  



Powered by phpBB3 © phpBB Group