PDA

View Full Version : A few scripting questions



irix
10-15-2009, 11:08 AM
I came across a few unwanted things which may have a simple solution, but I didn't find them yet:

1: I want to add a timed page which returns to the main menu, but only if there is no activity for a certain amount of time, let's say one minute.
So: if nothing happens for one minute jump back to page 1. As soon as something happens like a button press the timer should restart at 0.
With the normal on preload / on timer jump page it just counts one minute and goes back.

2: Can I add a button which sends the TAB button? Like the Enter button is \r, is there also a code for TAB?

3: Can I make a button which sends it result (in this case just one letter per button, as in on-screen keyboard) to a web page in stead of to a input field. I already tried replacing "Input1" to "Web1" but it doesn't work.

Thanks again!

longedge
10-15-2009, 02:27 PM
Just a couple of thoughts -

1. Create a global function and call it in all the events that you want to be a valid cancellation of the timer. Alternatively just put code to reset the timer/counter in the page "On Mouse Move" event.

2. Nothing springs immediately to mind except using "sendkey" but I've never tried it.

3. Concatenate to a string on each button click and in the same code overwrite the contents of the html page being displayed by the web object, probably use the refresh tag in the header of the html to constantly refresh the page.

irix
10-15-2009, 02:49 PM
I'll try the first two, maybe for 3 a fill in form that mails is good too.
I tried it but I only see this mail function which tries to mail through Outlook (express)/Windows Mail. This is fine with me as long as it sends the email without the user noticing it.
The plan is to have a form that can be filled in with the onscreen keyboard I made and after clicking SEND it should send the form's contents through email.
I thought a local webpage was the easiest option, but I think if it's so difficult a APMS form will do as good or better, as long as I have an email option which is not seen by the user.

longedge
10-15-2009, 03:32 PM
I was thinking that we were talking about a local html file, if the web object being displayed is from the web then I would think you are going to have problems trying to implement what is more or less real time updating of a web page from your app - nothing ventured as the saying goes :)

p.s. - Just having read your other post, it sounds to me as if you'd be better off designing your web page with an inline form which can be submitted directly from the page.

Scriptonite
10-15-2009, 06:21 PM
Here is a quick example project of everything but the web functions. I didn't have a lot of time to work on this so it's a bit disorganized.

Do you have PHP support on your server? If so I can probably make you an example that will update input to a php page.

irix
10-15-2009, 06:57 PM
The mouse thing is great, thanks. I already tried something like it but never thought about restarting the timer afterwards, so this will help.

About the tab key, it was supposed to be a virtual key in order to tab through the mailform, but, if possible it would be nicer to have an email script within AMS itself, so I'm looking at the smtp plugin now (only thing is I can't download it because it says server error). I already have the virtual keyboard ready and it puts the letters into Input1 correctly.
Only thing is it doesn't show enters, I have this script in the virtual enter key (remember: this will be used on a touchscreen, so no keyboard is available)



Input.SetText("Input1", Input.GetText("Input1").."\r")


Eventually the \r does work in the result of this page (underneath the Input1 field is a send button which collects data from Input1, puts it in a dialogbox (and it should email too, but I guess I can get this working with the smtp plugin) and clears the form).
So \r gives enters in the result, but not on screen.
Input1 has the multiple line function on and when I type with a real keyboard it does show the enters.
I also like to have a backspace key in it, to correct errors.
I think this is the last issue for now ;)

IdeasVacuum
10-15-2009, 08:17 PM
Try sending ASCII chars for tab, backspace etc.

e.g. BackSpace = String.Char(08);
Tab = String.Char(09);

You could also try inline escapes, i.e. if \r works the way you want then \b and \t should do so too.

irix
10-16-2009, 03:46 AM
Try sending ASCII chars for tab, backspace etc.

e.g. BackSpace = String.Char(08);
Tab = String.Char(09);

You could also try inline escapes, i.e. if \r works the way you want then \b and \t should do so too.



Input.SetText("Input1", String.Char(08));

Doesn't work, everythig gets ereased and it replaces it with a strange character. It should just remove one character.

\b also gives this character, but clicking it again just adds that character again. It looks like a block with a small hole in it.

IdeasVacuum
10-16-2009, 06:27 PM
...you can't set the text directly in the input Object, process first, then set the result.