Executing SBASIC programs from hotkeys

Anything QL Software or Programming Related.
Post Reply
User avatar
dilwyn
Mr QL
Posts: 2761
Joined: Wed Dec 01, 2010 10:39 pm

Executing SBASIC programs from hotkeys

Post by dilwyn »

Hopefully, this is nothing more than my forgetfulness...

I want to set up a hotkey to execute an SBASIC program. Obviously I can do something like this with HOT_CMD to send a command to SBASIC to issue an EX win1_sbasicprogname_bas command to BASIC.

ERT HOT_CMD("s","EX sbasicprogname_bas")

Which works OK, but I couldn't get program starting commands like HOT_LOAD to do this - ERT HOT_LOAD("s","win1_sbasicprogname_bas") just grunts and fails to start the program when I try to use it.

Am I missing something obvious here, or is this not possible? Maybe it has to do with who owns the SBASIC job - that it has to be started from the main SBASIC?


User avatar
tofro
Font of All Knowledge
Posts: 2702
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Executing SBASIC programs from hotkeys

Post by tofro »

dilwyn wrote: Thu Jun 15, 2023 1:59 pm Hopefully, this is nothing more than my forgetfulness...

I want to set up a hotkey to execute an SBASIC program. Obviously I can do something like this with HOT_CMD to send a command to SBASIC to issue an EX win1_sbasicprogname_bas command to BASIC.

ERT HOT_CMD("s","EX sbasicprogname_bas")

Which works OK, but I couldn't get program starting commands like HOT_LOAD to do this - ERT HOT_LOAD("s","win1_sbasicprogname_bas") just grunts and fails to start the program when I try to use it.

Am I missing something obvious here, or is this not possible? Maybe it has to do with who owns the SBASIC job - that it has to be started from the main SBASIC?
Dilwyn,

even if the command name may suggest HOT_LOAD has anything to do with "LOAD" - It hasn't. HOT_LOAD belongs into the league of HOT_CHP and can only load and start executable programs. And, even if you can EXEC them, SBASIC programs just aren't.....

You can start SBASIC programs using HOT_CMD, but that simply pushes your command string to the current SBASIC input line - If that SBASIC interpreter is not idle atm, it won't work..

Thankfully, there is the SBASIC thing that can be employed:

Code: Select all

ERT HOT_THING ("<key>","SBASIC";"<command string>", "<job name")
Will start a new SBASIC interpreter and execute the command string in there - And thus should do what you want. <command string> can obviously contain DO or LRUN statements so you can execute large SBASIC programs. The program should contain a "QUIT" statement, otherwise you'd have got lots of interpreters lurking in the background after some time.
Last edited by tofro on Thu Jun 15, 2023 3:27 pm, edited 2 times in total.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Derek_Stewart
Font of All Knowledge
Posts: 3975
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: Executing SBASIC programs from hotkeys

Post by Derek_Stewart »

Hi Dilwyn,

Try:

ERT HOT_THING('s',"SBASIC";"LRUN 'sbasicprogname_bas"")

Should load SBASIC and put the LRUN statement into the SBASIC channel #0

But, too late... Torfro beat me
Last edited by Derek_Stewart on Thu Jun 15, 2023 3:41 pm, edited 2 times in total.


Regards,

Derek
User avatar
dilwyn
Mr QL
Posts: 2761
Joined: Wed Dec 01, 2010 10:39 pm

Re: Executing SBASIC programs from hotkeys

Post by dilwyn »

Great, thanks guys. I'd forgotten about the sbasic thing. Will give it a go shortly.


Post Reply