PDA

View Full Version : Dealing with ThinBasic versions



chameau
24-12-2020, 01:55
Hello

Is there a function returning the version of ThinBasic ? :confused:

The need is to be able to control the execution of a script that can be executed on machines with a different version of thinbasic.

The behavior of certain functions being different according to the version, I would like to be able to take it into account in the script.

Thanks for help. :friends: (ooops : too close for Covid time ......)


François

Petr Schreiber
24-12-2020, 12:37
Hi François,

I think you could achieve what you need like this:


uses "exe"

String version = EXE_GetVersionString(app_path + APP_Name) ' -- Retrieves the version of thinBasic executable



Petr

chameau
30-12-2020, 01:54
Hi François,

I think you could achieve what you need like this:


uses "exe"

String version = EXE_GetVersionString(app_path + APP_Name) ' -- Retrieves the version of thinBasic executable



Petr

Hi Petr,

Thanks for your reply.
Unfortunately your example doesn't work with bundled scripts where the
EXE_GetVersionString returns the version set by the
#BUNDLE Version "FileVersion" directive, and if it is not set "0.0.0.0" .

But hopefully this example leaded me to examine "APP_xxxx" functions.
I there found a workaround with
APP_IsolationPath and extracting version of "thincore.dll"


Here the script I tried

'Trying to find version of thinbasic running

Uses "Console" , "exe"

#BUNDLE Version "FileVersion" , "1.2.3.45"

Dim bundled_script as word
Dim isolated_script as word
DIM version_x as String
dim program as string
dim isol_path as string
dim isol_interp as string

bundled_script = APP_IsBundled
isolated_script = APP_Isisolated

PrintL
PrintL "running" , bundled_script , iif$(bundled_script , " bundled" ," interpreted" ) in 15
PrintL "running" , isolated_script , iif$(isolated_script , " isolated" ," NOT isolated" ) in 15

program = (app_path + APP_Name)
PrintL "Program = " , program

version_x = EXE_GetVersionString ( program ) ' - - Retrieves the version of thinBasic executable
PrintL "Version = " , version_x
PrintL

printl
isol_path = APP_IsolationPath
printl "APP_IsolationPath", isol_path

isol_interp = isol_path & "thincore.dll"
printl " Version of " & isol_interp
printl $tab,$tab , EXE_GetVersionString ( isol_interp )


print "waiting " at 25,24
WaitKey


As you can see in interpreted test the APP_Isolation path is empty and version of thincore is returned.

Included view of results.10244

Regards

François

Petr Schreiber
31-12-2020, 15:06
Thank you for sharing the working solution :drink:


Petr

chameau
31-12-2020, 20:45
Thank you for sharing the working solution :drink:


Petr

Hi Petr,

Dont you think that a TB function returning directly this info could be implemented.

Not for the 4 hours remaining in this year :D

But in a future version ?

And now the wishes ar not "Happy new year." but "I wish you a better year."


Best wishes.

François

Petr Schreiber
31-12-2020, 20:50
Exactly the idea I got reading your question :)

I put it on the list and will discuss with Eros :drink:


All the best for 2021!,
Petr