Community

SCI Programming => SCI Syntax Help => Topic started by: Doan Sephim on March 23, 2007, 12:54:47 PM

Title: Pre-programmed keyboard prompts
Post by: Doan Sephim on March 23, 2007, 12:54:47 PM
I have been trying without success to add a couple menubar options similar to the "retype" function but with "common phrases" ("ask about" and "tell about")...

In trying to do this I thought I would look at the retype function and adjust it a little, but it proves to be more complex than I first thought, at least for me ;)

the retype code:
Code: [Select]
(case MENU_RETYPE
  (send pEvent:
     claimed(FALSE)
     type(evKEYBOARD)
     message( (User:echo) )
  )
)

I thought it would simply be putting "ask about" in the place of (User:echo), but it turns out that that was an oversimplification. I looked through the User Script to see how the User:echo function worked, but I must confess it confused me even more.

So, any ideas?
Title: Re: Pre-programmed keyboard prompts
Post by: lskovlun on March 23, 2007, 03:58:56 PM
The inputLineAddr selector is what you're looking for. Use it like so:

StrCpy((User:inputLineAddr) "ask about")

The rest of the code should be similar to what you posted.

Lars
Title: Re: Pre-programmed keyboard prompts
Post by: Doan Sephim on March 23, 2007, 04:50:54 PM
Thanks Iskovlum! It took me a while to figure out how it all worked. I wasn't entirely sure where to put the code or even what exactly it did, but I noticed when I ran the StrCpy((User:inputLineAddr) "ask about") it did not bring up the prompt...but then I checked my "retype" button and it prompted "ask about" even though I did not type it.

So then I figured out that the code you were suggesting (if I have this right) is to use the exact same code as the "retype" except that before you run it, you change the the contents of the last input to "ask about" and then it "retypes" that phrase instead!

It looked like this:
Code: [Select]
(case MENU_RETYPE
  StrCpy((User:inputLineAddr) "ask about")
  (send pEvent:
     claimed(FALSE)
     type(evKEYBOARD)
     message( (User:echo) )
  )
)
Thanks again!