PDA

View Full Version : A few more Questions



NewsArchive
01-26-2006, 03:35 AM
Friedrich,

I got a few more questions - maybe you can point me in the right direction:

1. In the ClarionSelectDialog - it seems like you cannot detect Clarion
versions based on a CompileVariable? Ideally I would like to pass a
parameter to the compiler such as 55|60|61|62 and it detects C5.5, C6.0,
C6.1, C6.2, or 50|55 and it only detects the existance of Clarion 5 and
C5.5. I guess I'll need to continue down the road of creating my own
RadioDialog window for the clarion select?

2. I can't seem to find anything of this nature in the help, but I thought
it might be worth a shot. Is there a function out the box to edit the RED
file? Or should I create my own set of functions using the INI read\write?

3. I'm looking for a way of adding shortcuts to the windows start menu -
based on whether the program exists or not. IOW - loop through the files in
the (e.g. _SB_INSTALLDIR\bin) and place a link for each EXE that's
installed. The clarion equivalent would look something like:

directory(filesq, _SB_INSTALLDIR & '\bin\*.exe',)
loop Counter = 1 to records(filesq)
get(filesq,Counter)
do AddShortCutToStartMenu
end

Anyway of doing that?

4. Failing the possibility of Q3, is there a way to conditionally include a
script (based on a passed parameter)? I guess I could work around this, but
conditional inclusion would be simpler. Also related to this - is there a
way of including a script that contains a Compiler variable - e.g.
[PRODUCTNAME]script.sbi?

Thanks a ton for the help

Geoff (Capesoft)

NewsArchive
01-26-2006, 03:35 AM
Geoff,

> I got a few more questions - maybe you can point me in the right
> direction:
>
> 1. In the ClarionSelectDialog - it seems like you cannot detect Clarion
> versions based on a CompileVariable? Ideally I would like to pass a
> parameter to the compiler such as 55|60|61|62 and it detects C5.5, C6.0,
> C6.1, C6.2, or 50|55 and it only detects the existance of Clarion 5 and
> C5.5. I guess I'll need to continue down the road of creating my own
> RadioDialog window for the clarion select?

The "Clarion Environment Detection" dialog can only detect Clarion versions
defined in "Supported Version" (check boxes).

But hey, we are talking about SetupBuilder 5, so there is a solution
available <bg>

Please see the "Detect Clarion Versions Demo 1.sb5" example. It makes use
of the "Detect Clarion Versions.sbi" include script.

