Help with color coding

Discussion & Support for xplorer² professional

Moderators: fgagnon, nikos, Site Mods

Post Reply
RTC
Member
Member
Posts: 41
Joined: 2007 Jan 24, 23:06
Location: Paramaribo-Suriname

Help with color coding

Post by RTC »

Dear Members,

I need some help with following issue:

I have a lot of pdf files in a folder
When studying a certain topic I tend to browse through those pdf's
Some of those pdf's have valuable info which I need to keep track of
Some others are worthless (with regards to this topic)
As I'm not working continously I also need to know which pdf's have already been browsed

I would like to add an custom made icon on my toolbar with a color code...when i click on this icon it will toggle a certain color on or off on the selected pdf

I know this must be possible with xp2 and I don't tend to be lacy but I'm definitely not that tech savy as most of you on this forum

Any help would be greatly appreciated... if possible in low tech wording...:lol:

Thanx

                 *** RTC ***
Kilmatead
Platinum Member
Platinum Member
Posts: 4580
Joined: 2008 Sep 30, 06:52
Location: Dublin

Post by Kilmatead »

Ok, I'll take a loose stab at this.  And keep in mind that this really is a loose stab - I couldn't come up with an easier way of doing it, so this is it.  If anyone else has a bright idea to prove me silly, feel free to humiliate me. :D

Consider this a "proof of concept" as it will work, but certain limitations may arise.  For instance, I'm actively modifying the "Archive" attribute of your PDF file.  If you use a backup program which depends on that attribute - or something else changes it specifically - then this might cause problems.  Also, I don't know if you use XP, Vista, or Win7, but the silly UAC in Vista and Win7 may flag changing attributes via a vbs file as "trouble", so it might get upset every time you run the script and ask you about Administrator nonsense.  Personally I find UAC to be a waste of time so I always leave it off. Anyway, these are just caveats - I leave the work-around's up to you. :wink:

Right, still with me?  This is going to be a pain in the ass, so roll up your sleeves.

Ordinarily the Colour Coding rule is bound to the file itself and x2 can't know if you think it's relevant to your research or not, so we need a permanent way to change "something" in that file to mark it as Important or Un-Important so the colour-rule can engage or disengage automatically.  In this case, we'll change the Archive attribute as it's simple to do.

Copy the following text into a text file and save it somewhere as "TogglePDF.vbs"

Code: Select all

Set objFSO = CreateObject("Scripting.FileSystemObject")

If (Wscript.Arguments.Count > 0) Then
	Set objFile = objFSO.GetFile(wscript.arguments(0))
	objFile.Attributes = objFile.Attributes XOR 32 
end if
Then you need to create the User Command to run that file: (Customize -> User Commands -> Add New)

Code: Select all

> "C:\Windows\System32\wscript.exe" "C:\TogglePDF.vbs" $S
Image

(You'll note that for simplicity I placed the file in C:\ - obviously you should change the path to wherever you saved TogglePDF.vbs)

You can add this User Command to any toolbar by right-clicking on the toolbar and selecting "Customize" then finding the new command and clicking "Add".

Now you need a rule to set the colour-coding for PDF's.  (Customize -> Color Coding... and click the teeny-tiny "add new" icon or press <Space>.)

Basically it should look something like this: (Green would indicate the PDF is relevant to your research, otherwise the PDF will just be the default black colour.)

For the main rule ("Named:") just use *.pdf and untick the box next to "Folders" just for cleanliness. :D (Do not close this window yet, as the following step is important.)

Image

Next you need to configure the attribute check, so where it says "Additional Rules" click the first teeny-tiny "add new" icon, or click in the box and press <Space>.

Image

Under "Property and Description" click the down arrow and select "Attributes [S]".

Then in the "Find" box type an "A" (for Archive, obviously).

Under "Boolean Context" click the "Not" button.  Basically (as far as I know) most new files have the Archive bit set by default, so this way when we disable it the colour-coding rule will engage (in this case making your "relevant" PDF green).  Otherwise, all PDF's would register as green to begin with, and it would get confusing to de-mark them one by one.

If you're still with me (I bet you're not :wink:), you're now done.  When you click the Toolbar button it will toggle the archive bit of the selected PDF file, and x2 should "auto-refresh" and the file (in theory) should turn green.  Click the button again and it will switch back to normal text colour.

Just to prove that it works ("Proof of Concept"), here's the final result (I made mine a really ugly purple colour just because Green-on-White is hard to read):

Image

Now watch for someone to come along and suggest a simple 1-step method that does the same thing without the bother of all that crap.  My brain doesn't always identify the simplest solution to any problem. :oops:  (Probably why my favourite film is Fitzcarraldo :D)
Last edited by Kilmatead on 2010 Apr 04, 01:28, edited 1 time in total.
RTC
Member
Member
Posts: 41
Joined: 2007 Jan 24, 23:06
Location: Paramaribo-Suriname

Post by RTC »

Kilmatead,

Forgot to mention my OS: XP SP3

