Jump to content

qwertylol

Active Members
  • Posts

    332
  • Joined

  • Last visited

Everything posted by qwertylol

  1. how do I run a short cut from the same folder?
  2. FileWrite ( "python_loc.txt", "line" ) how do I break line?
  3. i remember reading about a method using au3 to return definitions by the number of pixels it has on x axis and y axis, does someone remember what that is?
  4. Optical character recognition any au3 code on that?
  5. after I random a integer number, i need to know if it's a odd or even number. how do I do it?
  6. how do I put some of the functions i use to separate files and then just include them in others that use them?
  7. #include 'TCP Funcs.au3' TCPStartup() $Socket = TCPConnect("10.0.1.100", 7000) TCPSendMessage($Socket, "This is NOT a test!") TCPCloseSocket($Socket) TCPShutdown() this one is the client side au3, i run it to send a string to the server, it's the 2nd code post. they both are based on the first one, tcp_funcs.au3 however, the server seems to be able to to only accept and process one incoming connections and does not terminate or process new incomings afterward. I need it to process one incomining after the other, how do I fix the code?
  8. #include <Misc.au3> #include 'TCP Funcs.au3' Local $ConnectedSocket = -1 $MainSocket = TCPStartServer(7000) While _IsPressed('1B') = 0 If $ConnectedSocket = -1 Then $ConnectedSocket = TCPAllowConnection($MainSocket) $Data = TCPReceive($ConnectedSocket) If @Error = 0 Then ; events to do with incomings EndIf Sleep(100) WEnd TCPStopServer($MainSocket, $ConnectedSocket)
  9. #include-once ; ---------------------------------------------------------------------------- ; AutoIt Version: 3.1.1.92 ; Author: Max Gardner <AutoIt Smith;king.of.all@comcast.net> ; ---------------------------------------------------------------------------- ; ---------------------------------------------------------------------------- ; Function: TCPStartServer($Port[, $MaxConnection]) ; $Port = Port To Start Server On ; $MaxConnection = (Optional) Maximum Connections Allowed; Default 1 ; ; Returns: ; Success : Returns Socket and @Error = 0 ; Failure : Returns 0 or 1 and sets @Error to Windows API WSAGetLasterror ; 0 = TCP Services Not Avialible On That Port ; -1 = TCP Services Would Not StartUp ; ---------------------------------------------------------------------------- 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 ; ---------------------------------------------------------------------------- ; Function: TCPAllowConnection($Socket) ; $Socket = The Main Socket As Returned By TCPStartServer ; ; Returns: ; Success : Returns ConnectedSocket and @Error = 0 ; Failure : Returns -1 and sets @Error to Windows API WSAGetLasterror ; ---------------------------------------------------------------------------- Func TCPAllowConnection($Socket) Local $ConnectedSocket $ConnectedSocket = TCPAccept($Socket) Select Case $ConnectedSocket >= 0 SetError(0) Return $ConnectedSocket Case Else SetError(@Error) Return -1 EndSelect EndFunc ; ---------------------------------------------------------------------------- ; Function: TCPReceive($ConnectedSocket, $MaxChar) ; $ConnectedSocket = The Connected Socket As Returned By TCPAllowConnection ; ; Returns: ; Success : Returns Recieved String and @Error = 0 ; Failure : Returns -1 and sets @Error to Windows API WSAGetLasterror ; ---------------------------------------------------------------------------- Func TCPReceive($ConnectedSocket, $MaxChar = 512) Local $Data $Data = TCPRecv($ConnectedSocket, $MaxChar) Select Case $Data = "" SetError(@Error) Return -1 Case Else SetError(0) Return $Data EndSelect EndFunc ; ---------------------------------------------------------------------------- ; Function: TCPSendMessage($ConnectedSocket, $String) ; $ConnectedSocket = The Connected Socket As Returned By TCPAllowConnection ; $String = Data to be sent ; ; Returns: ; Success : Returns 1 and @Error = 0 ; Failure : Returns -1 or 0 and sets @Error to Windows API WSAGetLasterror ; ; ---------------------------------------------------------------------------- Func TCPSendMessage($ConnectedSocket, $String) Local $Sent $Sent = TCPSend($ConnectedSocket, $String) Select Case $Sent = 0 SetError(@Error) Return -1 Case Else SetError(0) Return 1 EndSelect EndFunc ; ---------------------------------------------------------------------------- ; Function: TCPStopServer($MainSocket, $ConnectedSocket) ; $MainSocket = The Socket As Returned By TCPStartServer ; $ConnectedSocket = The Connected Socket As Returned By TCPAllowConnection ; ; Returns: ; Success : Returns 1 and @Error = 0 ; Failure : Returns -1 and sets @Error to Windows API WSAGetLasterror ; 0 = Unable To Shutdown TCP Services ; -1 = Unable To Close Socket/s ; ---------------------------------------------------------------------------- Func TCPStopServer($MainSocket, $ConnectedSocket) Local $Shutdown Select Case $ConnectedSocket <> -1 $ConnectedSocket = TCPCloseSocket($ConnectedSocket) Select Case $ConnectedSocket = 0 SetError(@Error) Return -1 EndSelect EndSelect Select Case $MainSocket <> -1 $MainSocket = TCPCloseSocket($MainSocket) Select Case $MainSocket = 0 SetError(@Error) Return -1 EndSelect EndSelect $Shutdown = TCPShutdown() Select Case $Shutdown = 0 SetError(@Error) Return 0 EndSelect SetError(0) Return 1 EndFunc
  10. i use these 3 to do simple networking
  11. server #include <Misc.au3> #include 'TCP Funcs.au3' Local $ConnectedSocket = -1 $MainSocket = TCPStartServer(7000) $i = 13 MsgBox(0, "Message Received", "it started") While 1;_IsPressed('1B') = 0 If $ConnectedSocket = -1 Then $ConnectedSocket = TCPAllowConnection($MainSocket) $Data = TCPReceive($ConnectedSocket) If @Error = 0 Then $name = "file" $FO = FileOpen(@ScriptDir & "\" & $name & $i & ".txt", 1) FileWrite($FO, $Data & $i) FileClose($FO) $i = $i + 1 MsgBox(0, "Message Received", $i) MsgBox(0, "Message Received", $Data) EndIf Sleep(100) WEnd MsgBox(0, "Message Received", "server has stopped") TCPStopServer($MainSocket, $ConnectedSocket) client #include 'TCP Funcs.au3' TCPStartup() $Socket = TCPConnect("10.0.1.199", 7000) TCPSendMessage($Socket, "This is a test!") TCPCloseSocket($Socket) TCPShutdown() however, it would only receive the send once, pop the boxes, save the file, yet not being able to receive another client send why is that?
  12. I want to save txt string $data to a .txt file , how do I do it? I want the .txt files to be named as 1.txt, 2.txt, 3.txt, 4.txt, 5.txt, how do I do it?
  13. this is a loop loop { save txt file in a file named file + $var + .txt with content of $data , which contains a string. $var = $var + 1 } how do I do this?
  14. yeah this works for teminating the process itself but i was looking for the process to terminate another one.
  15. i am a au3.exe running, how do I quit it half way? also, how do i set up a hot key so that i can tell a au3.exe to terminate a process?
  16. not in auto it 3, but in c++, how do I do keyboard and mouse events in c++?
  17. I am on 10.0.1.101 ( my own router network ) and I want to send a line of text to 10.0.1.103 how do I do it?
  18. I wish the search function of the help file would just return them with search terms like "red" thank you
  19. I got this: Dim $color = pixelgetcolor(920, 599) but for the life of mine, I all of a sudden can't recall how to split the color into red blue and green I think it's 3 functions I use that does this $red = red($color) something like that. what's the names of the color functions exactly?
  20. oh yeah, sorry i got back to this thread when I finished debugging the stuff, yeah i got 8 msgboxes all over the place.
  21. do you see the same warning? i know when the handles.ini doesn't have any entries, it's an infinite loop.
  22. Dim $record Dim $number_handle_there_already_is Dim $is_it_new_handle $number_handle_there_already_is = iniRead ( "handles.ini", 0, "number", "") $counter = 0 $handle_array = winlist ( "txt" ) ;~ If $record = $handle_array[0][0] Then ;~ MsgBox ( 0, "handle fault", "there isn't a new handle when winlist is called.") ;~ EndIf If ($handle_array[0][0] - $record ) > 1 Then MsgBox ( 0, "handle fault", "there is more than one new handle when winlist is called.") EndIf $array_live = winlist ("star wars galaxies") ; theoretically always bigger with 1 $array_record = IniRead ( "handle.ini", 1, "number", "") $counter_1 = 0 $counter_2 = 0 Do $counter_1 = $counter_1 + 1 Do $counter_2 = $counter_2 + 1 $c = IniRead ("handles.ini", 1, $counter_2, "") If $array_live[$counter_1][1] = $c Then $is_it_new_handle = true EndIf if $is_it_new_handle = true Then fileopen ( "newhandle.txt", 2) FileWriteLine ( "newhandle.txt", $array_live[$counter_1][1] ) IniWrite ( "handles.ini", 1, ($number_handle_there_already_is + 1 ), $array_live[$counter_1][1] ) EndIf $is_new_handle = false Until $counter_2 = $number_handle_there_already_is $counter_2 = 0 Until $counter_1 = $handle_array[0][0] the syntax checked fine, yet when run this is returned: >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\python_codes\handle.au3" C:\python_codes\handle.au3 (34) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: If $array_live[$counter_1][1] = $c Then If ^ ERROR >Exit code: 1 Time: 0.350
×
×
  • Create New...