PDA

View Full Version : Do you know: How to detect if a script is bundled



ReneMiner
05-09-2015, 12:14
Currently I have only one solution to find out from within code if it runs as tBasic-Script or bundled standalone-executeable:

In case it's an executeable, thinCore-function App_Scriptname / App_Sourcename will return an empty string. :)






' ----------------------------------------------------------
Function App_IsBundledExe() As Boolean
' returns TRUE if this program is an .exe

Function = ( APP_ScriptName = "" )

End Function

' ----------------------------------------------------------
Function App_Title() As String
' returns the name of this program

Function = IIf$( APP_ScriptName = "" , APP_Name, APP_ScriptName )

End Function
' ----------------------------------------------------------

'test:

If App_IsBundledExe Then
MsgBox(0, "this is bundled version running " & $CRLF & APP_Title )
Else
MsgBox(0, "this is script-version running " & $CRLF & APP_Title )
EndIf

ErosOlmi
05-09-2015, 12:51
:oops:

I think that is a bug. They should return the correct name even if it is bundled. I will fix it.
I will try to add a new App_ function able to return current running mode: open source code, obfuscated souce code, bundled executable code.

ReneMiner
05-09-2015, 12:59
too bad, i thought i've found a huge bag of wisdom... :D:D:D

So you might delete this "Do you know..." and move the content to your to-do-list or support ;)

ErosOlmi
15-09-2015, 17:08
I've fixed this problem and developed 3 more functions.

APP_IsBundled will return %TRUE/%FALSE if current script is executed from a bundled executable
APP_IsIsolated will return %TRUE/%FALSE if current script is executed from a bundled executable and execution is taking place from an isolation path (currently always %TRUE but not sure for future option, maybe in future versions execution will take place 100% from memory and not from disk)
APP_IsolationPath will return the full path where a bundled executable export bundled modules / dlls


APP_Name function is now aware if script is executed from source code or from bundled executable
APP_ScriptFullName function is now aware if script is executed from source code or from bundled executable

Very shortly a 1.9.16 version to test.