Appreciate your help and suggestions...let me study this one...I'm just a little more than average amateur...(but as always I enjoyed your writing style very much...)

Two questions:
Why modifying the Archive attribute?
Can I have more colors available?

cheers

                    *** RTC ***
Kilmatead
Platinum Member
Platinum Member
Posts: 4580
Joined: 2008 Sep 30, 06:52
Location: Dublin

Post by Kilmatead »

RTC wrote:Why modifying the Archive attribute?
As we need some way to tell a normal PDF apart from your "tagged" PDF's, I chose the archive attribute simply because it isn't "really" used for anything else (to my knowledge) while generally the rest of the file attributes are.  If there are extra "free" file attributes available, then that would be even better but I don't think it works that way. :shrug:
RTC wrote:Can I have more colors available?
More colours in the sense that you would like have some PDF's marked as green, some marked as red and some unmarked?  This would require using two or more attributes, so another method would be needed.

Such a method would be to not actually change attributes at all, but rather physically change the PDF extension itself, such as *.PDF_1, *.PDF_2, etc.  Each extension could have it's own colour rule, and all extensions would have to be associated manually with your PDF reader, though this would probably invalidate them for use with x2's quickviewer function, they would function more or less as normal.  However, they would lose any "portability" as obviously other people's machines wouldn't know to associate them, if you sent copies to anyone.  "Flipping the bits" method avoided that sort of thing, in my mind.

Each colour rule would need to have its own VBS script (and therefore toolbar icon) to change the filename's extension accordingly... though logistically it starts to get a bit more complex than just toggling if hierarchical gradations of colour are your intent. (That's a mouthful :shock:)

I'm afraid my VBS scripting abilities are a little limited (I cobbled together the other one in a hurry with a lot of trial and error and some googling about attributes) - I'd assume manipulating file extension names would require the usual malarkey of string editing/splicing, etc.
RTC wrote:as always I enjoyed your writing style very much
Believe it or not I actually try not to use any writing "style" when doing "help" answers, as my usual flowery nonsense would just confuse non-native English-speaking people.  As in, what in God's name do you speak in Paramaribo-Suriname? :D (I confess I had to cheat and look it up with an atlas. :roll:  Go Papillon! :wink:)
User avatar
nikos
Site Admin
Site Admin
Posts: 15806
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

Post by nikos »

a simplest way could be adding all the PDF files in a scrap window, then whichever you read you press <DEL> (in the scrap) to remove it from the window. You can have another scrap window to throw in 'important' files and so on
Kilmatead
Platinum Member
Platinum Member
Posts: 4580
Joined: 2008 Sep 30, 06:52
Location: Dublin

Post by Kilmatead »

nikos wrote:a simplest way could be adding all the PDF files in a scrap window
Where's the fun in that?  The God Quatzequatl once said, "He who rebuild pyramid with toothpicks accomplish anything."

Or at least he will have lots of splinters to show for his troubles. :wink:
RTC
Member
Member
Posts: 41
Joined: 2007 Jan 24, 23:06
Location: Paramaribo-Suriname

Post by RTC »

Kilmatead: yes it works....!! Very nice...

I'm not sure if the attribute thingy will give me problems with backups but will see that later...for now I'm fixed

I understand the issue with multiple colours; for now this solution will suffice.

I also tried Nikos way but this one is rather basic....I indeed am an amateur but working with a high end file manager... :lol: So expected a higher end way to accomplish this... :wink:

As for my native language: it's Dutch but pretty fluent in English although I have to admit I sometimes need to use the web to look up some of the Irish "flowery sense" in your writing...afterwards usually LOL

Thanx again for your help and looking forward to more of your forum blogs...

                      *** RTC ***
User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1241
Joined: 2005 Oct 16, 19:09

Post by FrizzleFry »

couldn't you use the last accessed time for this?
Kilmatead
Platinum Member
Platinum Member
Posts: 4580
Joined: 2008 Sep 30, 06:52
Location: Dublin

Post by Kilmatead »

FrizzleFry wrote:couldn't you use the last accessed time for this?
Depends on how you wanted to use it... it's worth noting that in Vista and Win7 the Last Access timestamp is actually disabled by default (less disc overhead == overall efficiency), whereas in XP it's enabled by default (which slows things down), so one would need to send the user off to playing with 'fsutil behavior set' commands (or registry hacks) in order to set up the environment first, which seems messy.  And if some people actually like having things updated all the time, it wouldn't be practical.

One very good reason for not using Access Date is that VBS (seemingly) can't modify this particular aspect of the file.  It can read the date all right, but it can't change it.

So one would have to find other means (such as writing a small utility in C) to do nothing more than set particular dates to correspond to colours.  Which is a bit impractical, considering the Archive bit method works for the OP.

The Archive bit is basically unused anyway (certainly modern imaging backups don't rely upon it for incrementals or differentials anymore), so it's "almost" certain to be free for use.  Pity it's only a bit and not a whole byte, else the multiple colour-thing would work fine.
Post Reply