Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/03/2016 in all areas

  1. Just a fast hack for next Thursday. Maybe too early but who cares... Source: ;coded by UEZ build 2016-01-08 ;~ #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #pragma compile(Icon, "c:\Program Files (x86)\AutoIt3\Icons\au3.ico") #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /pe /rm #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_stripped.au3" #include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include "BassConstants.au3" #include "Bass.au3" _GDIPlus_Startup() Global $hGUI, $iFPS = 0, $iFrames = 0, $iShowFPS = 0, $fTimer, $bExit, $aAudio Global Const $iW = @DesktopWidth, $iH = @DesktopHeight, $iWh = $iW / 2, $iHh = $iH / 2, $sTitle = "GDI+ Simple Firework by UEZ" Global Const $fPi = ACos(-1), $fRad = $fPi / 180, $iMaxParticles = 51, $iFireworks = 10, $iParticleSize = 4 Global $iElements = 9, $aCoords[$iFireworks][$iElements + $iMaxParticles * 4 - 3] ;don't touch these values AutoItSetOption("GUIOnEventMode", 1) GDIPlus_SimpleFirework() AutoItSetOption("GUIOnEventMode", 0) _GDIPlus_Shutdown() Func GDIPlus_SimpleFirework() $bExit = False $hGUI = GUICreate($sTitle & 0, $iW, $iH, 0, 0, $WS_POPUP) GUISetState(@SW_SHOW, $hGUI) WinSetTrans($hGUI, "", 0xF8) GUISetCursor(16, 1) ;create canvas elements Local Const $hDC = _WinAPI_GetDC($hGUI) Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH) Local Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Local Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) Local Const $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetPixelOffsetMode($hCanvas, $GDIP_PIXELOFFSETMODE_HIGHQUALITY) Local Const $hBrush = _GDIPlus_BrushCreateSolid(0xFFE0E0E0), _ $hBrush_Clr = _GDIPlus_BrushCreateSolid(0x70000000), _ $hBrush_Txt = _GDIPlus_BrushCreateSolid(0x10202020), $hBrush_FPS = _GDIPlus_BrushCreateSolid(0xA0505050), _ $hFormat = _GDIPlus_StringFormatCreate(), $hFormat_FPS = _GDIPlus_StringFormatCreate(), _ $hFamily = _GDIPlus_FontFamilyCreate("Impact"), $hFamily_FPS = _GDIPlus_FontFamilyCreate("Arial"), _ $hFont = _GDIPlus_FontCreate($hFamily, $iH / 4.5), $hFont_FPS = _GDIPlus_FontCreate($hFamily_FPS, 8), _ $tLayout = _GDIPlus_RectFCreate(0, 0, $iW, $iH), $tLayout_FPS = _GDIPlus_RectFCreate(0, 0, 150, 32) _GDIPlus_StringFormatSetAlign($hFormat, 1) _GDIPlus_StringFormatSetLineAlign($hFormat, 1) Local $iX, $iY, $j = -2^32 + 1, $bAudio = True ;init sound _BASS_STARTUP() _BASS_Init(0, -1, 44100, 0, "") If @error Then $bAudio = False Local $aAudio[$iFireworks][2], $hAudio_Whoa, $hAudio_BgNoise For $iY = 0 To $iFireworks - 1 ;generated firework particles GenCoordinates($iY, $aCoords, 1.5, 3.5, 1, 5.5) If $bAudio Then $aAudio[$iY][0] = _BASS_StreamCreateFile(False, @ScriptDir & "\" & Random(1, 7, 1) & ".mp3", 0, 0, 0) $aAudio[$iY][1] = 0 EndIf Next $hAudio_Whoa = _BASS_StreamCreateFile(False, @ScriptDir & "\ApplauseWoah.mp3", 0, 0, 0) $hAudio_BgNoise = _BASS_StreamCreateFile(False, @ScriptDir & "\BgNoise.mp3", 0, 0, 0) _BASS_ChannelPlay($hAudio_BgNoise, True) $iFPS = 0 GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit_About") AdlibRegister("CalcFPS", 1000) Local $iAlpha, $iCounterFX = 0, $iCounterParticles = 0 $fTimer = TimerInit() Do DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush_Clr, "float", 0, "float", 0, _ "float", $iW, "float", $iH) ;erase canvas background _GDIPlus_GraphicsDrawStringEx($hCanvas, "Happy new year 2016", $hFont, $tLayout, $hFormat, $hBrush_Txt) ;draw background message text For $iY = 0 To $iFireworks - 1 ;calculate and draw firework particles If $aCoords[$iY][1] > $aCoords[$iY][4] Then ;draw rocket only until explosion $aCoords[$iY][0] += $aCoords[$iY][2] ;x vector $aCoords[$iY][1] -= Abs($aCoords[$iY][3] * 10) ;y vector should be in upper direction only _GDIPlus_BrushSetSolidColor($hBrush, 0x60909090) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", $aCoords[$iY][0], "float", $aCoords[$iY][1], "float", 2, "float", 2) $iCounterParticles += 1 For $iX = $iElements To UBound($aCoords, 2) - 5 Step 4 $aCoords[$iY][$iX] = $aCoords[$iY][0] ;copy x position $aCoords[$iY][$iX + 1] = $aCoords[$iY][1] ;copy y position Next Else For $iX = $iElements To UBound($aCoords, 2) - 5 Step 4 $aCoords[$iY][$iX] += $aCoords[$iY][$iX + 2] ;x coordinate $aCoords[$iY][$iX + 1] += $aCoords[$iY][$iX + 3] + $aCoords[$iY][8] ;y coordinate $aCoords[$iY][$iX + 2] *= 0.98 ;neg. accelaration of x vector $aCoords[$iY][$iX + 3] *= 0.98 ;neg. accelaration of y vector $iAlpha = $aCoords[$iY][6] > 0xFF ? 0xFF : $aCoords[$iY][6] Switch $aCoords[$iY][7] ;choose color mode Case 0 To 3 _GDIPlus_BrushSetSolidColor($hBrush, Int($iAlpha) * 0x1000000 + $aCoords[$iY][5]) Case Else Switch Mod($j, 3) Case 0 _GDIPlus_BrushSetSolidColor($hBrush, Int($iAlpha) * 0x1000000 + 0x10000 * Random(0xD0, 0xFF, 1) + 0x100 * Random(0xD0, 0xFF, 1) + Random(0xD0, 0xFF, 1)) Case Else _GDIPlus_BrushSetSolidColor($hBrush, Int($iAlpha) * 0x1000000 + 0x10000 * Random(0x40, 0xA0, 1) + 0x100 * Random(0x40, 0xA0, 1) + Random(0x40, 0xA0, 1)) EndSwitch $j += 1 EndSwitch ;draw only visible particles If BitAND($aCoords[$iY][$iX] > -1, $aCoords[$iY][$iX] < $iW, $aCoords[$iY][$iX + 1] > -1, $aCoords[$iY][$iX + 1] < $iH) Then DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hCanvas, "handle", $hBrush, _ "float", $aCoords[$iY][$iX], "float", $aCoords[$iY][$iX + 1], _ "float", $iParticleSize, "float", $iParticleSize) ;draw firework particles $iCounterParticles += 1 EndIf Next $aCoords[$iY][6] *= 0.933 ;decrease alpha channel $aCoords[$iY][8] *= 1.075 ;gravity accelaration (y axis) -> earth's gravitational force simulation If Not $aAudio[$iY][1] And $bAudio Then ;play audio fx _BASS_ChannelPlay($aAudio[$iY][0], False) $aAudio[$iY][1] = 1 $iCounterFX += 1 EndIf If $aCoords[$iY][6] < 0x08 Then ;reset firework elements $aAudio[$iY][1] = 0 GenCoordinates($iY, $aCoords) EndIf EndIf Next If $iCounterFX > 2 Then _BASS_ChannelPlay($hAudio_Whoa, False) EndIf _GDIPlus_GraphicsDrawStringEx($hCanvas, "FPS: " & $iShowFPS & @CRLF & "Particles: " & $iCounterParticles, $hFont_FPS, $tLayout_FPS, $hFormat_FPS, $hBrush_FPS) ;draw background message text _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hDC_backbuffer, 0, 0, $SRCCOPY) ;blit drawn bitmap to GUI $iCounterFX = 0 $iCounterParticles = 0 $iFPS += 1 $iFrames += 1 If $bExit Then ExitLoop Until Not Sleep(10) AdlibUnRegister("CalcFPS") ;release resources _GDIPlus_FontDispose($hFont) _GDIPlus_FontDispose($hFont_FPS) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_FontFamilyDispose($hFamily_FPS) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_StringFormatDispose($hFormat_FPS) _GDIPlus_BrushDispose($hBrush) _GDIPlus_BrushDispose($hBrush_Clr) _GDIPlus_BrushDispose($hBrush_Txt) _GDIPlus_BrushDispose($hBrush_FPS) _GDIPlus_GraphicsDispose($hCanvas) _WinAPI_SelectObject($hDC, $DC_obj) _WinAPI_DeleteObject($hHBitmap) _WinAPI_ReleaseDC($hGUI, $hDC) GUIDelete($hGUI) If $bAudio Then For $iY = 0 To $iFireworks - 1 _BASS_ChannelStop($aAudio[$iY][0]) Next _BASS_ChannelStop($hAudio_Whoa) _BASS_ChannelStop($hAudio_BgNoise) _BASS_Free() EndIf EndFunc ;==>GDIPlus_SimpleFirework Func GenCoordinates($iY, ByRef $aCoords, $fVXmin = 2.5, $fVXmax = 15.5, $fVYmin = 1.5, $fVYmax = 5.5) Local $aColors[7] = [0xFF0000, 0x00FF00, 0x0000FF, 0xFFFF00, 0xFF7514, 0xFFFFFF, 0x40E0D0] $aCoords[$iY][0] = $iWh ;x coordinate (x coordinate of starting point) $aCoords[$iY][1] = $iH ;y coordinate (y coordinate of starting point) $aCoords[$iY][2] = Random($fVXmin, $fVXmax) * (Random(0, 1, 1) = 0 ? -1 : 1) ;x vector (direction of rocket) $aCoords[$iY][3] = Random($fVYmin, $fVYmax) * (Random(0, 1, 1) = 0 ? -1 : 1) ;y vector (direction of rocket) $aCoords[$iY][4] = Random($iH * 0.15, $iH * 0.35) ;area of detonation ;~ $aCoords[$iY][5] = 0x10000 * Random(0x40, 0xE0, 1) + 0x100 * Random(0x40, 0xE0, 1) + Random(0x40, 0xE0, 1) ;random color $aCoords[$iY][5] = $aColors[Random(0, 6, 1)] ;random color $aCoords[$iY][6] = 0x250 ;alpha channel value $aCoords[$iY][7] = Random(0, 8, 1) ;value for color mode $aCoords[$iY][8] = 0.15 ;gravity accelaration (y axis) initial value Local $iX, $fSpeed, $fRadius, $iFX = Random(1, 20, 1), $e = Random(5, 25), $h = 0, $g = 360 / ($iMaxParticles - 1), _ $j = 360 / 10, $jj = $j, $k = Random(0.5, 1.5), $kk = Random(1, 3.5), $l = 0 For $iX = $iElements To UBound($aCoords, 2) - 5 Step +4 Switch $iFX Case 1 To 3 $fSpeed = Cos($g * $iFX * $e * $iX) * $e $fRadius = $fSpeed / 2 Case 4 To 6 $fSpeed = Sin($iX / 7.85) * $e ;particle speed (explosion strength) $fRadius = $fSpeed / 2 Case 7 To 9 $fSpeed = Tan($iX / 2) + $e ;particle speed (explosion strength) $fRadius = $fSpeed / 2 Case 10 To 12 $fSpeed = Cos($iX / 2.5) + $e ;particle speed (explosion strength) $fRadius = $fSpeed / 2 Case 13 To 15 ;create circular effect $fSpeed = Random($e, $e + 0.333333) ;particle speed (explosion strength) $fRadius = $fSpeed / 2 Case 16 To 18 $fSpeed = $e $fRadius = $k $h = $jj $jj += $j If $jj > 360 Then $jj = $j - $l $k += $kk $l += Random(1, 15) EndIf Case Else $fSpeed = Random(5, 25) ;particle speed (explosion strength) $fRadius = $fSpeed / 2 EndSwitch $aCoords[$iY][$iX + 2] = ($fSpeed + Cos($h * $fRad) * $fRadius) - $fSpeed ;x vector particle speed $aCoords[$iY][$iX + 3] = ($fSpeed + Sin($h * $fRad) * $fRadius) - $fSpeed ;y vector particle speed $h += $g ;next angle Next EndFunc ;==>GenCoordinates Func _Exit_About() $bExit = True EndFunc ;==>_Exit_About Func CalcFPS() ;display FPS $iShowFPS = $iFPS & " / Ø " & Round($iFrames / TimerDiff($fTimer) * 1000, 4) $iFPS = 0 EndFunc ;==>CalcFPS Sound FX and other files are in the archive only! Sounds best with earphones Speed: ~17 FPS on Intel Core i5 4300U @ 2.6 GHz CPU (1600x900). If it is too slow on your machine decrease the values for $iMaxParticles and $iFireworks. Download available in download section. Use e.g. 7-Zip to open archive. Happy new year...
    1 point
  2. 2016-Jan-03, Changelog v9 > v10 Updated - Improved file and duplicates search speedFixed - Duplicates Search "Hash-Cache" functionality worked sub-optimal, now brings real improvement on repeated searchesReport - Improved speed of TNP Thumbnail ProviderReport - Added thumbnail and icon cache functionalityReport - Added custom cell highlighting featureReport - Added optional checkboxes in Filename ColumnReport - Improved Copy/MoveTo dialogReport - Column order/size, OFFSET and LIMIT are now savedReport - Save Styles fixedUpdated - Treeview functionsAdded - Optional Explorer Contextmenu entry to "Search with SMF for duplicate files"Updated - Lots of other bug fixes and style changesUpdated - SQLite Dll to 3.9.2Updated - MediaInfo Dll to 0.7.81Updated - TrID Definitions to version 2015 Dec 29Source and Executable are available at http://www.funk.eu Best Regards Updated first Post... Enjoy ...
    1 point
  3. TheDcoder, Assuming that you create the extended information at the same time as a ListView row, you can use an array to very easily link the two elements: #include <GUIConstantsEx.au3> #include <GuiListView.au3> Global $aData[2][2] = [["Foo|Bar", "Comman Placeholder"], ["Baz|Qux", "Rare Placeholders"]] $Form1 = GUICreate("Form1", 267, 206, 192, 124) $ListView1 = GUICtrlCreateListView("Col 1|Col 2", 8, 8, 250, 150) $Button1 = GUICtrlCreateButton("Get Extended", 8, 168, 251, 25) GUISetState(@SW_SHOW) For $i = 0 To UBound($aData) - 1 GUICtrlCreateListViewItem($aData[$i][0], $ListView1) Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $iIndex = _GUICtrlListView_GetSelectedIndices($ListView1) If $iIndex <> "" Then MsgBox($MB_SYSTEMMODAL, "Extended", $aData[$iIndex][1]) EndIf EndSwitch WEndJust add a new row to the array each time you create a ListView row. M23
    1 point
  4. Malkey

    Remove specific char

    You could try this. ; Create test file "fkz51t.txt" Local $hFileOpen = FileOpen("fkz51t.txt", 2) Local $FileContents = _ ChrW(0) & ChrW(0) & ChrW(0) & ChrW(5) & ChrW(3) & @CRLF & _ ChrW(0) & ChrW(0) & ChrW(0) & ChrW(0) & ChrW(4) & @CRLF & _ ChrW(0) & ChrW(0) & ChrW(0) & ChrW(0) & ChrW(4) & @CRLF & _ ChrW(0) & ChrW(0) & ChrW(0) & ChrW(0) & ChrW(4) FileWrite($hFileOpen, $FileContents) FileClose($hFileOpen) ; Replace Null with "Hello" Local $hFileOpen = FileOpen("fkz51t.txt", 16) Local $data = StringReplace(FileRead($hFileOpen), "00", StringTrimLeft(StringToBinary("Hello"), 2)) ; "00" (binary) = ChrW(0) = null FileClose($hFileOpen) FileDelete("fkz51t.txt") ; Write modified file contents to file FileWrite("fkz51t.txt", BinaryToString($data)) ; Display contents of file. ConsoleWrite(FileRead("fkz51t.txt") & @LF)
    1 point
  5. guinness

    Remove specific char

    Look at the help file for FileOpen.
    1 point
  6. mikell

    API Upload XML WinHttp

    I'm not the OP but ... many thanks anyway
    1 point
  7. trancexx

    API Upload XML WinHttp

    Ok, done. The example would be: #include "WinHTTP.au3" $sAddress = "https://posttestserver.com/post.php?dir=WinHttp" ; the address of the target (https or http, makes no difference - handled automatically) ; Select some file $sFileToUpload = FileOpenDialog("Select file to upload...", "", "All Files (*)") If Not $sFileToUpload Then Exit 5 ; check if the file is selected and exit if not $sForm = _ '<form action="' & $sAddress & '" method="post" enctype="multipart/form-data">' & _ ' <input type="file" name="upload"/>' & _ '</form>' ; Initialize and get session handle $hOpen = _WinHttpOpen() $hConnect = $sForm ; will pass form as string so this is for coding correctness because $hConnect goes in byref ; Creates progress bar window ProgressOn("UPLOADING", $sFileToUpload, "0%") ; Register callback function _WinHttpSimpleFormFill_SetCallback(UploadCallback) ; Fill form $sHTML = _WinHttpSimpleFormFill($hConnect, $hOpen, _ Default, _ "name:upload", $sFileToUpload) ; Collect error number $iErr = @error ; Unregister callback function _WinHttpSimpleFormFill_SetCallback(0) ; Kill progress bar window ProgressOff() ; Close handles _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) If $iErr Then MsgBox(4096, "Error", "Error number = " & $iErr) Else ConsoleWrite($sHTML & @CRLF) MsgBox(4096, "Success", $sHTML) EndIf ; Callback function. For example, update progress control Func UploadCallback($iPrecent) If $iPrecent = 100 Then ProgressSet(100, "Done", "Complete") Sleep(800) ; give some time for the progress bar to fill-in completely Else ProgressSet($iPrecent, $iPrecent & "%") EndIf EndFuncAnd the latest (working version of) WinHttp.au3 is at https://raw.githubusercontent.com/dragana-r/autoit-winhttp/master/WinHttp.au3 Try it, maybe I leave it in.
    1 point
  8. I would say that sensible real-world example would be any script that used to work and now it doesn't.
    1 point
  9. trancexx

    API Upload XML WinHttp

    You will always have to wait for upload to finish before continuing in AutoIt. The language isn't capable for parallel executions. What I can do is add new function to WinHttp.au3 that could be used to set callback function that would be called during upload process periodically, in which you could control/update progress bar or whatever. Yea, I think I'll do that.
    1 point
  10. Of course it worked. The feature was controlled by Opt("MustDeclareVars"). This is script breaking change, which apparently isn't documented. If there was "general consensus" on this, then I question the ability of participants to make decisions like that.
    1 point
  11. JohnOne

    _Ipv4ToInt()

    I couldnt find this func in a search, but I dont have smashing search skills so apologies if its already knocking about. Converts an IP Address to and Integer and visaversa. Solution calculations from: http://www.aboutmyip.com/ EDIT: 15th Jan 2013 Google changed IP, updated to keep example working. ; Example 1. use google IP $_Ipv4ToInt = _Ipv4ToInt("173.194.66.94") MsgBox(0,"_Ipv4ToInt",$_Ipv4ToInt) ShellExecute("http://" & $_Ipv4ToInt) ; Example 2. Use int generated from _Ipv4ToInt $_IntToIpv4 = _IntToIpv4($_Ipv4ToInt) MsgBox(0,"_IntToIpv4",$_IntToIpv4) ShellExecute("http://" & $_IntToIpv4) ;============================================================================= ; Converts an Int into an IP ;============================================================================= Func _IntToIpv4($_Int) $oct1 = $_Int / 16777216 $_Int = Mod($_Int, 16777216) $oct2 = Int($_Int) / 65536 $_Int = Mod($_Int, 65536) $oct3 = $_Int / 256 $_Int = Mod($_Int, 256) $oct4 = $_Int $sIP = Int($oct1) & "." & Int($oct2) & "." & Int($oct3) & "." & Int($oct4) Return String($sIP) EndFunc ;==>_IntToIpv4 ;============================================================================= ; Converts an IP into an int ;============================================================================= Func _Ipv4ToInt($_IP) $aIP = StringSplit($_IP, ".", 3) $oct1 = Int($aIP[0]) * (256 ^ 3) $oct2 = Int($aIP[1]) * (256 ^ 2) $oct3 = Int($aIP[2]) * (256) $oct4 = Int($aIP[3]) $iInt = $oct1 + $oct2 + $oct3 + $oct4 Return $iInt EndFunc ;==>_Ipv4ToInt
    1 point
  12. I pulled out the dec to binary, and made an IP / Subnet / Gateway checker. I realize that there is probably a cleaner, nicer way to do this. Probably using regular expression. But I needed something quick for some routers. So Here is what I have. func _subnet_validation($ip2check,$mask2check,$gw2check) ;check for ip and gw duplication if $ip2check = $gw2check Then return 0 EndIf local $bin_ip , $bin_mask, $bin_gw , $bit_ip , $bit_mask , $bit_gw , $end_of_networks local $ip_array = StringSplit($ip2check,".") local $mask_array = StringSplit($mask2check,".") local $gw_array = StringSplit($gw2check,".") if $debug > 0 then MsgBox(0,"ip array[0]",$ip_array[0]) ;check to make sure each has 4 octets if $ip_array[0] <> 4 or $mask_array[0] <> 4 or $gw_array[0] <> 4 Then return 0 EndIf for $loop = 1 to 4 ;check to make sure they are 0-255 if $ip_array[$loop] < 0 or $mask_array[$loop] < 0 or $gw_array[$loop] < 0 _ or $ip_array[$loop] > 255 or $mask_array[$loop] > 255 or $gw_array[$loop] > 255 Then return 0 EndIf $bin_ip = _DecToBinary($ip_array[$loop]) $bin_mask = _DecToBinary($mask_array[$loop]) $bin_gw = _DecToBinary($gw_array[$loop]) if $debug > 3 then MsgBox(0,' bin_ip , bin_mask , bin_gw',$bin_ip & " , " & $bin_mask & " , " & $bin_gw) ;check bit by bit for $binary_loop = 1 to 8 $bit_ip = StringMid($bin_ip,$binary_loop,1) $bit_mask = StringMid($bin_mask,$binary_loop,1) $bit_gw = StringMid($bin_gw,$binary_loop,1) if $debug > 4 then MsgBox(0,'bits for ip , mask , gw',$bit_ip & " , " & $bit_mask & " , " & $bit_gw ) ;check to make sure the mask it good if $bit_mask = 0 then $end_of_networks = 1 ;if we are still part of the network portion if $bit_mask = 1 then ;if the mask went to 0, and back to 1, that's bad if $end_of_networks = 1 then Return 0 EndIf if $bit_ip <> $bit_gw then return 0 EndIf EndIf Next Next return 1 EndFunc ; Decimal To Binary ;code lifted from http://www.autoitscript.com/forum/index.php?showtopic=70507&hl=binary ;thanks ptrex Func _DecToBinary($iDec) Local $i, $extra,$sBinChar = "" If StringRegExp($iDec,'[[:digit:]]') then $i = 1 Do $x = 16^$i $i +=1 ; Determine the Octects Until $iDec < $x For $n = 4*($i-1) To 1 Step -1 If BitAND(2 ^ ($n-1), $iDec) Then $sBinChar &= "1" Else $sBinChar &= "0" EndIf Next ;flesh out to 8 characters $extra = _StringRepeat("0",8 - StringLen($sBinChar)) $sBinChar = $extra & $sBinChar Return $sBinChar Else MsgBox(0,"Error","Wrong input, try again ...") Return EndIf EndFunc
    1 point
×
×
  • Create New...