Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 05-19-2016, 01:45 PM
ShawnVW ShawnVW is offline
Registered User
 
Join Date: May 2016
Posts: 15
Moving cursor position to previous field

Is there a way to change the cursor position? I'm using secureCRT 7.3.3 and VBS.

I need to be able to move the cursor from the current field to the one preceding it. Manually, the only way to move the cursor back is with the Up Arrow key.

I tried recording a script, used Up Arrow to get to the desired field, and got this:

crt.Screen.Send chr(27) & "[A" & chr(13)


But playing it back does not do anything.
Reply With Quote
  #2  
Old 05-20-2016, 07:37 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 3,997
Hi ShawnVW,

So it sounds like you are working inside some menued application, correct?

It might be difficult to accomplish this task via scripting because the tasks are dependent on timing. You have to be able to detect the cursor is in the "wrong field" before pressing the Up arrow would accomplish the objective.

How do you know when the cursor is in the "wrong" field?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 05-20-2016, 09:09 AM
ShawnVW ShawnVW is offline
Registered User
 
Join Date: May 2016
Posts: 15
Quote:
Originally Posted by bgagnon View Post

How do you know when the cursor is in the "wrong" field?
It depends on whether the script changes the value in the Zip Code field. If it does, the screen automatically fills in the City, State, and Country fields, and the cursor proceeds to Phone Number. That's the "wrong field" because I occasionally need to go back and change City, State, or Country.

I did find a workaround: I can change the Zip, finish and save the screen, then start over. This time the script won't change the Zip, so it can tab down to City, State, or Country and change it if needed.

If you still know a way of "tabbing backwards", I'm sure it will come in handy at some point.
Reply With Quote
  #4  
Old 05-20-2016, 09:56 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 3,997
Hi ShawnVW,

Thanks for the clarification. I am glad to hear you found a workaround.

You probably would use SendKeys() instead of Send() to simulate the up arrow:

Code:
  crt.Screen.SendKeys "{UP}"
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
Reply

Tags
scripting , vbscript


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 02:02 PM.