[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: in or out IDE


You can use Application.Path to see if it is run from the project folder or
somewhere else. Also you can put ".IDE" named file there, which is not
included into the executable and check if it is there.


Jussi

On Thu, Oct 1, 2026 at 9:47 PM Bruce Steers <bsteers4@xxxxxxxxx> wrote:

>
>
> On Thu, 1 Oct 2026 at 15:38, Bruce Steers <bsteers4@xxxxxxxxx> wrote:
>
>>
>>
>> On Thu, 1 Oct 2026 at 15:19, Philippe Valarcher <
>> philippe.valarcher@xxxxxxx> wrote:
>>
>>> Le jeudi 01 octobre 2026 à 14:52 +0100, Bruce Steers a écrit :
>>>
>>> Try this...
>>>
>>> #If Exec
>>> Print "run from the executable"
>>> #Else
>>> Print "Run from IDE"
>>> #Endif
>>>
>>> Read here...
>>> https://gambasgb.uk/phpBB/viewtopic.php?t=22
>>>
>>> Respects
>>> BruceS
>>>
>>>
>>> On Thu, 1 Oct 2026 at 11:12, valaquarus <valaquarus@xxxxxxxxx> wrote:
>>>
>>> How can you tell if you're launching a program from within the IDE or
>>> outside of it?
>>>
>>>
>>> Thank you Bruce that's nearly what I did and it makes it real good.
>>>
>>> --
>>>
>>> Philippe Valarcher <philippe.valarcher@xxxxxxx>
>>>
>>
>> You're welcome.
>>
>> It's not completely 100% bullet-proof but works in most cases.
>>
>> For example if i was to start a program with gbx3 on the folder and not
>> run the compiled executable...
>> Eg.
>> $ gbx3 /path/to/program/folder
>>
>> then the Exec pre-processor constant will not be set but we are also not
>> using the IDE.
>>
>> It would be more useful i think if the IDE could also set a Flag/Env of
>> some sort, a more definitive indicator of an IDE test run as opposed to
>> launching the executable.
>> Perhaps if Benoit could give us something more reliable like a
>> pre-processor constant called IDE,
>> #if IDE Then
>>
>> Respects
>> BruceS
>>
>
> Actually this is a bit more robust...
>
> Public Debugging As Boolean
>
> Public Sub Form_Open()
> #If ( Not Exec )
>  #If Debug
>   Debugging = True
>  #Endif
> #Endif
>
> End
>
> that way we are also checking the Debug constant (set by running via the
> IDE)
> and the Exec constant set when running the executable.
>
>

Follow-Ups:
Re: in or out IDEJussi Lahtinen <jussi.lahtinen@xxxxxxxxx>
References:
in or out IDEvalaquarus <valaquarus@xxxxxxxxx>
Re: in or out IDEBruce Steers <bsteers4@xxxxxxxxx>
Re: in or out IDEPhilippe Valarcher <philippe.valarcher@xxxxxxx>
Re: in or out IDEBruce Steers <bsteers4@xxxxxxxxx>
Re: in or out IDEBruce Steers <bsteers4@xxxxxxxxx>