This is the Personal Stock Monitor scripting developers forum.
Subscribe to RSS Feed
Developing Custom Stock Market Software using PSM -> Article: Recreating the Capital Gains Report
Not logged in.
2011-02-05 18:20:41
1 of 4
#2911
Howdy Anatoly,

Just read through your article, "Recreating the Capital Gains Report" and tried Installing the script so I could make some modifications for my specific use.

However, upon restarting PSM, I got a Script Error box stating "Name redefined (00000000)" ... see screen capture below.

So, I went into Tools / Extensions, UNinstalled the existing report extension, "Capital Gains Report 1.0.7 (Extended Capital Gains Report)", and saw that MY extension, which I had installed prior to restarting PSM, was in fact installed as well.

So, I UNinstalled it and then reinstalled it, shut down PSM and restarted PSM.

When starting up, PSM still shows the same Script Error box. However, the box now shows the built-in extension report as the one in error. I'm assuming this is due to the uninstall / reinstall procedure ... I uninstalled the built-in extension, installed MY extension, and then when PSM starts, it tries to auto-reinstall the built-in report extension AFTER mine is already installed?

So, the question became, what exactly did I need to change in your "Recreating the Capital Gains Report" VBS code so this "Name redefined (00000000)" error will quit showing up and allow both the built-in report AND my new report to exist in PSM at the same time?

Through a lot of trial and error, I found the following changes had to be made in order to differentiate the built-in report with the one I wanted to add, in the Tools / Extensions display, in the Report selection list, and internally to PSM (the Class names) ...

OLD: <pss_extension min_pss_version="7.1" name="Capital Gains Report" version="1.0.0">Extended Capital Gains Report

NEW: <pss_extension min_pss_version="7.1" name="New Capital Gains Report" version="1.0.0">New Extended Capital Gains Report

OLD: ' Capital gains report for Personal Stock Streamer
NEW: ' New Capital gains report for Personal Stock Streamer

Replace every occurrence of the Class name "CapGainsInfo" with "NewCapGainsInfo"

Replace every occurrence of the Class name "CapGainsReportHandler" with "NewCapGainsReportHandler"

OLD: ReportManager.Register "Capital Gains (Extended)", ReportHandler
NEW: ReportManager.Register "New Capital Gains (Extended)", ReportHandler

For everyone else who would like to use your code as starting point for creating their own Capital Gains Report extension, would it be possible for you to change your code in the article and code posting?

Thank you very much Anatoly,

-Don

Script Error Box

Posted by: dgoyette
2011-02-07 09:22:07
2 of 4
#2914
in reply to #2911
Since that code is the source for the existing report that is installed with the software, it's no surprise that there is a naming conflict because all the extensions are loaded into the same instance of the script engine. The source code was intended to be a starting point for learning and developing your own scripts, but yes, if you want to modify the existing report, because of the changes we've made (report extensions were not originally bundled with the software like they are in more recent versions) you have to rename all of the variables and classes to prevent name conflicts.
Posted by: Anatoly
2011-02-07 23:40:38
3 of 4
#2921
in reply to #2914
Hmmm, is there a reason that the built-in report would have a different version number -- 1.0.7 vs. 1.0.0 for the extension source code?

Would you be able to make the necessary changes in the source code you posted, so other folks don't have to make all these changes themselves? They may just give up on scripting before they even get started, as they may not understand what the error is or how to fix it.

Many folks, like myself, prefer to use existing, working code as their launching point for learning and making modifications.

Thanks a bunch Anatoly,

-Don
Posted by: dgoyette
2011-02-08 09:30:37
4 of 4
#2924
in reply to #2921
The source code that is posted is the original version of the report, and I just haven't updated it with the latest version. However it serves the intended purpose.
Posted by: Anatoly