Other B4J detecting standalone situation

jjveloso

Member
Licensed User
Longtime User
Hello.
I would like to know if there's a way my progran knows, while running, if it is running under the IDE environment or under a stand alone situation.
While I try to develop the program,, I feequently test it under those two situations (IDE and standalone) as the paths are not exactly the same I have to move and change things each time (the "temp" folder is created everytime).
Is there anyway to detect the environment (to look for the right folder in the right situation)

Thanks for your help and advise
 

aeric

Expert
Licensed User
Longtime User
Maybe what you are looking for is the Conditional Compilation symbol.
i.e
B4X:
#If Debug
    'Run only during debug in IDE
#End If

#If Release
   'Execute after program compiled as production release
#End If


By the way, you should ask B4J related question in the correct forum.
 
Last edited:
Upvote 0

aeric

Expert
Licensed User
Longtime User
And it's good to read that thread, otherwise you might think that you can only use DEBUG and RELEASE, instead you can create your own "symbols" (keywords).
Of course, I also use it for creating beta version (with different package name) or switching between database type.
1720122559827-png.155196

The above screenshot is from my Support Ticketing System.
 
Upvote 0

jkhazraji

Active Member
Licensed User
Longtime User
Hello.
I would like to know if there's a way my progran knows, while running, if it is running under the IDE environment or under a stand alone situation.
While I try to develop the program,, I feequently test it under those two situations (IDE and standalone) as the paths are not exactly the same I have to move and change things each time (the "temp" folder is created everytime).
Is there anyway to detect the environment (to look for the right folder in the right situation)

Thanks for your help and advise
B4X:
i.e.,
#If DEBUG
    log("I am running under IDE")
#End if

#If RELEASE
    xui.MsgboxAsync("I am in release mode!", "B4X")
#end if
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
B4X:
i.e.,
#If DEBUG
    log("I am running under IDE")
#End if

#If RELEASE
    xui.MsgboxAsync("I am in release mode!", "B4X")
#end if
In his case, DEBUG and RELEASE are not enough.
He wants to know if the compiled version is running with the IDE open or not (stand-alone), that's why he will need custom "symbols".

BTW, you can also write:
B4X:
#IF DEBUG
#ELSE 'IF ...
#END IF
 
Upvote 0

jkhazraji

Active Member
Licensed User
Longtime User
or:


In his case, DEBUG and RELEASE are not enough.
He wants to know if the compiled version is running with the IDE open or not (stand-alone), that's why he will need custom "symbols".

BTW, you can also write:
B4X:
#IF DEBUG
#ELSE 'IF ...
#END IF
By all means the compiled version will ignore DEBUG and vice versa
 
Upvote 0

Alex_197

Well-Known Member
Licensed User
Longtime User
Try this
B4X:
Sub AppStart (Args() As String)
    
    If Args.Length>0 Then
        Params=Args(0)
        File.WriteString(File.DirApp,"Test.txt",Args(0))
        
    Else
        File.WriteString(File.DirApp,"Test.txt","Empty")
        Return
    End If

End Sub

And execute your B4J app like this MyApp.Jar YourArgumentsStr
 
Upvote 0

jjveloso

Member
Licensed User
Longtime User
Hello again
I Tryed


Sub AppStart (Form1 As Form, Args() As String)
Dim IDEon As Boolean
IDEon= False

#If DEBUG
Log("I am running under Debug IDE")
IDEon= True
#ELSE
#if RELEASE
Log("I am running under Relelease IDE")
IDEon= True
#End If
#End if

Log("IDEon:"& IDEon)[/CODE]

Unsuccesfully

When in standalone, it detects the environment as RELEASE

I'll continue searching
 
Upvote 0

jkhazraji

Active Member
Licensed User
Longtime User
Hello again
I Tryed


Sub AppStart (Form1 As Form, Args() As String)
Dim IDEon As Boolean
IDEon= False

#If DEBUG
Log("I am running under Debug IDE")
IDEon= True
#ELSE
#if RELEASE
Log("I am running under Relelease IDE")
IDEon= True
#End If
#End if

Log("IDEon:"& IDEon)[/CODE]

Unsuccesfully

When in standalone, it detects the environment as RELEASE

I'll continue searching
Try:
B4X:
Dim r As Reflector
        Dim debugMode As Object = r.GetStaticField("anywheresoftware.b4a.BA", "debugMode")
    Log(debugMode)
 
Upvote 0
Top