
dillonlim
Active Members-
Posts
42 -
Joined
-
Last visited
Everything posted by dillonlim
-
Martin, Many thanks for this great UDF. I've used it in the past without any problems until I tried to connect to an Avocent Cyclades. I keep getting these extra characters which I can't seem to filter out. See attached picture. . I don't see these extra characters while viewing through HyperTerminal. How do I clean up those extra characters without messing up the output format? Thanks again.
- 680 replies
-
- serial port
- virtual port
-
(and 2 more)
Tagged with:
-
Sorry but I've never tried it on Win7. I only tested it on XP.
-
Wrote this while I was bored at work. Not quite sure what value it adds to the console traceroute if any. #include <Constants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("Traceroute Thingy", 500, 500) GUICtrlCreateLabel("IP Address:", 10, 13, 60, 20) $ipaddress = GUICtrlCreateInput("", 80, 10, 200, 20) $start = GUICtrlCreateButton("TRACE", 300, 10, 80, 20) $clear = GUICtrlCreateButton("CLEAR", 400, 10, 80, 20) $display = GUICtrlCreateEdit("", 10, 40, 480, 420, $ES_READONLY) GUICtrlCreateLabel("Status:", 10, 473, 40, 20) $status = GUICtrlCreateEdit("Idle", 50, 470, 440, 20, $ES_READONLY) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $start Local $tracert = "" Local $st = 1 Local $tracestatus = "run" GUICtrlSetData($status, "Tracing route") $getip = GUICtrlRead($ipaddress) $troute = Run("cmd.exe /c tracert.exe -h 30 -w 10 " & $getip, "", @SW_HIDE, $STDOUT_CHILD) Do If $tracestatus = "run" Then $tracert &= StdoutRead($troute) If @error Then $tracestatus = "stop" EndIf EndIf $trace = StringStripCR($tracert) $tracesplit = StringSplit($trace, @CRLF) $arrayvar = UBound($tracesplit) If $st = $tracesplit[0] AND $tracestatus = "run" Then Sleep(500) ElseIf $arrayvar < 7 Then Sleep(500) ElseIf $st < $tracesplit[0] AND $arrayvar >= 7 Then $readchar = StringLeft($tracesplit[$st], 5) $cleanchar = StringStripWS($readchar, 8) If StringIsDigit($cleanchar) = 1 Then GUICtrlSetData($display, $tracesplit[$st] & @CRLF, 1) Sleep(1500) EndIf EndIf $st = $st + 1 Until $st = $tracesplit[0] AND $tracestatus = "stop" GUICtrlSetData($status, "Done") Case $msg = $clear GUICtrlSetData($ipaddress, "") GUICtrlSetData($display, "") GUICtrlSetData($status, "Idle") EndSelect WEnd GUIDelete()
-
Wrote this a part of a framework for a friend's project. I've only tested it on x86 WinXP. It only works with Microsoft telnet client. It WILL fail with PuTTY, any third party telnet client and any flavor Linux/Unix telnet client. $port = "666" TCPStartup () $GIT = TCPListen(@IPAddress1, $port) If $GIT = -1 Then MsgBox(0, "Error", "Unable to start server on " & $port) Exit EndIf While 1 Do $GOT = TCPAccept($GIT) Until $GOT <> -1 TCPSend($GOT, "Command? ") While 1 $HAS = TCPRecv($GOT, 4096) $CHKVAR = StringLen($HAS) If $CHKVAR > 0 Then Local $HASSING = "" Do $HASSING &= TCPRecv($GOT, 4096) $CHKCHAR = StringRight($HASSING, 1) Until $CHKCHAR = ";" $HASSAN = StringTrimRight($HASSING, 1) $CMSG = $HAS & $HASSAN TCPSend($GOT, @CRLF & "Command? ") If StringLower($CMSG) <> "exit" Then TrayTip("i haz a msg", $CMSG, 5, 0) Else TrayTip("", "", 5, 0) EndIf Select Case StringLower($CMSG) = "exit" TCPSend($GOT, "Goodbye!") TCPCloseSocket($GOT) ExitLoop Case StringLower($CMSG) = "close" Send("!{F4}") Case StringLower($CMSG) = "return" Send("{ENTER}") Case StringLeft(StringLower($CMSG), 4) = "send" $TRIMMER = StringTrimLeft($CMSG, 5) Send($TRIMMER) Send("{ENTER}") Case StringLeft(StringLower($CMSG), 2) = "go" $TRIMMER = StringTrimLeft($CMSG, 3) ShellExecute($TRIMMER) EndSelect EndIf WEnd WEnd TCPShutDown()
-
Disconnecting a USB flash drive?
dillonlim replied to Diana (Cda)'s topic in AutoIt General Help and Support
You can use the command line utility "devcon" from Microsoft. Run "devcon status" and parse for the name of flash drive. Then run "devcon remove <device class>" to remove the flash drive. It is totally independent of the drive letter. -
Ping script and move window problems
dillonlim replied to st4vr0s's topic in AutoIt General Help and Support
I did something similar awhile back and I used AutoIt's native ping and this was what I came up with. Hope it helps. HotKeySet("{ESC}", "Terminate") $ip = InputBox("Ping Type Thing", "IP Address:", "", "", 200, 60) If @Error Then Exit Local $count = 0 Local $success = 0 $display = 'Pinging "' & $ip & '"' SplashTextOn("Ping Type Thing", $display, 650, 45, -1, 5, 48) While 1 $count = $count + 1 $pingresult = Ping($ip, 50) If $pingresult > "0" Then $success = $success + 1 EndIf $percentage = ($success / $count) * 100 $ppacketloss = 100 - $percentage ControlSetText("Ping Type Thing", "", "Static1", $display & ". " & $pingresult & " ms response time and " & Round($ppacketloss, 2) & "% packet loss.") Sleep(50) WEnd SplashOff() Func Terminate() Exit 0 EndFunc -
how to delete a simple share printer
dillonlim replied to Caaio's topic in AutoIt General Help and Support
You should be able to use the "wmic printer" command to configure your printer. -
I got bored at work so I whipped up a simple script to stream my mp3s from one location to another. Pretty self explanatory. Place script in the same folder as your mp3s. Start up the script, then launch Winamp. From within Winamp, select "Play", "URL". Type in "http://<ip address of machine running the script>:51511" and it should start streaming the mp3. #include <File.au3> #include <Array.au3> TCPStartUp() Local $TCPport = "51511" $msock = TCPListen(@IPAddress1, $TCPport) If $msock = -1 Then MsgBox(0, "Error", "Unable to start server on port " & $TCPport) Exit EndIf $mp3list = _FileListToArray(@ScriptDir, "*.mp3", 1) $i = 0 While 1 $csock = TCPAccept($msock) If $csock <> -1 Then If $i = $mp3list[0] Then $i = 1 Else $i = $i + 1 EndIf TCPSend($csock, "ICY 200 OK" & @CRLF) TCPSend($csock, "icy-name: " & $mp3list[$i] & @CRLF) TrayTip("Simple MP3 Streamer", $mp3list[$i], 10) $open = FileOpen($mp3list[$i], 16) Do $data = FileRead($open, 8) If StringLen($data) = "0" Then Sleep(5000) EndIf $packetsend = TCPSend($csock, $data) If $packetsend = "0" Then ExitLoop Until StringLen($data) = "0" TCPCloseSocket($csock) EndIf WEnd TCPShutdown()
-
Try RunWait("\\servername\netlogon\" & $username1 & ".bat", "", @SW_HIDE)
-
GUI Lockup When Running As Service
dillonlim replied to jawnah's topic in AutoIt GUI Help and Support
Did you try enabling "Allow service to interact with desktop"? -
Assuming you know the IP address and the port the server is listening on, try connecting to it with TCPConnect. If you are able to connect to it, then the server is ready to accept connections.
-
Desktop Video ScreenCapture
dillonlim replied to cypher175's topic in AutoIt General Help and Support
How about performing a series of screen captures, use MEncoder and string them into a video? http://www.mplayerhq.hu/DOCS/HTML/en/menc-...enc-images.html -
Prerequisites You need to install VLC on both the server and client. Preferably the latest version which is 0.96 I believe. I've also briefly tested it with 0.86 and it seems to work fine. Caveat This is written and tested with AutoIt version 3.2.10.0 and x86 WinXP. I pretty sure it won't run correctly with 3.2.12.0 since there appears to have been changes with some of the includes. I'm fairly certain that it won't run correctly on Vista without some modifications. Likewise with x64 Windows OSes. How to use it Make sure you already have VLC installed on both the server and client. On the server - Copy the sserver.au3 and server.ini to the system with the video files you want to stream. Edit the server.ini file to define the TCP port you want the server to listen for client connections. You'll also need to point to folder with the video files you want to stream. On the client - Copy the sclient and client.ini to the system to receive the media stream. Edit the client.ini file to define the IP address of the server and port to connect on. The port number must be the same as the one defined in the server.ini. Start sserver.au3 and it should list the available video files. Next start the client and the drop down box should show a list of video files similar to the server. If you add or remove files from the media directory, click the refresh button and the media list on the server should update. At the same time, it should also push an update to all connected sockets and the client should get an updated list as well. Select a video and click "START". What's with the weak-ass encryption you're using? I was testing the server at work and I realized that the network folks here use Vericept to sniff the network. If you telnet to the server at the listening port, it will send you a list of media in plain text. That didn't sit too well with me, so I used the built in encryption in AutoIt and scrambled stuff before sending just to make it a little more interesting for the network guys here. I've only worked with AutoIt for a year or so, so you folks will have to excuse my brain-dead code and logic. sserver.au3 sclient.au3
-
Text output by command ran using runwait
dillonlim replied to botanic's topic in AutoIt General Help and Support
How about something like this? You should be able to get the outout from your rasdial command and parse it. Local $routput $output = Run("rasdial command", "", @SW_MINIMIZE, $STDOUT_CHILD) Do $routput &= StdoutRead($output) Until @Error -
Try this instead. ShellExecute("C:\games")
-
Hiding "Safely Remove Hardware" icon
dillonlim replied to Achilles's topic in AutoIt General Help and Support
Not quite sure if you can remove the icon but you can hide it. Right click on the Taskbar and go to "Properties". Check "Hide inactive icons" and click "Customize". Find "Safely Remove Hardware" and change behaviour to "Always hide". Hope that helps. -
I did include the list of time servers you can query in my crappy code. Here's the link again. Have fun. http://tf.nist.gov/timefreq/service/time-servers.html
-
Here's a quick and dirty way to query the time server: #include <IE.au3> ;http://tf.nist.gov/timefreq/service/time-servers.html ;nist1-sj.WiTime.net $server = "64.125.78.85" $oIE = _IECreate("http://" & $server & ":13", 0, 0, 1, -1) $read = _IEBodyReadText($oIE) $time = StringSplit($read, " ") $stime = StringSplit($time[3], ":") ;convert from UTC to PST $nhr = StringTrimLeft($stime[1], 1) If $nhr < 9 Then $nhr = 24 + $nhr EndIf $hr = $nhr - 8 MsgBox(0, "?", $hr & ":" & $stime[2] & ":" & $stime[3]) You may want to use TimerDiff to adjust the results to compensate for the delay. Hope this helps.
-
How would I truncate or cut off digits?
dillonlim replied to Vadoff's topic in AutoIt General Help and Support
$number = "5.362" $digit = StringSplit($number, ".") MsgBox(0, "Result", "." & $digit[$digit[0]]) -
_IECreate has an option to attach to existing window. It's just off by default.