You can modify it to fit your own needs. For example, define a WHICHVERSION
symbol (#def / Get value from compile command line) and based on that
"symbol" decide which version to detect.

#def WHICHVERSION = (Command Line)

#ifdef WHICHVERSION Equals "1" Then
#def C63 = 1
#def C62 = 1
#def C61 = 1
#def C60 = 1
#def C55 = 1
#def C50 = 1
#end

#ifdef WHICHVERSION Equals "2" Then
#def C63 = 1
#def C62 = 0
#def C61 = 0
#def C60 = 0
#def C55 = 0
#def C50 = 0
#end

If you pass "1" then it detects all Clarion versions. Pass "2" to only
detect Clarion 6.3. Etc.

Then use the following to call from the command line:

sbuilder.exe /C "c:\test\Detect Clarion Versions Demo 1.sb5" /DS
WHICHVERSION "2"

BTW, the new SetupBuilder 5 build is nearly code complete. It now creates
a compiler.txt file if there was a compile error. The log file is located
in the same directory as the sbuilder.exe file. Interesting feature if you
compile from the command line.

> 2. I can't seem to find anything of this nature in the help, but I thought
> it might be worth a shot. Is there a function out the box to edit the RED
> file? Or should I create my own set of functions using the INI read\write?

You can use the "Text File Operations" script function.

> 3. I'm looking for a way of adding shortcuts to the windows start menu -
> based on whether the program exists or not. IOW - loop through the files
> in the (e.g. _SB_INSTALLDIR\bin) and place a link for each EXE that's
> installed. The clarion equivalent would look something like:
>
> directory(filesq, _SB_INSTALLDIR & '\bin\*.exe',)
> loop Counter = 1 to records(filesq)
> get(filesq,Counter)
> do AddShortCutToStartMenu
> end
>
> Anyway of doing that?

Yes, this would be possible, but how to set the correct "shortcut text"?
For example, if it finds sbuilder.exe then it's not a good idea to display
sbuilder.exe as shortcut text.

> 4. Failing the possibility of Q3, is there a way to conditionally include
> a script (based on a passed parameter)? I guess I could work around this,
> but conditional inclusion would be simpler. Also related to this - is
> there a way of including a script that contains a Compiler variable - e.g.
> [PRODUCTNAME]script.sbi?

Yes, you can conditionally include a script (see technique used in 1.).

Using compiler variables in the #include function is not possible. But I
think it's a good idea. I'll see what we can do here.

Does this help?

Friedrich

Friedrich Linder
CEO, Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 5

NewsArchive
01-26-2006, 03:35 AM
Geoff,

> 4. Failing the possibility of Q3, is there a way to conditionally include
> a script (based on a passed parameter)? I guess I could work around this,
> but conditional inclusion would be simpler. Also related to this - is
> there a way of including a script that contains a Compiler variable - e.g.
> [PRODUCTNAME]script.sbi?

Just checked the [PRODUCTNAME]script.sbi idea.

Unfortunately, this is not possible because compiler variables are resolved
at compile time. The IDE displays all included script in the script editor
and the compiler variable cannot be resolved.

But what you can do is (using #def and #ifdef):

#ifdef CONDITION Equals "A" Then
#include ProductA_script.sbi
End

#ifdef CONDITION Equals "B" Then
#include ProductB_script.sbi
End

etc.

Friedrich

--
Friedrich Linder
CEO, Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 5

NewsArchive
01-30-2006, 06:41 AM
Friedrich,

Thank very much - you've given me enough to chew on <g>.

Geoff

NewsArchive
01-30-2006, 11:08 AM
Friedrich,

>> 3. I'm looking for a way of adding shortcuts to the windows start menu -
>> based on whether the program exists or not. IOW - loop through the files
>> in the (e.g. _SB_INSTALLDIR\bin) and place a link for each EXE that's
>> installed. The clarion equivalent would look something like:
>>
>> directory(filesq, _SB_INSTALLDIR & '\bin\*.exe',)
>> loop Counter = 1 to records(filesq)
>> get(filesq,Counter)
>> do AddShortCutToStartMenu
>> end
>>
>> Anyway of doing that?
>
> Yes, this would be possible,
Any chance of a pointer or two? I've look through all the Script functions
and can't seem to figure a way of doing this (i.e. of looping through exes
and figuring out what shortcuts to create from a simple loop.

Thanks
--
Geoff

Capesoft - taking you higher and further

www.capesoft.com

NewsArchive
01-30-2006, 11:08 AM
Geoff,

Would it be cool to directly use native Clarion code in SB5 to handle this
<g>

If you are interested, I can send you (or post) the source code to handle
this.

Friedrich

--
Friedrich Linder
CEO, Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 5

NewsArchive
01-30-2006, 11:11 AM
Geoff,

I have created a simple demo for you.

We have two Clarion functions:

! -----------------------------------------------------------------------------

1. LoadDirectory - Pass a folder from the installer to the function and load
all .exe files located in the \Bin subfolder. Return the number of items to
the installer.

! Call Function
LOADDIRECTORY FUNCTION(SB_INSTALLDIR)
SearchFor CSTRING(260)
CODE
SearchFolder = SB_INSTALLDIR
SearchFor = SearchFolder & '\bin\*.exe'
DIRECTORY(FilesQ, SearchFor,0)

! Return found items to installer
RETURN RECORDS(filesq)

2. GetItem - Pass item number from the installer to the function and
retrieve a specific item from the QUEUE.

! Call Function
GETITEM FUNCTION(ItemNo, ItemResult)
CODE

GET(FilesQ, ItemNo)
IF ERRORCODE() THEN RETURN 0.

ItemResult = CLIP(SearchFolder) & '\' & CLIP(FilesQ:name)

! Return to installer
RETURN 1
! -----------------------------------------------------------------------------

Then we can call the above functions from the installer script:

! Load Library
Set Variable %DLLHANDLE% to ScriptItem->Load DLL("%TMPDIR%\sbdll3.dll")

! Set variable value
Set Variable %_SB_INSTALLDIR% to c:\5

! Call into 3rd party DLL (developed with Clarion 6)
Call DLL "%DLLHANDLE%" -- Function "LOADDIRECTORY" (*CSTRING)
(%_SB_INSTALLDIR%)

! %ITEMNO% includes number of items
Set Variable %ITEMNO% to %_SB_RETURN%

! Initialize %ITEMNAME%
Set Variable %ITEMNAME% to ""
If %ITEMNO% Greater Than "0" Then

Set Variable %GETITEMNO% to 0
Loop (%ITEMNO% Times)

Set Variable %GETITEMNO% to (Increment Variable by 1)
Call DLL "%DLLHANDLE%" -- Function "GETITEM" (LONG,*CSTRING)
(%GETITEMNO%,%ITEMNAME%)
! Handle action
Display Message Box "Item Number: %GETITEMNO%\n\nDo this and that with
...." -- ""
EndEnd

! Free Library
Free DLL "%DLLHANDLE%"
! -----------------------------------------------------------------------------

I have attached the dll source code and the installer script.

1. Unzip "sbdll3.zip" and compile the code.
2. Copy the resulting sbdll3.dll into your SetupBuilder 5 \Lib folder
3. Unzip "Call Dll Demo 3.zip" and open "Call Dll Demo 3.sb5"
4. Set the "search in" variable value in the following line:

Set Variable "%_SB_INSTALLDIR% to c:\5"

5. Compile and run the script.

What do you think?

Friedrich

Friedrich Linder
CEO, Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 5

NewsArchive
01-30-2006, 11:14 AM
Friedrich,

Thanks for checking. This would be my plan B - and it looks like (according
to your other answer) - that plan A is possible <g>.

--
Geoff

Capesoft - taking you higher and further

www.capesoft.com

NewsArchive
02-03-2006, 05:04 AM
Friedrich,

Wow thanks - I'll give it a spin tonight.

--
Geoff

Capesoft - taking you higher and further

www.capesoft.com

NewsArchive
02-03-2006, 05:04 AM
Friedrich,

This is really the max!!!!! This has opened up some serious possibilities!!!
Thanks a ton. I did some playing last night, and have started putting some
more functionality into the DLL. This has helped big time, thanks a ton.

I've basically scratched everything off the list - except for modding the
path (which I haven't looked into yet, but should be pretty standard), and
then I'm sorted.

Thanks a ton.

--
Geoff

Capesoft - taking you higher and further (with SetupBuilder 5 <g>)

www.capesoft.com

NewsArchive
02-03-2006, 08:49 AM
Friedrich,

OK - I've fallen over my feet again (I think <g>). I can't quite figure out
the Drop Target (CLSID) - maybe you can shed some light.

Basically I want to add something to the path statement (on startup) like:

path = %path% & ';d:\Clarion6\3rdparty\bin'

I've found the Add app path command, but I'm not quite sure what I need the
DropTarget for. Do I need to create that in the registry - otherwise would I
need to look it up? I'm also not quite sure why I need a filename (it
complains if I don't have one). Can you clarify this one? I guess I must be
missing something obvious :(

It doesn't seem to work without the DropTarget - so I guess that's not
optional.

Thanks for the assistance.

--
Geoff

Capesoft - taking you higher and further

www.capesoft.com

NewsArchive
02-03-2006, 08:50 AM
Geoff,

I think what you are trying to do is to add the path (if it does not already
exist) to the PATH environment variable, right?

I would suggest to use the "Edit Environment Variable..." function. For
example:

Edit Environment Variable PATH = d:\Clarion6\3rdparty\bin

Does this help?

Friedrich

--
Friedrich Linder
CEO, Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 5

NewsArchive
02-06-2006, 09:05 AM
Friedrich,

Yip - that looks like the one!! I missed it in my first look through. I
guess you may have this in your examples somewhere.

--
Geoff

Capesoft - taking you higher and further

www.capesoft.com

NewsArchive
02-06-2006, 09:05 AM
Geoff,

Thank you. I'll add a note to the documentation.

Friedrich

--
Friedrich Linder
CEO, Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 5

NewsArchive
02-10-2006, 09:03 AM
Another one - I can't seem to add concatenate 2 compiler strings together.

#Set var [MyVarA] to [MyVar1][MyVar2]

ends up as

Whatever[MyVar2]

Is there a trick to doing this<g>?

--
Geoff

Capesoft - taking you higher and further

www.capesoft.com

NewsArchive
02-10-2006, 09:03 AM
Geoff,

Hmm, I cannot reproduce this here :-(

I tried the following and it worked fine:

#set compiler variable [TEST] = "[PRODUCTGUID][PRODUCTNAME]"
Set Variable %TEST% to "[TEST]"
Display Message Box "%TEST%" -- ""

I also tried:

Set Variable %TEST% to "[PRODUCTGUID][PRODUCTNAME]"
Display Message Box "%TEST%" -- ""

Would it be possible for you to send me a small demo script?

Thanks,
Friedrich

--
Friedrich Linder
CEO, Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 5