Pstart - print items (solved... I think!)

Ask other users about problems encountered with portable apps or help by posting solutions to existing problems.
Post Reply
Message
Author
Darkbee
Posts: 291
Joined: Mon Feb 06, 2006 8:35 am
Contact:

Pstart - print items (solved... I think!)

#1 Post by Darkbee »

This is not exactly a problem as such but I would like to be able to print out a listing of all the menu items I have in PStart (including all sub folders and items within them).

The only way that I can think to reasonably do this without too much effort is to find an XML viewer that will represent the layout in a nice hierarchical tree-view.

Does anyone have any suggestions of how I might go about this, either programs that will help me or other ways of approaching the problem?
Last edited by Darkbee on Sun Nov 26, 2006 1:00 pm, edited 1 time in total.

User avatar
Andrew Lee
Posts: 3064
Joined: Sat Feb 04, 2006 9:19 am
Contact:

#2 Post by Andrew Lee »

Hmmm, how about opening pstart.xml in Firefox, and hitting File, Print?

Darkbee
Posts: 291
Joined: Mon Feb 06, 2006 8:35 am
Contact:

#3 Post by Darkbee »

Andrew Lee wrote:Hmmm, how about opening pstart.xml in Firefox, and hitting File, Print?
only problem with this is that it prints out the full source code, which I'll have pages and pages of unnecessary text. All I really need to see is parent folder and item name. I suppose I could manually edit the source until I have what I need but I was hoping to avoid this. What you're suggesting will produce output like this:

Code: Select all

<files name="Audio">
<icon>Icons\audio.ico</icon>
−
	<file name="AudioGrabber">
<path>Audio\AudioGrabber\audiograbber.exe</path>
<runcount>7</runcount>
<rundate>2006/11/03 08:51:17</rundate>
</file>
Whereas, I'd rather see:

Code: Select all

Audio
  --  AudioGrabber
  --  XMPlay
Internet
  --  Pocket K-Meleon
  --  Popman
etc etc. I don't need all the guff.

As a little side note, the XML file contains all the settings for PStart, so there are things in there that I really don't care to print at all.

Thanks for the suggestion though.

For the record, I want to conduct an audit of all the portable applications I've acquired and see if there are any that are surplus to requirements. Now, my app count is not quite running in the hundreds like some, but it'd be nice if I could scribble tough on paper before I go deleting files at will.

It actually occurred to me that there is another way I could approach the problem. Since all of my portable apps are located in one parent folder, I could try doing a directory print of just parent and child folders only (since I have one app per folder). Now I just have to find which directory print program has the most desirable output. The nice thing about doing it this way is that I should be able to get a size per folder in the output too so I can see how much space I'll save by removing various apps.

User avatar
Andrew Lee
Posts: 3064
Joined: Sat Feb 04, 2006 9:19 am
Contact:

#4 Post by Andrew Lee »

It's XML, buddy. You can apply a simple XSLT stylesheet to extract whatever you want.

I know, I know, XSLT still feels like pulling teeth without anesthesia sometimes, but for your requirements, it shouldn't be too difficult.

Darkbee
Posts: 291
Joined: Mon Feb 06, 2006 8:35 am
Contact:

#5 Post by Darkbee »

Andrew Lee wrote:It's XML, buddy. You can apply a simple XSLT stylesheet to extract whatever you want.

I know, I know, XSLT still feels like pulling teeth without anesthesia sometimes, but for your requirements, it shouldn't be too difficult.
I've never played with XSLT before, I'm having a bit of trouble getting the output in the form of:

Parent Menu Folder
Child Menu Item
Child Menu Item
Parent Menu Folder
Child Menu Item

etc.

So far I can print out, just all of the child menu items in a flat one column table using the following:

Code: Select all

<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
  <html>
  <body>
    <h2>My PStart Menu</h2>
    <table border="1">
    <xsl:for-each select="/start/files/files/file">
      <tr>
      <td><xsl:value-of select="@name"/></td>
    </tr>
    </xsl:for-each>
    </table>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>
I've tried messing around with nesting for-each attributes to get at the parent folders without any success. Usually, the output I get are all of the child menu items from all parent folders, repeated for each occurrence of a new parent folder. Got any ideas?

This is cool btw, means that users can get exactly the format they want, once they figure out what they're doing! :?

It also occurred to me that by using a directory print, I can see if there are any items that exist that are not in PStart and vice versa, so using both techniques will allow me to do a bit of housekeeping.

Thanks for the help!

Darkbee
Posts: 291
Joined: Mon Feb 06, 2006 8:35 am
Contact:

#6 Post by Darkbee »

I'm thinking I have to apply multiple templates.... oooh it's so frustrating... I feel like I'm close but still no cigar... yet! :shock:

Darkbee
Posts: 291
Joined: Mon Feb 06, 2006 8:35 am
Contact:

#7 Post by Darkbee »

Looks like I was on the right track with the applying templates idea. This code seems to do what i want it to do:

Code: Select all

<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/start/files">
  <html>

    <body>
    <h2>My PStart Menu</h2>
    <table border="1">

		<xsl:apply-templates/> 
    </table>
  </body>
  </html>
</xsl:template>

<xsl:template match="files">
	<tr>
		<th><xsl:value-of select="@name"/></th>
	</tr>
<xsl:apply-templates select="file"/> 

</xsl:template>

<xsl:template match="file">
	<tr>
		<td><xsl:value-of select="@name"/></td>
	</tr>
</xsl:template>

</xsl:stylesheet>
Thanks for the pointers Andrew.

User avatar
Andrew Lee
Posts: 3064
Joined: Sat Feb 04, 2006 9:19 am
Contact:

#8 Post by Andrew Lee »

This takes care of cascaded groups as well:

Code: Select all

<?xml version="1.0" encoding="ISO-8859-1"?> 

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 

<xsl:template match="/start/files"> 
  <html> 
    <body> 
      <p><b>My PStart Menu</b></p>
      <ul><xsl:apply-templates/></ul>
    </body> 
  </html> 
</xsl:template> 

<xsl:template match="files"> 
   <li><b><xsl:value-of select="@name"/></b></li> 
   <ul><xsl:apply-templates/></ul> 
</xsl:template> 

<xsl:template match="file"> 
   <li><xsl:value-of select="@name"/></li> 
</xsl:template> 

</xsl:stylesheet>

Post Reply