QSEND inter-job signaling system

Anything QL Software or Programming Related.
User avatar
bwinkel67
Gold Card
Posts: 498
Joined: Thu Oct 03, 2019 2:09 am

QSEND inter-job signaling system

Postby bwinkel67 » Mon Aug 10, 2020 10:26 am

Anyone ever use this utility? I gave it a try and can't get it to work. It has commands for finding a job's channel and then sending text to its input channel.

I'd love to send some text from SuperBASIC to an application but keep it as simple as possible.

I can successfully do it within the windows in QDOS, i.e. I can say:

e=qsend(0,"hello")
report e

This basically puts the text "hello" into the input buffer (windw #0) waiting for you to hit return.

You are also supposed to be able to get a channel number of any running job so you can do this (where 1 is the job number of the application gotten from jobs command in tk2):

q=keyq(1)
e=qsend(q,"hello")
report e

This does not work. Is it dependent on how the job was written maybe -- i.e. on how it opened its windows...perhaps wanting the console window?


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

Re: QSEND inter-job signaling system

Postby tofro » Mon Aug 10, 2020 10:49 am

Turbo Toolkit has a "TYPE_IN" command that can put characters into the input queue of the current foreground job. That's probably the easiest way to remote control other applications.

In order to make another job the current foreground job, you either have to make it the last one EXECed (that is, start it), or use the PICK command from QPTR (or alikes) to pull the other job to the foreground. Without PE, I don't see a simple way to make another arbitrary job the current job.

Note with PE and no PE_BGON activated, your controlling job may not do any screen output, as otherwise it will be suspended by PE, as it doesn't own the screen after your controlled job has been picked - This is a pitfall you might have fallen in with QSEND.

You didn't write on what system (i.e. with or without PE) you're trying this - approaches and pitfalls are different based on PE or no PE.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
bwinkel67
Gold Card
Posts: 498
Joined: Thu Oct 03, 2019 2:09 am

Re: QSEND inter-job signaling system

Postby bwinkel67 » Mon Aug 10, 2020 11:24 am

tofro wrote:Turbo Toolkit has a "TYPE_IN" command that can put characters into the input queue of the current foreground job. That's probably the easiest way to remote control other applications.

In order to make another job the current foreground job, you either have to make it the last one EXECed (that is, start it), or use the PICK command from QPTR (or alikes) to pull the other job to the foreground. Without PE, I don't see a simple way to make another arbitrary job the current job.

Note with PE and no PE_BGON activated, your controlling job may not do any screen output, as otherwise it will be suspended by PE, as it doesn't own the screen after your controlled job has been picked - This is a pitfall you might have fallen in with QSEND.

You didn't write on what system (i.e. with or without PE) you're trying this - approaches and pitfalls are different based on PE or no PE.


Thank you, TYPE_IN works perfectly. It was for a none PE problem.

On a side note, how do you do string concatenation in SuperBASIC? It's different from what I thought (i.e. a$= "a" + "b" didn't work).


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

Re: QSEND inter-job signaling system

Postby tofro » Mon Aug 10, 2020 11:35 am

bwinkel67 wrote:
On a side note, how do you do string concatenation in SuperBASIC? It's different from what I thought (i.e. a$= "a" + "b" didn't work).


it's

Code: Select all

cat$ = a$ & b$


Where the "summands" may be either string or numeric variables. (If a summand is numeric, SuperBASIC will automatically convert it to a string)


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO

Who is online

Users browsing this forum: Derek_Stewart and 7 guests