Leaderboard
Popular Content
Showing content with the highest reputation on 09/30/2013 in all areas
-
2 points
-
Power Calculator
mLipok reacted to scintilla4evr for a topic
Hello. I want to introduce you a SIMPLE calculator made in AutoIt. Features: 3 modes: Basic, Scientific, Statistic Win7 calculator look Name from Big Bang Theory (episode 4x12) - The Suprisingly Helpful Equation-Linked Differential Optimized Numerator (The SHELDON) Here are some screenshots: Basic mode Scientific mode Statistic mode Enjoy! Now you can download it from my website: http://scintilla4evr.aq.pl/powercalculator (source will be added later) Power Calculator.zip (see changes below) Power Calculator.zip There are some errors in first code, so I give you corrected one. Error: When you write formula like this: 98 / pi ( ) it returns !error. Now it'll return 31.1943688460115. Also added "Put in clipboard" button. TODO: Skins1 point -
WinGetClientSize WinGetPos weird info
jaberwacky reacted to SiY11 for a topic
I figured it out! It was the way I called the the window Before: Local $Skyperesolution = WinGetClientSize("[Class:tSkMainForm]", $Skypehandle) After: Local $Skyperesolution = WinGetClientSize($Skypehandle) Complete code snip: ; Checks what resolution Skype is set to Local $Skyperesolution = WinGetClientSize($Skypehandle) MsgBox(0, "Current Skype Resolution", $Skyperesolution[0] &"x"& $Skyperesolution[1]) I started my programming class today and we are using Python. Funny, today was about variables, numbers vs floats, strings, and datatypes I would like to say I love Python and AutoIt!1 point -
the content of the lock file can be quite useful: you can have it indicate the hostname that locked it, or the time it was locked, so if the hostname is dead or too much time passed, another process can unlock it... but the general idea is well explained.1 point
-
tempman, This is how I would go about it: #include <Array.au3> ; Just for display ; Simulate reading the file into an array Global $aInitial_Array[12] = ["-----", "name1", "name2", "name3", "-----", "name4", "name5", "-----", "name6", "name7", "name8", "-----"] ; Declare an array large enough to hold all possible items Global $aTemp_Array[UBound($aInitial_Array)] ; And a counter Global $iCount = 0 For $i = 0 To UBound($aInitial_Array) - 1 ; Loop through the array looking for the next name If $aInitial_Array[$i] = "-----" Then ; Have we found any names? If $iCount Then ; Display them _ArrayDisplay($aTemp_Array, $iCount) ; Then write the file using _FileWriteFromArray - $iCount gives you the $iUbound parameter ; Finally reset the temp array and count for the next section Global $aTemp_Array[UBound($aInitial_Array)] $iCount = 0 EndIf Else ; Add the item to the temp array $aTemp_Array[$iCount] = $aInitial_Array[$i] ; Increase the count $iCount += 1 EndIf Next All clear? M231 point
-
The same as Phoenix' one but without conditions #include <Array.au3> $sPath = "F:\Fol.der1\Fol.der2\File" $aRet = StringRegExp($sPath, "([^\\]*)\\([^\\]+?$)", 3) _ArrayDisplay($aRet)1 point
-
Necessary Conditions The Path should end up with a file-name having an extension. There should be no "." periods in folder-name. #include <Array.au3> $sPath = "F:\Folder\File.xx" $aRet = StringRegExp($sPath, "([^\\]*)\\([^\\.]*\..*$)", 3) _ArrayDisplay($aRet) There is an _PathSplit() func included with Autoit, it should help you. Simultaneously if you search the forum you would get plently examples involved with _PathSplit and regex. Regards1 point
-
Try this change to your script. #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <GUIListBox.au3> #include <EditConstants.au3> #include <GUIConstantsEX.au3> Test() Func Test() Local $input, $list, $myGUI, $addItemNum = "|" $myGUI = GUICreate("Test", 200, 200) GUICtrlCreateLabel("Number of items", 5, 5, 100, 20, $SS_CENTER) $itemNums = GUICtrlCreateInput("", 5, 25, 100, 20, $ES_NUMBER ) $addNumber = GUICtrlCreateButton("Add &Number", 110, 5, 75, 40) $numberList = GUICtrlCreateList("", 5, 50, 190, 145, BitOR($WS_BORDER, $WS_VSCROLL, $WS_HSCROLL, _ $LBS_EXTENDEDSEL)) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $addNumber $addItemNum &= GUICtrlRead($itemNums) & "|" GUICtrlSetData($numberList, $addItemNum) GUICtrlSetData($itemNums, "") EndSelect WEnd GUIDelete() EndFunc1 point
-
I'm no regex Guru, but this works for me $sString = "F:\Folder1\Folder2\File.lst" $aFoldername = StringRegExp($sString, '.*\\(.*)\\', 3) $aFilename = StringRegExp($sString, '.*\\(.*)', 3)1 point
-
Sounds like another satisfied AutoIt customer1 point
-
Search the Example Scripts forum for the Powerpoint UDF. I think this UDF will do what you want.1 point
-
Runas System
DeltaRocked reacted to Gianni for a topic
news: for those who do not know it yet, I think it's useful to know that there is a completely free alternative to PSExec called PAExec fully compatible and, perhaps, even better. From their website: "PAExec - The Redistributable PsExec Microsoft's PsExec tool (originally by SysInternal's Mark Russinovich) is a favorite of system administrators everywhere. It just has two tiny flaws: PsExec can not be redistributed Sensitive command-line options like username and passwords are sent as clear text We needed something that would overcome those two issues, and not finding a suitable replacement, decided to write our own. PAExec Anyone can download and use PAExec. You can include it in your open source, freeware and even commercial applications. You may distribute it on your website, on CDs, mail to friends, etc. There is no cryptography built in so there aren't any export restrictions that we know of. See the License for all the legalese."1 point -
nping - Console network pinger / network sweeper / network scanner
MLO reacted to jvanegmond for a topic
nping.exe is a console line portable application that scans a network based on a supplied network address from any Windows machine. It is designed for system administrators and other people who are inclined to have need for a simple network scanner. This is finished and complete software. Output: Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\Jos>nping nping.exe scans a network based on a supplied network address. Usage: nping.exe [ipaddress] [local 1-4] [listlocal] Examples: nping.exe 192.168.0.0-1 will ping these addresses: 192.168.0.0 and 192.168.0.1 nping.exe 192.168.20.* will ping everything in the range from 192.168.20.1 to 192.168.20.255 nping listlocal gives you a list of local ipaddresses recognized by the program nping local pings your local network, if your ip addresses is 10.0.5.100 then it will p ing everything in 10.0.5.* C:\Users\Jos>nping 74.125.79.* Pinging 255 addresses in range of 74.125.79.* 74.125.79.4 has a roundtrip of 17 ms 74.125.79.5 has a roundtrip of 18 ms 74.125.79.6 has a roundtrip of 22 ms 74.125.79.18 has a roundtrip of 15 ms 74.125.79.27 has a roundtrip of 15 ms 74.125.79.32 has a roundtrip of 17 ms 74.125.79.47 has a roundtrip of 16 ms 74.125.79.52 has a roundtrip of 15 ms 74.125.79.53 has a roundtrip of 16 ms 74.125.79.54 has a roundtrip of 16 ms 74.125.79.57 has a roundtrip of 19 ms 74.125.79.58 has a roundtrip of 16 ms 74.125.79.77 has a roundtrip of 15 ms 74.125.79.79 has a roundtrip of 17 ms 74.125.79.81 has a roundtrip of 15 ms 74.125.79.82 has a roundtrip of 19 ms 74.125.79.84 has a roundtrip of 13 ms 74.125.79.85 has a roundtrip of 18 ms 74.125.79.86 has a roundtrip of 26 ms 74.125.79.91 has a roundtrip of 22 ms 74.125.79.111 has a roundtrip of 14 ms 74.125.79.114 has a roundtrip of 17 ms 74.125.79.116 has a roundtrip of 19 ms 74.125.79.118 has a roundtrip of 22 ms 74.125.79.142 has a roundtrip of 22 ms 74.125.79.143 has a roundtrip of 23 ms 74.125.79.147 has a roundtrip of 20 ms 74.125.79.149 has a roundtrip of 24 ms 74.125.79.161 has a roundtrip of 21 ms 74.125.79.166 has a roundtrip of 17 ms 74.125.79.184 has a roundtrip of 15 ms 74.125.79.206 has a roundtrip of 24 ms 74.125.79.222 has a roundtrip of 16 ms 74.125.79.223 has a roundtrip of 16 ms 74.125.79.224 has a roundtrip of 16 ms 74.125.79.225 has a roundtrip of 17 ms 74.125.79.226 has a roundtrip of 17 ms 74.125.79.231 has a roundtrip of 21 ms 74.125.79.237 has a roundtrip of 22 ms 74.125.79.230 has a roundtrip of 21 ms 74.125.79.250 has a roundtrip of 18 ms 74.125.79.252 has a roundtrip of 16 ms 74.125.79.254 has a roundtrip of 20 ms Ping statistics for 74.125.79.*: Total hosts pinged: 255 Total hosts UP: 43 [16.86%] Total hosts DOWN: 212 [83.14%] Average roundtrip: 18ms C:\Users\Jos> Tip ! Use the following command to write the results to a text file, you can then use a batch / AutoIt or VBS script to email you the results: nping 192.168.20.0-100 > networklog.txtIt will place the results in a file called networklog.txt Code: #NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=C:\Windows\Installer\{B924C008-D667-3B26-84C6-BD70285F9BFC}\Icon_app.ico #AutoIt3Wrapper_outfile=nping.exe #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_Change2CUI=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Constants.au3> #include <Array.au3> Global Const $MAX_PROCESS = 25 ; A maximum number of processes Global Const $MAX_HOSTS = 16777216 ; A maximum number of hosts to ping due to AutoIt's array limit size, and yes, I can work around it but no, I won't Local $networkRange = "" Local $showLocal = False Local $numOfLocalIp = 1 If @Compiled Then If $CmdLine[0] > 0 Then For $n = 1 to UBound($CmdLine)-1 Switch $CmdLine[$n] Case "/?", "?", "/help", "/info" _showHelp() Exit 0 case "listlocal", "locallist" ConsoleWrite("Local IP addresses known to this machine: " & @CRLF) ConsoleWrite("1: " & @IPAddress1 & @CRLF) ConsoleWrite("2: " & @IPAddress2 & @CRLF) ConsoleWrite("3: " & @IPAddress3 & @CRLF) ConsoleWrite("4: " & @IPAddress4 & @CRLF) ConsoleWrite(@CRLF) ConsoleWrite("Use: nping local # to ping all devices on these networks") Exit 0 case "local" $showLocal = True $n +=1 If $n < UBound($CmdLine) Then If $CmdLine[$n] = Number($CmdLine[$n]) Then $numOfLocalIp = Number($CmdLine[$n]) If $numOfLocalIp < 1 Or $numOfLocalIp > 4 Then ConsoleWrite("Local IP address index number must be between 1 and 4" & @CRLF) Exit 0 EndIf EndIf EndIf Case Else $networkRange = $CmdLine[1] EndSwitch Next Else _showHelp() Exit 0 EndIf EndIf If $showLocal Then $localIp = Execute("@IpAddress" & $numOfLocalIp) $ipParts = StringSplit($localIp, ".") $networkRange = $ipParts[1] & "." & $ipParts[2] & "." & $ipParts[3] & ".*" EndIf Local $tStart = TimerInit() $aArray = _GetIpAddressList($networkRange) If @error = 1 Then ConsoleWrite("There are no addresses to be scanned in this range. Check the syntax of your network range." & @CRLF & @CRLF) _showHelp() Exit 1 EndIf If @error = 2 Then ConsoleWrite("Maximum number of hosts to ping is " & $MAX_HOSTS & ", but you tried to ping " & @extended & " hosts" & @CRLF & @CRLF) _showHelp() Exit 1 EndIf Local $iTotal = UBound($aArray) If $iTotal = 1 Then ConsoleWrite("Pinging " & $iTotal & " address in range of " & $networkRange & @CRLF) Else ConsoleWrite("Pinging " & $iTotal & " addresses in range of " & $networkRange & @CRLF) EndIf ConsoleWrite(@CRLF) Local $aProcess[$MAX_PROCESS] ; An array to keep a reference to spawned processes, in the next loop we fill it with value 0 for reference For $i = 0 To UBound($aProcess) - 1 $aProcess[$i] = 0 Next Local $i = 0 ; which IP are we currently trying to ping ( based on array ) Local $iFinished = 0 ; how many processes have finished pinging Local $iUp = 0 ; Total hosts that are UP Local $iDown = 0 ; Total hosts that are DOWN Local $iTotalRoundTrip = 0 ; Total roundtrip (all the +ms added together) While 1 ; We check all the currently running processes For $n = 0 To UBound($aProcess) - 1 ; Check if we need a spot, and there is an existing spot here If ($i <> UBound($aArray) And $aProcess[$n] == 0) Then $aProcess[$n] = _MSPing($aArray[$i]) ; Spawn a new process in the available spot $i += 1 ; Increment $i so we can do the next process the next time around Else ; Check if this process has been spawned and the process is ready If ($aProcess[$n] <> 0 And _MSPingIsReady($aProcess[$n])) Then ; Get results from the command $sHostname = _MSPingGetHostname($aProcess[$n]) $sResult = _MSPingGetResult($aProcess[$n]) If ($sResult <> -1) Then ; Check if the host is up ConsoleWrite($sHostname & " has a roundtrip of " & $sResult & " ms" & @CRLF) $iUp += 1 $iTotalRoundTrip += $sResult Else $iDown += 1 EndIf ; Free up an empty space for the next address to Ping $aProcess[$n] = 0 ; Increment the total of processes that have finished $iFinished += 1 ; If the total number of finished processes If ($iFinished == UBound($aArray)) Then ExitLoop 2 ; Return EndIf EndIf Next Sleep(50) ; Give existing ping commands some time to process the request WEnd If $iUp = 0 Then ConsoleWrite("No devices replied to the ping in this range" & @CRLF) Exit 0 EndIf Local $percentageUp = Round($iUp / $iTotal * 100, 2) Local $percentageDown = 100-$percentageUp Local $tTotal = TimerDiff($tStart) Local $averageRoundTrip = Round($iTotalRoundTrip / $iUp) Local $sUpPad = "" Local $sDownPad = "" For $i = 0 To 6 - StringLen(String($iUp)) $sUpPad &= " " Next For $i = 0 To 6 - StringLen(String($iDown)) $sDownPad &= " " Next ConsoleWrite(@CRLF) ConsoleWrite("Ping statistics for " & $networkRange & ":" & @CRLF) ConsoleWrite(@TAB & "Total hosts pinged: " & $iTotal & @CRLF) ConsoleWrite(@TAB & "Total hosts UP: " & $iUp & $sUpPad & "[" & $percentageUp & "%]" & @CRLF) ConsoleWrite(@TAB & "Total hosts DOWN: " & $iDown & $sDownPad & "[" & $percentageDown & "%]" & @CRLF) ConsoleWrite(@TAB & "Average roundtrip: " & $averageRoundTrip & "ms" & @CRLF) Func _showHelp() ConsoleWrite("nping.exe scans a network based on a supplied network address." & @CRLF & @CRLF & _ "Usage: nping.exe [ipaddress] [local 1-4] [listlocal]" & @CRLF & @CRLF & _ "Examples: " & @CRLF & " nping.exe 192.168.0.0-1" & @CRLF & " will ping these addresses: 192.168.0.0 and 192.168.0.1" & @CRLF & _ " nping.exe 192.168.20.*" & @CRLF & " will ping everything in the range from 192.168.20.1 to 192.168.20.255" & @CRLF & _ " nping listlocal" & @CRLF & " gives you a list of local ipaddresses recognized by the program" & @CRLF & _ " nping local" & @CRLF & " pings your local network, if your ip addresses is 10.0.5.100 then it will ping everything in 10.0.5.*" & @CRLF) EndFunc Func _GetIpAddressList($ipFormat) If $ipFormat = "" Then Return SetError(1) EndIf $ipFormat = StringReplace($ipFormat, "*", "1-255") $ipSplit = StringSplit($ipFormat, ".") If $ipSplit[0] <> 4 Then TCPStartup() Local $ret[1] = [TCPNameToIP($ipFormat)] If @error Then Return SetError(1) Return $ret EndIf For $i = 1 To 4 If Not StringRegExp($ipSplit[$i], "[0-9\-]*") Then TCPStartup() Local $ret[1] = [TCPNameToIP($ipFormat)] If @error Then Return SetError(1) Return $ret EndIf Next Local $ipRange[4][2], $totalPermu = 1 For $i = 0 To 3 If StringInStr($ipSplit[$i + 1], "-") Then $m = StringSplit($ipSplit[$i + 1], "-") $ipRange[$i][0] = $m[1] $ipRange[$i][1] = $m[2] Else $n = Number($ipSplit[$i + 1]) $ipRange[$i][0] = $n $ipRange[$i][1] = $n EndIf $totalPermu *= $ipRange[$i][1] - $ipRange[$i][0] + 1 Next If $totalPermu > $MAX_HOSTS Then Return SetError(2, String($totalPermu)) EndIf Local $result[$totalPermu], $i = 0 For $a = $ipRange[0][0] To $ipRange[0][1] For $b = $ipRange[1][0] To $ipRange[1][1] For $c = $ipRange[2][0] To $ipRange[2][1] For $d = $ipRange[3][0] To $ipRange[3][1] $result[$i] = $a & "." & $b & "." & $c & "." & $d $i += 1 Next Next Next Next Return $result EndFunc ;==>_GetIpAddressList Func _Exit() Exit EndFunc ;==>_Exit Func _MSPing($sHostname, $timeout = 50) Local $return_struc[4] ; [0] = Result (in ms) ; [1] = The hostname originally used ; [2] = Process handle (for internal use only) ; [3] = Buffer (for internal use only) $return_struc[1] = $sHostname $return_struc[2] = Run("ping " & $sHostname & " -n 1 -w " & $timeout, "", @SW_HIDE, $STDOUT_CHILD) Return $return_struc EndFunc ;==>_MSPing Func _MSPingIsReady(ByRef $return_struc) Return ___MSPingReadOutput($return_struc) EndFunc ;==>_MSPingIsReady Func _MSPingGetResult($return_struc) Return $return_struc[0] EndFunc ;==>_MSPingGetResult Func _MSPingGetHostname($return_struc) Return $return_struc[1] EndFunc ;==>_MSPingGetHostname ; Internal use only Func ___MSPingReadOutput(ByRef $return_struc) $data = StdoutRead($return_struc[2]) If (@error) Then ___MSPingParseResult($return_struc) Return 1 Else $return_struc[3] &= $data Return 0 EndIf EndFunc ;==>___MSPingReadOutput ; Internal use only Func ___MSPingParseResult(ByRef $return_struc) $result = StringRegExp($return_struc[3], "([0-9]*)ms", 3) If @error Then $return_struc[0] = -1 Else $return_struc[0] = $result[0] EndIf EndFunc ;==>___MSPingParseResult Old version downloads: 180 Download: nping.exe1 point