Sign in to follow this  
Followers 0
enaiman

COM Object help - wodTelnetDLX

5 posts in this topic

#1 ·  Posted (edited)

I've downloaded a copy of this and I'm trying to figure how to use events.

There is an event "KeyPress" which is fired every time a user preses a key (also there are many other events but they are easy to implement once I get the way to implement this).

Here is the relevant page help but you might want to take a look at something else:

Description

Fires when regular key is pressed.

Syntax

Private Sub object_KeyPress(KeyAscii)

The KeyPress Event syntax has these parts:

Part Description

object A wodTelnetDLX object.

KeyAscii An Integer value. ASCII code of the key that was pressed.

Remarks

This event is only available in OCX (GUI) version of the component.

When wodTelnetDLX has the focus, each time user presses some key this event will be fired. Here you can inspect pressed key and handle it with your code, or you can just pass it to wodTelnetDLX and let it deal with the pressed key.

If you don't want wodTelnetDLX to receive this keypress, you should set KeyAscii parameter to 0 - in which case wodTelnetDLX will never 'see' this key as pressed.

Actual wodTelnetDLX behavior is to send pressed key to the remote server, and let it deal with it.

It looks like a function but I have no idea how to implement it.

I tried to attach the help file but I'm not allowed to upload "chm" files so here it is the link to their help page:

http://www.weonlydo.com/TelnetDLX/Help/

The previous snippet is found on "Events - KeyPress Event"

Thank you,

Here is some code I got so far:

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$TelnTest = GUICreate("Telnet", 633, 447, 193, 125)
GUISetOnEvent($GUI_EVENT_CLOSE, "TelnTestClose")
$Telnet1 = ObjCreate("WeOnlyDo.wodTelnetDLX.1")
$Telnet1_ctrl = GUICtrlCreateObj($Telnet1, 8, 8, 616, 392)
$Button1 = GUICtrlCreateButton("Connect", 56, 408, 113, 25, 0)
GUICtrlSetOnEvent(-1, "Button1Click")
$Button2 = GUICtrlCreateButton("Button2", 232, 408, 121, 25, 0)
GUICtrlSetOnEvent(-1, "Button2Click")
$Button3 = GUICtrlCreateButton("Button2", 414, 408, 121, 25, 0)
GUICtrlSetOnEvent(-1, "Button3Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$Telnet1.HostName = "192.168.0.20"
$Telnet1.Protocol = 1
$Telnet1.Prompt = "regex:[\$%#>] #"
$Telnet1.Enabled = True


While 1
    Sleep(100)
WEnd

Func Button1Click()
    $Telnet1.Connect
    Sleep(1000)
    $Telnet1.PrintText ("Connecting..."&@CRLF)
    Sleep(1000)
    $Telnet1.send ("admin"&@CRLF)
    $Telnet1.send (@CRLF)
EndFunc

Func Telnet1_KeyPress($key)   ;this is my attempt to implement that event but it does't work
    $Telnet1.PrintText (Chr($key))

EndFunc

Func Button2Click()

EndFunc
Func Button3Click()

EndFunc
Func TelnTestClose()
    $Telnet1.Disconnect
    Exit
EndFunc
Edited by enaiman

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites



Read about ObjEvent

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Read about ObjEvent

Dale

I feel kinda stupid now :">

I wonder why I couldn't think of that myself ...

Thank you DaleHohm for "opening my eyes" :)


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

NP. It works differently than VB/VBS.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

This is not "wholly related" ... How can I create a Font object?

Thank you,


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0