21 October 2021, 23:04 | #1 |
Registered User
Join Date: Sep 2021
Location: Norway
Posts: 20
|
Possible to detect if program is run in editor?
Hi
I wonder if there is any way to detect if the program is running in the editor or started from WB or CLI? Cheers. |
22 October 2021, 07:50 | #2 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,214
|
Huh? What do you mean "running in the editor"? What is "the editor", and how can an editor run a program?
AmigaOs "only" has two execution environments, the shell and the workbench. |
22 October 2021, 08:41 | #3 |
Registered User
Join Date: Nov 2015
Location: Italy
Posts: 191
|
Guess: This is Blitz Basic Forum, so he means running/starting it from/in Blitz Basic editor, similiar to how you can run/start Amiga Basic programs from the editor or Pascal programs from Hispeed Pascal editor.
|
22 October 2021, 08:49 | #4 | |
Registered User
Join Date: Sep 2021
Location: Norway
Posts: 20
|
Quote:
I want to be able to detect in code whether the program was run from the editor or if it's a compiled program started from either WB or CLI. This way I can i.e show some debug info, allow certain keypresses/cheats etc. while developing. The ideal would be a preprocessor directive which only includes and executes a code segment if it's compiled/ran from within the Blitz Basic editor. When you compile those segments are not included in the build. This is a common feature of most development environments. Example #IF EDITOR ; some code which is only compiled and executed while in the editor #ENDIF Last edited by zooperdan; 22 October 2021 at 08:58. |
|
22 October 2021, 10:14 | #5 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
Blitz and its variants allow you to compile code directly from the IDE into RAM and run it there with various debugging and monitoring options. There's no executable file involved in this process, and effectively it's running "from the editor" instead of from Workbench or the shell. This is typically done to test a program during development, with compiling to an executable file done later once it's nearly ready.
To answer the OP, yes there is. It's a function called FromBlitz and will return true if run from the Blitz IDE and false otherwise. It's not a core Blitz function however, it's in the RIMiscLib command library. This is included with most distributions of Blitz however, so chances are you already have it installed. If Blitz doesn't recognise the keyword FromBlitz, have a look at updating the installation to a more complete version. Edit: I can't think of any way to do automatic conditional compiling based on whether it has been run from the editor or not. You could manually control it using a constant: Code:
#debug = True CNIF #debug NPrint "This is a debug build" CEND Last edited by Daedalus; 22 October 2021 at 10:27. |
22 October 2021, 10:30 | #6 | |
Registered User
Join Date: Sep 2021
Location: Norway
Posts: 20
|
Quote:
|
|
22 October 2021, 10:33 | #7 | |
Registered User
Join Date: Sep 2021
Location: Norway
Posts: 20
|
Quote:
|
|
22 October 2021, 10:40 | #8 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
Cool, that's the method I use and it works well for me. Enjoy
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
run a program from within another | meynaf | Coders. System | 22 | 13 August 2018 08:59 |
ClassicWB: How to run a program at startup? | Foebane | support.Apps | 20 | 05 March 2018 09:54 |
Run AREXX program from PC side? | MickGyver | support.WinUAE | 5 | 15 March 2017 10:05 |
Possible to run a program from CLI in background? | VoltureX | support.Apps | 17 | 14 January 2012 03:16 |
Cant run AnimatED....anyone every used this great program? | mrbob2 | support.Apps | 2 | 20 June 2009 13:13 |
|
|