0

Closed

SendKeyFromText?

description

Hi all :)
 

 
This is a brilliant project and it deserves to succeed! - As soon as I am to speed with the package I hope to be able to help others out.. in return in some way for helping be connect to a mainframe without the use of Attachmate!
 
OK - now for some questions!!:
 
If I send:
 
myEmulator.SendKeyFromText(true, "PF1");
 
I get an exception:
 
"Input string was not in the right format!"
 
looking in TNEmulator.cs at SendKeyFromText (Line 161) I read:
 
submit = this.currentConnection.KeyboardCommandCausesSubmit("PF", System.Convert.ToInt32(text.Substring(3)));
 
Should this line not end
 
....ToInt32(text.Substring(2)));
 
As Substring is zero based?
 
same for line 185?
 
Got a few more questions but better wait and see if I am making an idiotic mistake first lol!
 
:) Brian
Closed Oct 23, 2013 at 9:14 AM by igitur
Fixed according to Skwerl

comments

jdanwilliams wrote Feb 19, 2007 at 8:14 PM

Hey Brian,

Not sure if your still working with this or not. I just started working with this project and in poking around the site noticed your issue. The SendKeyFromText is expecting the PF commands to be zero padded on the left if under 2 chars. So to issue a F3 keypress you should use myEmulator.SendKeyFromText(true, "PF03");

Hope you didn't give up,

Dan

igitur wrote Jun 19, 2007 at 8:31 AM

I agree that this project must succeed. In doing so, why not pad the digit if it is not already padded, hence if the user sends ...

myEmulator.SendKeyFromText(true, "PF3");

... the method1) notices it starts with PF, but has only 3 characters in total.2) either throws an exception, warning the user (?)3) prepad the digit with a zero

Skwerl wrote Aug 22, 2013 at 2:50 PM

In the latest version, I have deprecated SendKeyFromText. Use the SendKey method with the accompanying TNKey enumeration. No more strings!