Tracy Pearson wrote:
> MB Software Solutions, LLC wrote on 2010-04-19:
>> Is PASCAL scripting in Inno just like the Pascal I learned bazillion
>> (actually 21) years ago? Sheesh...gotta search the internet for
>> Pascal syntax again...I completely forgot most of it.
>>
>> Tips from fellow Inno [Code] section programmers?
>>
>>
>>
>
> Mike,
>
> Try this untested:
>
> **********
>
> [file]
> Source: "filename"; DestDir: "{app}"; AfterInstall: ShouldRunInstall();
> Flags: onlyifdoesntexist
>
> [code]
> Var
> runInstall: Boolean;
>
> function ShouldRunInstall();
> begin
> runInstall := True;
> end;
>
> function InitializeSetup(): Boolean;
> begin
> runInstall := False;
> Result := True;
> end;
I worked around this by putting this code into the startup of my main.prg:
FUNCTION InstallMySQL() as Logical
* This will run the setup.exe in the MyODBC subfolder if the expected
key doesn't exist.
* The expected key is Software\MySQL AB\MySQL Connector/ODBC 3.51,
ValueName: Version; ValueData: ?...it would appear that I'm not caring
about the value...just that there IS one.
LOCAL lcKey as String, loRegistry as registry OF
.\classes\registry.vcx, lnError as Integer, lcValue as String, lcMsg as
String, lcFile as String, llInstalled as Logical
lcKey = "Software\MySQL AB\MySQL Connector/ODBC 3.51"
loRegistry = NEWOBJECT("registry",".\classes\registry.vcx")
lnError =
loRegistry.GetRegKey("Version",@lcValue,lcKey,HKEY_LOCAL_MACHINE)
IF lnError <> 0 THEN && problems getting key; assume odbc driver not
installed
llInstalled = .F.
lcFile =".\MyODBC\setup.exe"
IF FILE(lcFile) THEN
WAIT WINDOW NOWAIT "Launching ODBC setup"
LOCAL loShell
loShell = NEWOBJECT("_ShellExecute", "_environ.vcx")
loShell.ShellExecute(FULLPATH(lcFile))
RELEASE loShell
lcMsg = "The program is now installing a necessary ODBC
driver. Just
choose the Typical setup, and accept the other defaults to install." + ;
CR + CR + "Press OK after you have run
the ODBC installation."
MESSAGEBOX(lcMsg,64,"ODBC setup necessary.")
ENDIF
*!* lnError =
loRegistry.SetRegKey("Pilot",lcValue,lcKey,HKEY_CURRENT_USER,.T.)
ELSE && key is there....ODBC should be properly installed already
* do nothing except set flag
WAIT WINDOW TIMEOUT 0.5 "ODBC check complete"
llInstalled = .T.
ENDIF && lnError = 0
RETURN llInstalled
ENDFUNC && InstallMySQL() as Logical
So far, it's working well.
--
Mike Babcock, MCP
MB Software Solutions, LLC
President, Chief Software Architect
http://mbsoftwaresolutions.com
http://fabmate.com
http://twitter.com/mbabcock16
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.