themax90 Posted December 26, 2005 Share Posted December 26, 2005 Okay so I have had requests for my remote server. All I have too do is add some user-defined functionality. However, you can do ANYTHING AutoIt can except use variables. Here is Remote Server BETA expandcollapse popupOpt("RunErrorsFatal", 0) Global Const $Port = 8000 Global $MaxConc = 100 Global $MainSocket = TCPStartServer($Port, $MaxConc) If @error <> 0 Then Exit MsgBox(16, "Error", "Server unable to initialize.") Global Const $MaxLength = 512 Global $ConnectedSocket[$MaxConc] Global $CurrentSocket = 0 Local $Track = 0 Global Const $MaxConnection = ($MaxConc - 1) For $Track = 0 To $MaxConnection Step 1 $ConnectedSocket[$Track] = -1 Next While 1 $ConnectedSocket[$CurrentSocket] = TCPAccept($MainSocket) If $ConnectedSocket[$CurrentSocket] <> - 1 Then $CurrentSocket = SocketSearch() EndIf $Track = 0 For $Track = 0 To $MaxConnection Step 1 If $ConnectedSocket[$Track] <> - 1 Then $Data = TCPRecv($ConnectedSocket[$Track], $MaxLength) If $Data = "~bye" Then TCPCloseSocket($ConnectedSocket[$Track]) $ConnectedSocket[$Track] = -1 $CurrentSocket = SocketSearch() ElseIf $Data <> "" Then AutoItExecute($Data) TCPSendMessageAll($MaxConnection, $Data & " operated.") EndIf EndIf Next WEnd Func AutoItExecute($Cmd) RunWait(@AutoItExe & ' /AutoIt3ExecuteLine "' & $Cmd & '"') EndFunc Func SocketSearch() Local $Track = 0 For $Track = 0 To $MaxConnection Step 1 If $ConnectedSocket[$Track] = -1 Then Return $Track Else ; Socket In Use EndIf Next EndFunc ;==>SocketSearch Func TCPSendMessageAll($ConnectionLimit, $Data) Local $Track = 0 For $Track = 0 To $ConnectionLimit Step 1 If $ConnectedSocket[$Track] <> - 1 Then TCPSend($ConnectedSocket[$Track], $Data) Next EndFunc ;==>TCPSendMessageAll Func TCPStartServer($Port, $MaxConnect = 1) Local $Socket $Socket = TCPStartup() Select Case $Socket = 0 SetError(@error) Return -1 EndSelect $Socket = TCPListen(@IPAddress1, $Port, $MaxConnect) Select Case $Socket = -1 SetError(@error) Return 0 EndSelect SetError(0) Return $Socket EndFunc ;==>TCPStartServer You can use this as a client #include <GuiConstants.au3> #include <GuiEdit.au3> #include <Misc.au3> Local $Server = InputBox("Server", "Please input the server you would like to connect to:") Local $Port = InputBox("Server Port", "Please input the port or the server you would like to connect to:") TCPStartup() $MainSocket = TCPConnect(TCPNameToIP($Server), $Port) If $MainSocket = -1 Then Exit MsgBox(0, "Error", "Could Not Connect or Bad Connection") GUICreate("Server Client", 390, 210) $Send = GUICtrlCreateEdit("", 10, 10, 175, 150, $WS_VSCROLL) Local $History = GUICtrlCreateEdit("Server Messages:", 200, 10, 175, 150, BitOR($WS_VSCROLL, $ES_READONLY)) $SButton = GUICtrlCreateButton("Send", 145, 165, 100, 35) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit ElseIf $msg = $SButton Or _IsPressed ("0D") = 1 Then $Text = GUICtrlRead($Send) $TCPSent = TCPSend($MainSocket, $Text) GUICtrlSetData($Send, "") EndIf $Recv = TCPRecv($MainSocket, 512) If $Recv <> "" Then GUICtrlSetData($History, GUICtrlRead($History) & @CRLF & $Recv) _GUICtrlEditLineScroll ($History, 0, _GUICtrlEditGetLineCount ($History)) EndIf WEnd Func OnAutoItExit() TCPCloseSocket($MainSocket) TCPShutdown() EndFunc;==>OnAutoItExit Just connect too the port and server ip and send any function!!! For example send MsgBox(0, 'Title', 'Text') and a message box will appear. You CANNOT use double quotes ( " s ). There is no user or authentication system, neither is there much. I just would like you all too know I AM working on it. All I did was add about 4 lines of code too create this. Happy holidays AutoIt Smith P.S. I know there are many bugs in the code dealing with AutoIt functionality, but for simple functions it will work. This can be used for file management and other things. It is just a bored script konan 1 Link to comment Share on other sites More sharing options...
Rahul Rohela Posted December 31, 2005 Share Posted December 31, 2005 good.. Tried well.... But giving error on every SEND to server.untitled.bmp Link to comment Share on other sites More sharing options...
themax90 Posted December 31, 2005 Author Share Posted December 31, 2005 The syntax must be exact and must use single quotes ( ' s ) otherwise it does error because I just wrote it too prove to myself I could make a full AutoIt functionality server without hordes of coding. Link to comment Share on other sites More sharing options...
Rahul Rohela Posted December 31, 2005 Share Posted December 31, 2005 Example please still not working.. Link to comment Share on other sites More sharing options...
seriouswrong Posted December 31, 2005 Share Posted December 31, 2005 Please be tolerate of my lack of knowledge..What if I wanted to add more custom commands, could I change the if then to a switch case system, and if so could anyone please provide an example.Say mabe I wanted to add a "~reboot" commd in addiotion to the ~bye command (I don't need the ~reboot code, just the switch syntax)... The section in the server code:If $Data = "~bye" ThenAnd if no custom command is found, then run the code that the server currently does... ieElseIf $Data <> "" Then AutoItExecute($Data) TCPSendMessageAll($MaxConnection, $Data & " operated.")EndIfThanks! Link to comment Share on other sites More sharing options...
ChrisL Posted January 15, 2006 Share Posted January 15, 2006 Okay so I have had requests for my remote server. All I have too do is add some user-defined functionality. However, you can do ANYTHING AutoIt can except use variables. Here is Remote Server BETACool, I like it [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
theguy0000 Posted January 21, 2006 Share Posted January 21, 2006 why not just do this Func TCPStartServer($Port, $MaxConnect = 1) Local $Socket $Socket = TCPStartup() If $Socket = 0 Then SetError (@error) return -1 EndIf $Socket = TCPListen(@IPAddress1, $Port, $MaxConnect) If $Socket = -1 Then SetError(@error) Return 0 EndIf SetError(0) Return $Socket EndFunc ;==>TCPStartServer ? arent all those select..case..endselects pointless? The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
themax90 Posted January 21, 2006 Author Share Posted January 21, 2006 Actually I have tested the Select...Case environment and it works about 0.0019 faster then If, Else.... and it also allows you to test things differently with less Then and ElseIf <> Then stuff. It's just easier to script. Link to comment Share on other sites More sharing options...
xwinterx Posted April 3, 2006 Share Posted April 3, 2006 Sounds interesting.. gonna try it out... would like to see if I can send keystrokes to the server using the SEND command. Link to comment Share on other sites More sharing options...
themax90 Posted April 3, 2006 Author Share Posted April 3, 2006 You can do anything. Make sure its in SINGLE quotes. unless you edit the function. Link to comment Share on other sites More sharing options...
xwinterx Posted April 3, 2006 Share Posted April 3, 2006 I have not been able to get the client code to work... I am using the AU3 beta version... here is my errors..... expandcollapse popupC:\Program Files\AutoIt3\Include\GuiEdit.au3(75,21) : ERROR: IsHWnd(): undefined function. If IsHWnd($h_edit) ~~~~~~~~~~~~~~~~~~~~^ C:\Program Files\AutoIt3\Include\GuiEdit.au3(202,36) : ERROR: DllStructCreate(): undefined function. Local $p = DllStructCreate($RECT) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Program Files\AutoIt3\Include\GuiEdit.au3(208,123) : ERROR: DllStructGetPtr(): undefined function. DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_edit, "int", $EM_GETRECT, "int", 0, "ptr", DllStructGetPtr($p) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~^ C:\Program Files\AutoIt3\Include\GuiEdit.au3(212,57) : ERROR: DllStructGetData(): undefined function. Local $array = StringSplit(DllStructGetData($p, $left) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Program Files\AutoIt3\Include\Misc.au3(84,50) : ERROR: DllStructGetSize(): undefined function. DllStructSetData ($p, 1, DllStructGetSize ($p) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Program Files\AutoIt3\Include\Misc.au3(84,51) : ERROR: DllStructSetData(): undefined function. DllStructSetData ($p, 1, DllStructGetSize ($p)) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ F:\AutoIt\SEND Proj\server.au3(19,61) : ERROR: TCPAccept(): undefined function. $ConnectedSocket[$CurrentSocket] = TCPAccept($MainSocket) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ F:\AutoIt\SEND Proj\server.au3(26,65) : ERROR: TCPRecv(): undefined function. $Data = TCPRecv($ConnectedSocket[$Track], $MaxLength) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ F:\AutoIt\SEND Proj\server.au3(28,56) : ERROR: TCPCloseSocket(): undefined function. TCPCloseSocket($ConnectedSocket[$Track]) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ F:\AutoIt\SEND Proj\server.au3(54,88) : ERROR: TCPSend(): undefined function. If $ConnectedSocket[$Track] <> - 1 Then TCPSend($ConnectedSocket[$Track], $Data) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ F:\AutoIt\SEND Proj\server.au3(59,26) : ERROR: TCPStartup(): undefined function. $Socket = TCPStartup() ~~~~~~~~~~~~~~~~~~~~~~~~~^ F:\AutoIt\SEND Proj\server.au3(65,56) : ERROR: TCPListen(): undefined function. $Socket = TCPListen(@IPAddress1, $Port, $MaxConnect) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ F:\AutoIt\SEND Proj\server.au3 - 12 error(s), 0 warning(s) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 3, 2006 Moderators Share Posted April 3, 2006 You need AutoIt Beta: http://www.autoitscript.com/forum/index.ph...opic=19717&st=0Most of us code using that... you'll want it to run most scripts on here. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
greenmachine Posted April 3, 2006 Share Posted April 3, 2006 You need AutoIt Beta: http://www.autoitscript.com/forum/index.ph...opic=19717&st=0Most of us code using that... you'll want it to run most scripts on here.You should also mention that he has to RUN the script with beta. He says he has it, but if he doesn't run the script with beta, just having it doesn't help. Link to comment Share on other sites More sharing options...
xwinterx Posted April 3, 2006 Share Posted April 3, 2006 You need AutoIt Beta: http://www.autoitscript.com/forum/index.ph...opic=19717&st=0Most of us code using that... you'll want it to run most scripts on here.Doh! I thought I had the latest... I download it... but never installed it.... thanks! Link to comment Share on other sites More sharing options...
xwinterx Posted April 3, 2006 Share Posted April 3, 2006 Got it goin... thanks... I am stupid. Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted April 16, 2006 Share Posted April 16, 2006 i have the server running, i try to connect to myself but i cant... Link to comment Share on other sites More sharing options...
themax90 Posted April 16, 2006 Author Share Posted April 16, 2006 You cannot connect to 127.0.0.1 unless the server ip is set to "127.0.0.1", otherwise try connecting to your public ipaddress. Remember this must be ran without a router. If you cannot connect, then in most cases it is usually your ISP who has blocked traffic in that direction. Link to comment Share on other sites More sharing options...
4Fun Posted July 26, 2006 Share Posted July 26, 2006 @AutoIt Smith I like it. Very simular to the TCP Communicator (you created) and I modified as the base for the Client Commander I created. Did not think to use Autoit commands like that though, very cool! 4Fun Link to comment Share on other sites More sharing options...
kevin.doran Posted September 28, 2006 Share Posted September 28, 2006 Hi AutoIt Smith, I'd like to see if I understand this page correctly: - I have put the server code in an .au3 file, compiled it into a .exe and executed it. It is now running in my systray. - I have put the client code in a .au3 file and executed it as a script. I can connect to my PC using the hostname and port number 80. - A Server Client window appears - However, if i put "MsgBox(0, 'Title', 'Text')" and press the send button nothing happens. Should something happen at this point? Thanks and regards, Kev Link to comment Share on other sites More sharing options...
themax90 Posted September 29, 2006 Author Share Posted September 29, 2006 It depends on the port. Make sure the Server source is tweaked correctly. You want to enter MsgBox(0, 'Title', 'Text') no double quotes. The MsgBox should popup on the server computer. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now