I'm About to Give Up on InnoScript - Part 2

Started by Randem, December 22, 2007, 10:34:58 AM

Previous topic - Next topic

Tom Buggy

Amen to that.  I don't know how many times I've gotten nested trying to do something in code only to find that there was a simple way to do it in the first place.
 
Thanks again.

Randem

It means The simplest Solution is usually the correct one

Tom Buggy

Thanks - that did it.  Just in case the comment spewers are correct I now know for sure what {commonappdata} produces on any system.  Of course, I guess I knew that anyhow via the project code, but this way I'm protected against possible conflicts between the project code and ceratin systems.
 
BTW, what is Occam's Razor?

Randem

Just remove the space  
 
{code:GetCommonAppDataFolder}
 
I take no stock in people who just spew out comment without any testing to back it up... So those comments have no merit to me.  
 
Occam's Razor...

Tom Buggy

Thanks.  Looks like a straightforward approach - via the .ini file I capture whatever folder {commonappdata} produces and use it in my first-run code.
 
However, as is usual with me, a problem.  When I compile the modified Inno Setup script I get the following error:
 
Required function or procedure 'GetCommonAppDataFolder' not found
 
Here's what's in the script as copied directly from the script:
 
[INI]
Filename: {app}\GHM.url; Section: InternetShortcut; Key: URL; String: http://www.sportswaregolf.com
Filename: {app}\GHM.ini; Section: System; Key: Commonappdata; String: {code: GetCommonAppDataFolder}
 
[Code]
function GetCommonAppDataFolder(Param: String): String;
begin
   Result := ExpandConstant('{commonappdata}');
end;
 
What to do?  I checked out the Inno Setup examples and the format and content of the [Code] section is the same as what we have.
 
BTW, as to the apparent claim made in the Inno Setup Newsgroup that all systems running with the same OS may or may not have the same folder for All Users data - is that accurate?  Even if it is, the .ini should resolve things if we can get it to work - that is, I will have the name of the {commonappdata} folder whatever it is.

Randem

I found it.
 
If you want to test just put a line like this in a test Inno Setup Script. It will put the value of {commonappdata} in the myApp.ini file.
 
[Ini]
Filename: {app}myApp.ini; Section: System; Key: Commonappdata; String: {code: GetCommonAppDataFolder}
 
[Code]
function GetCommonAppDataFolder(Param: String): String;
begin
 
    Result := ExpandConstant('{commonappdata}');
end;

Randem

If you could post a link to that thread it would help. I don't have the time to go searching for it.

Tom Buggy

Please do me a favor - check out the post titled {commonappdata} Paths that I started on the Inno Setup support board and tell me what you think (about other than how I managed to make duplicate posts).  It contains some things that have left me more confused than ever.  For example:
 
-- There's some GetSpecialFolderLocation discussion and code that seem to go beyond (expand) the project code you gave me.
 
-- There's the following statement: The path returned by Windows XP is not even identical to the path returned by Windows XP.  (How's that for a confusing statement!)
 
-- Another statement: All Win2K systems (and presumably XP systems) do not have the folder: Drive Letter:Documents and SettingsAll UsersApplication Data.
 
That's just a sample.  The bottom line is that now I'm not sure I can use my first-run code with the project code to determine where {commonappdata} placed the skeleton data files that I want to replace, at least not on all systems that use the same OS - even if I restrict use of my app to Win2K, XP and Vista.
 
Help - please!

Tom Buggy

2) With respect to what W98 supports and doesn't support, a point of logic: If {commonappdata} in Inno Setup produces an All Users Data Path why doesn't the project code?
 
You haven't answered this question.  Plus, do I have to modidy the code to get something as straightforward as the System Drive that wasn't part of the Win98 output?
 
But enough, really.  It's clear that I can't use the project directly for 98 (and probably Me) and I am not going to attempt to modify code related to system areas with which I'm not familiar.  I'll revert to the options I mentioned earlier.
 
No need to respond to this post.  The debate is over on my end.

Randem

The project was never titled Finished It was stated you could use it to get what you need. There are many items of which the code made no reference but if you used the code and expanded it you could get most anything you need. The module where you can get this information is very well commented. You have to modify the code to find the item you need.

Tom Buggy

Let's end this debate and the possible interpretation that I don't appreciate the excellent support you have provided.  Before I close my end let make just two points based on your last few posts.
 
1) I do not consider the project code a sample.  It was presented to me as a finished program with which I could support ALL systems.
 
2) With respect to what W98 supports and doesn't support, a point of logic: If {commonappdata} in Inno Setup produces an All Users Data Path why doesn't the project code?

Randem

Let's remember, I was not hired to write code. I am just suppling SAMPLES that can get you on your way as a courtesy.

Randem

the project is pretty well documented and the routine that receives the folder names is very straight forward. The results if empty would mean unsupported... It is well known some function would not return results in early Operating Systems. Look in the API-Guide...

Tom Buggy

You comment on code so much I suppose you write perfect code?
 
Now let's not get nasty.  Of course, I, like anybody else, doesn't write perfect code.  But I do try to explain what happened when the code produces an unexpected or unintelligible result.

Randem

You comment on code so much I suppose you write perfect code? to get so much help and still complain very badly...