Jump to content

Recommended Posts

Posted

Hi, I wanted to create and destroy PuTTY session in an automated manner. And Im a beginner.

I've created code, to automate my session choosing by just clicking with a mouse.

And now, when I want to detect connection between my PC and my laser scanner by a COM Port, it seems that I dont know how to find solution for that... I wanna to detect with AutoIT, a connection with physical item, and when it detects my item, then I wanna to destroy session after printing on PuTTY code/variable from barcode; aaand I am worried, that PixelGetColor() isn't working with this(I've got rid of it from my code by now)... AutoIT Window Info shows me, that window before printing a variable is the same as after variable is being printed :( Window Info is on "FREEZE" mode aswell... Here's my code:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <Date.au3>
#include <EditConstants.au3>

Opt("GUIOnEventMode", 1)
AutoItSetOption('MouseCoordMode', 0)

Run('C:\Program Files (x86)\PuTTY\putty.exe')

$okno = WinWait('PuTTY Configuration')
WinActivate('PuTTY Configuration')
MouseClick('primary', 213, 252, 1, 0)

Sleep(500)
MouseClick('primary', 401, 240, 1, 0)

Sleep(400)
MouseClick('primary', 314, 421, 1, 0)

Global $txtInput = GUICtrlRecvMsg("COM1 - PuTTY", 19, 22, 201, 21)

GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

While 1
    Sleep(100)
WEnd

Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)

    Local $hdlWindowFrom, _
          $intMessageCode, _
          $intControlID_From

    $intControlID_From =  BitAND($wParam, 0x000000)
    $intMessageCode = BitShift($wParam, 16)

    Switch $intControlID_From
        Case $txtInput
            Switch $intMessageCode
                Case $EN_CHANGE
            EndSwitch
    EndSwitch

    Return $GUI_RUNDEFMSG

EndFunc

 

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
×
×
  • Create New...