![]() |
| The AccuTerm forum has moved. Go to community.rocketsoftware.com to register for the new Rocket forum. |
|
Post Reply
|
| Author | |
danieldeslandes
Newbie
Joined: May 03 2017 Location: Montreal Status: Offline Points: 7 |
Post Options
Thanks(0)
Quote Reply
Topic: Blocking user input while script executePosted: July 28 2017 at 7:53am |
|
Hi,
I am executing the following script from my unidata program, the problem is that sometimes a user will input keys that will satisfy the INPUT CURRENT.DIRECTORY below and so the program will not capture the content output from the script. What can I do to prevent that? I tried ESC:'#' to lock keyboard and clearing the input stream with CLEARINPUT but I can still reproduce the problem... is there a better way to capture information from a script than using an INPUT statement? script: *----------------------------* SCRIPT.GET.CURRENT.DIRECTORY: *----------------------------* * SCR = "" SCR=SCR:CHAR(25):'Dim WshShell, strCurDir' SCR=SCR:CHAR(25):'Set WshShell = CreateObject("WScript.Shell")' SCR=SCR:CHAR(25):'strCurDir = WshShell.CurrentDirectory' SCR=SCR:CHAR(25):'InitSession.Output strCurDir & vbCR' PRINT ESC:STX:'R':SCR:CR: INPUT CURRENT.DIRECTORY: |
|
![]() |
|
danieldeslandes
Newbie
Joined: May 03 2017 Location: Montreal Status: Offline Points: 7 |
Post Options
Thanks(0)
Quote Reply
Posted: July 28 2017 at 11:16am |
|
To be more clear, the problem is that the user is entering data in a field and *might* hit "ENTER" twice, fast enough that the 2nd one will get captured by the INPUT CURRENT.DIRECTORY instead of the data being returned by the script.
I was able to lock keyboard before running the script with PRINT ESC:'[2h': ;*LOCK KEYBOARD but the "ENTER" is done prior to that, so I was hoping doing CLEARINPUT before the script would clear it but no... only way I was able to correct my problem is by doing this: INPUTIF JUNK THEN JUNK = "" ELSE INPUT JUNK,1: FOR 1 THEN JUNK = "" only problem I have with this is that it introduces a 1 second delay IF the user did not hit enter twice... I can leave with it for now but was looking for a better way of handling this without the wait... thanks! |
|
![]() |
|
PSchellenbach
Admin Group
Moderator Joined: December 15 2003 Location: United States Status: Offline Points: 2150 |
Post Options
Thanks(0)
Quote Reply
Posted: July 28 2017 at 11:54am |
|
Hi Daniel -
Locking the keyboard and clearing the typeahead is really the only way I can think of to prevent stray data from getting in. If you have a function to sleep for a fraction of a second, you might try inserting that between the keyboard lock and the CLEARINPUT. The INPUTIF ... FOR 1 is basically doing the same thing with a 1 second sleep. If you could do a 100ms sleep, that would probably be sufficient for any data in transit to arrive and get cleared by CLEARINPUT. Thanks, Pete |
|
![]() |
|
danieldeslandes
Newbie
Joined: May 03 2017 Location: Montreal Status: Offline Points: 7 |
Post Options
Thanks(0)
Quote Reply
Posted: July 28 2017 at 1:11pm |
|
thanks for your help
I implemented a waiting loop and experimented with it. CURRENT.TIME = SYSTEM(12) ;* current time in milliseconds LOOP IF SYSTEM(12) - CURRENT.TIME > 500 THEN CLEARDATA CLEARINPUT EXIT END REPEAT Unfortunetaly, I was still able to get that carriage return to mess with my input... It seems the INPUT is the only solution that works right now to capture any "extras" CR that might have been entered
|
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |