Page 1 of 2

Scripting tab

Posted: Fri Feb 04, 2022 7:07 am
by dsquance
How does one write a script to effect the pressing of the tab key? The dictionary seems to indicate it can't be done, but there must be some workaround.
Thanks,
Dave

Re: Scripting tab

Posted: Fri Feb 04, 2022 8:57 am
by stam
I think maybe separating the code that does the action you expect into a separate handler, then you can call it in code as well as trap the tab key on rawKeyDown...

Re: Scripting tab

Posted: Fri Feb 04, 2022 9:05 am
by richmond62
How about seeing if the TAB key will give you a rawKey signal?

Re: Scripting tab

Posted: Fri Feb 04, 2022 11:05 am
by Klaus
Hi Dave,

this is what you are looking for:

Code: Select all

...
## do this
## do that
type TAB
...
:D

Best

Klaus

Re: Scripting tab

Posted: Fri Feb 04, 2022 3:01 pm
by dunbarx
What Klaus said, I think.

How and why do you need to, as you say, "press" the tab key? To insert it (ASCII 9) in a string? To invoke some keyboard combination? To have that key invoke some process?

Craig

Re: Scripting tab

Posted: Fri Feb 04, 2022 3:42 pm
by dunbarx
Richmond.
How about seeing if the TAB key will give you a rawKey signal?
Sure, "65289"

All keys give return a value, except for "capsLock", "Shift", "Control", "Option", "Command" and "fn".

Craig

Re: Scripting tab

Posted: Fri Feb 04, 2022 5:50 pm
by richmond62
Sure, "65289"
I knew that, but I have a feeling that getting newbies to do the odd thing by themselves
rather than too much spoon feeding might be pedagogically not such a bad idea.
The dictionary seems to indicate it can't be done
-
SShot 2022-02-04 at 18.51.05.png

Re: Scripting tab

Posted: Fri Feb 04, 2022 6:12 pm
by dunbarx
Be careful.

Jacque might get on your case as she has done on mine. Whatever you, do not call it "homework".

Craig

Re: Scripting tab

Posted: Fri Feb 04, 2022 6:23 pm
by richmond62
Be careful.
Never knowingly done that before. :D

Re: Scripting tab

Posted: Fri Feb 04, 2022 6:31 pm
by andresdt
dsquance wrote:
Fri Feb 04, 2022 7:07 am
How does one write a script to effect the pressing of the tab key? The dictionary seems to indicate it can't be done, but there must be some workaround.
Thanks,
Dave
Hi @dsquance
Look this up in the "tabKey" dictionary

Isn't that what you mean?

taken from the LC dictionary

Code: Select all

on tabKey -- go forward in stack on tab, backward on shift-tab
  if the shiftKey is down then go previous card
  else go next card
end tabKey

Re: Scripting tab

Posted: Fri Feb 04, 2022 6:53 pm
by richmond62
Wait a moment:
How does one write a script to effect the pressing of the tab key?
does not want a tabKey thing,
probably more like this:
-
SShot 2022-02-04 at 19.50.28.png
-
And while Craig may be smirking at trapping me into stating that the Unicode for TAB is 65289 I went to the trouble of
checking that, and 65289 is some sort of parenthesis, while the Unicode for TAB is simply '9'.

And while I am here perhaps I should point out that my 'TAB' is not amused and has stumped off to do some yoga:
-
puss.jpeg

Re: Scripting tab

Posted: Fri Feb 04, 2022 7:05 pm
by stam
I took it to mean that <tab> in this case would trigger an action (which could be to insert a tab character or could be something else), and that the OP wanted to trigger this without hitting the tab key - hence i suggested splitting the action into a separate handler that could be called in code and can also be linked to the tab key being pressed (ie sent from on tabKey or on rawKeyDown).
I guess the OP needs to provide a bit more clarity...

Re: Scripting tab

Posted: Fri Feb 04, 2022 7:08 pm
by richmond62
I guess the OP needs to provide a bit more clarity.
You are quite right.

Re: Scripting tab

Posted: Fri Feb 04, 2022 8:50 pm
by dunbarx
And while Craig may be smirking at trapping me into stating that the Unicode for TAB is 65289 I went to the trouble of
checking that, and 65289 is some sort of parenthesis, while the Unicode for TAB is simply '9'.
How did you know I was smirking?

The ASCII value for "tab" is 9. The value returned for tab via "RawKeyWhatever" is 65289. Tab does not return a value, ASCII or whatever, for "keyDown".

I do not think unicode enters into any of this.

Craig

Re: Scripting tab

Posted: Fri Feb 04, 2022 10:12 pm
by dsquance
I guess I needed to be specific. I want a tab action, not a tab in the sense of spacing. My intention is to allow text entry from a screen "keyboard" by clicking on a letter which puts the letter into a field and then the cursor should move to the next field as it would if the tab key were pressed.

But thanks to all who have weighed in.
Dave