Jump to content

Need Help with Gui And TCP COnnect and initate Scripting


Recommended Posts

Hey Guyz,

Its Diffrent this time,

i was using my script to run the gui which control other functions only in same computer , but now i want to run my script to be used as TCP Server / Client algorithm.

My Scenario is Server Script is in listen mode to track the Cleint Script Initialisation.

When i send command from My gui in client computer Server Computer needs to perform the Script functions. One more thing Client Gui also have Combo Box whose value will be loaded from Server computer.

Tell me How its gonna be done :). Thanks

an Example script will b e helpful ,

PS : i know very less about TCP Connect and all :)

Thanks & Regards,

G6

Link to comment
Share on other sites

  • Moderators

Hi, rockscena. As this forum is not in the habit of writing code for you, why not post what you have? I would suggest reading through the Help file on TCPConnect, and trying to mold the example given in the help file to suit your environment. If you get stuck, post the code you have and we can assist :)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

This code should be for my Server Side,

If GUICtrlRead($radio_agent) = 1 Then

;##### Run #########
Send ("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
Sleep(1000)
Send("{ENTER}")
Sleep(1000)

$x = 0
$y = 0


$result_h323 = _WaitForImageSearch("one_x_agenth323.bmp", 20, 1, $x, $y, 100)

If $result_h323 = 1 Then
MouseMove($x, $y, 100)
Else
MsgBox(0, "Error", "Check the Correct Statement")
EndIf



;Activating Window
WinActivate("xxxxxxxxxxxxxx")
AutoItSetOption("MouseCoordMode",0)





Sleep(1000)


;Placing a Call
Mousemove (47,97.5,30)
MouseClick ("left")
Sleep(1000)
Send("{ALTDOWN}")
Send("{c}")
Send("{ALTUP}")
Send("50006")
sleep(1000)
Send("{Enter}")

Client Side :

Simple Gui Window with Run Script Radio button.....

P.S : I am very new to Auto IT TCP module ... So i knw its hectic a little bit.. but pls help me out !

Thanks

Link to comment
Share on other sites

I want to Do Something Like this

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiComboBox.au3>
#include <WinAPI.au3>
#include <IE.au3>
#include <Date.au3>


Global $dir_IPAddress, $dir_Port, $dir1

$dir_IPAddress = @IPAddress1
$dir_Port = 2291


TCPStartup()

TCPConnect($dir_IPAddress, $dir_Port)

;Variable $dir1 should be Updated from the Script !
; $dir = location on the Server Computer for Combo Box.




#Region ### START Koda GUI section ### Form=c:documents and settingsadminmy documentsauto it custom scriptsvquad - onexa automationmain_window.kxf
$Main_Window = GUICreate("Automation Wizard ", 724, 663, 276, 183)
GUISetCursor (2)
$radio_settings = GUICtrlCreateGroup("Settings", 32, 40, 649, 105)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$radio_agent = GUICtrlCreateRadio("Option 1", 48, 64, 217, 17)
$radio_agentsip = GUICtrlCreateRadio("Option 2", 48, 88, 137, 17)
$radio_communicator = GUICtrlCreateRadio("Option 3", 48, 112, 153, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$VDID_2 = GUICtrlCreateCombo("Choose...", 80, 304, 257, 150, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL,$WS_VSCROLL))
GUICtrlSetTip(-1, "Choose the Auto Script File for Device 1")
$run_script = GUICtrlCreateButton("Run Script", 552, 600, 129, 41)
$end_script = GUICtrlCreateButton("End Script", 424, 600, 129, 41)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetState(-1, $GUI_HIDE)
GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###


While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

Case $VDID_2
_GUICtrlComboBox_BeginUpdate($VDID_2)
_GUICtrlComboBox_AddDir($VDID_2, $dir1 & "*.scp")
_GUICtrlComboBox_EndUpdate($VDID_2)

Case $run_script
GUICtrlSetState($end_script, BitOR($GUI_ENABLE, $GUI_SHOW))
GUICtrlSetState($run_script, $GUI_DISABLE)


EndSwitch

WEnd



;RUN Script

;So When I Hit Run Script it will be execute the settings on the Server PC by reading the option in Client PC.

Now I need that This UI is the Client UI .

Server is in listen Mode in another computer, i want to select any 1 option (option1/option2/option3)

Combo Box should load the directory located in another computer, which could be done with TCP feature i suppose but i aint getting it tried binary to string and string to binary. so a little Help will be needed..

1 more things i want when i hit Run Script button , the script should be loaded in Server Computer and execute the settings whihc i loaded in Client PC.

Thanks and Please help me out i am stuck :[

Edited by rockscena
Link to comment
Share on other sites

Look at help file of TCPRecv() and TCPSend(), those have the building blocks you need. Test them out, both locally, first, then move one over to another station. On the other station (listener), make sure you allow access through your firewall.

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Look at help file of TCPRecv() and TCPSend(), those have the building blocks you need. Test them out, both locally, first, then move one over to another station. On the other station (listener), make sure you allow access through your firewall.

hey I already did that , Saw TCP Send and TCP Recv scripts, and thats working in two diffrent PCs. but i dont know how this mechanism can be put together. i am stuck :[

See the thing is i dun need to send any text file i just want to read the File List located on Server Computer from this clinet UI and when i hit Run Script it should load the settings on Server PC and initiate it !!

Edited by rockscena
Link to comment
Share on other sites

You can send a string to the rec, which has the script to run, the IP to send a message back to, and the port number. Then when the receiver get's that string, break it down, call the script with some params, and have the script sent a TCPIP back with whatever data you need to load into your gui.

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Ok I tried something Like this and Its Crashing previously same thing was Happening

While 1
$nMsg = GUIGetMsg()

; GUI Closed
;--------------------
If $nMsg= $GUI_EVENT_CLOSE Then ExitLoop

; Try to receive (up to) 2048 bytes
;----------------------------------------------------------------
$dir_recv = TCPRecv($dir_Socket, 2291)

; If the receive failed with @error then the socket has disconnected
;----------------------------------------------------------------
If @error Then ExitLoop

; convert from UTF-8 to AutoIt native UTF-16
$dir_recv = BinaryToString($dir_recv, 4)

; Update the edit control with what we have received
;----------------------------------------------------------------
If $dir_recv <> "" Then
_GUICtrlComboBox_BeginUpdate($VDID_2)
_GUICtrlComboBox_AddDir($VDID_2, $dir_recv & "*.scp")
_GUICtrlComboBox_EndUpdate($VDID_2)
EndIf

Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit


Case $VDID_2


Case $run_script
GUICtrlSetState($end_script, BitOR($GUI_ENABLE, $GUI_SHOW))
GUICtrlSetState($run_script, $GUI_DISABLE)


EndSwitch

If $dir_Socket <> -1 Then TCPCloseSocket($dir_Socket)

TCPShutdown()
WEnd
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...