Leaderboard
Popular Content
Showing content with the highest reputation on 10/23/2020 in all areas
-
Specifying $ES_NOHIDESEL works. Maybe there was something changed in how edit controls are generated? #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <WindowsConstants.au3> Example() Func Example() Local $hGUI = GUICreate(@AutoItVersion, 400, 300) Local $idEdit = GUICtrlCreateEdit("", 2, 2+20, 394, 268-20, $ES_NOHIDESEL) Local $but = GUICtrlCreateButton("ok", 2, 2, 60, 20) GUISetState(@SW_SHOW) _GUICtrlEdit_SetText($idEdit, "Hsdf asdf ksdfhg jsdfghjsdf gdsd") While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $but _GUICtrlEdit_SetSel($idEdit, 5, 15) EndSwitch WEnd EndFunc ;==>Example3 points
-
get file size using handle
Musashi and one other reacted to pixelsearch for a topic
@orbs: I tried it that way : $hFile = FileOpen("autoit-v3.3.15.3.zip") FileSetPos($hFile, 0, $FILE_END) ConsoleWrite(FileGetPos($hFile) & @lf) It displayed 17490098 which is the correct size (as shown in Explorer)2 points -
The correct syntax of _WD_ElementOptionSelect is _WD_ElementOptionSelect($sSession, $sStrategy, $sSelector[, $sStartElement = Default]) and this will click on the option box, not select an option item. The following is the actual Select element I interact with and the code in my first post works well. <select name="ctl00$ContentPlaceHolder1$ddlMobile1" id="ctl00_ContentPlaceHolder1_ddlMobile1"> <option value="">선택</option> <option selected="selected" value="010">010</option> <option value="011">011</option> <option value="016">016</option> <option value="017">017</option> <option value="018">018</option> <option value="019">019</option> </select> You may want to confirm that the correct Select element was identified to begin with.2 points
-
You must be right. Now I remember @Danp2 wrote several functions to deal with option selection. The above code of mine is from my old script which worked and is currently working OK for me. Thanks for pointing out.2 points
-
Changing : GUICtrlSetState($edit, $GUI_FOCUS) to : ControlFocus($hGUI, "", $Edit) Fixes the issue in the original script. Does anybody know why we need to set the focus as I would have thought the Windows Message was send to the control without the requirement for giving it the focus? ..... I haven't look under the hood as yet...1 point
-
The problem with this one is, you won't catch a row that has no empty cells on it's columns. So add +1 to the column count. Additional Notes: (I am more proficient in Excel VBA than AutoIt, so not sure if these are valid here. Please consider them as informational rather than a solution to your case). In Excel you don't need to get a range into an array to get it's row/column counts. Considering you can select the range without needing to set a range (VBA stuff), you can issue "selection.rows.count" which will return the count. So it becomes: 1. Select the range: UsedRange.Columns("C:C").Select 2. Get row count: Selection.Rows.Count 3. Additionally if you need the starting row of range: Selection.Row Adding the $oData ("I2:AM" & ..) bit to this: You don't need to count the rows even - If you know the number of columns and which column they start at for the ultimate range you want (in 1 step). Numbers used are just as an example: UsedRange.Columns("C:C").Resize(,5).Offset(0,6).Select Here, Resize(,5) means you don't want to resize rows, and resize columns to 5 Offset(0,6) means offset the range by 0 rows (+ is downward) and +6 columns ( + is towards right) These value are with respect to the upper leftmost cell of selection/range. And another last option is to not select it at all (remember you don't need to select, maybe AutoIt requires it, idk). Also, if UsedRange is enough for rows data, then you don't even need Columns("C:C") part. Since UsedRange rows won't change however column you select. Array = UsedRange.Resize(,5).Offset(0,6) - (here offset number for column should change since now you are offsetting from the start column rather than C). Get your array in 1 line of code, and it is fast. And if you can get this into an array in AutoIt with _ExcelRangeRead that would be golden.1 point
-
I'm not sure now. Maybe you could also use ; Name ..........: _WD_SetElementValue ; Description ...: Set value of designated element ; Syntax ........: _WD_SetElementValue($sSession, $sElement, $sValue)1 point
-
I think you meant... ; Name ..........: _WD_ElementOptionSelect ; Description ...: Find and click on an option from a Select element ; Syntax ........: _WD_ElementOptionSelect($sSession, $sStrategy, $sSelector[, $sStartElement = Default]) @NguyenDuc _WD_ElementOptionSelect($gsSession, $_WD_LOCATOR_ByXPath, "//select[@name='PartnerGroup']/option[@value='1']")1 point
-
@NguyenDuc, First you find the element ID of <select> tag with _WD_FindElement and then change the value of that element with _WD_ElementAction. $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//select[@name='PartnerGroup']") _WD_ElementAction($sSession, $sElement, "value", "2") ; if you want to select the 2nd option1 point
-
#AutoIt3Wrapper_Res_Icon_Add trouble
abberration reacted to TheXman for a topic
The compiled example below does not use any external ico files. They're all embedded in the the executable's resource data, like your original example. You will notice that the example is almost exactly like the one I referred you to. The only difference is that I refer to the embedded icons by their resource IDs in the exe's resource data. Note: You will most likely need to change the path of the AutoIt ico files and recompile the example. You MUST compile the example to see the embedded icons, you will not see the ico images by running the script in the IDE. ;NOTE: To see the embedded icons, the script MUST BE COMPILED. #NoTrayIcon #AutoIt3Wrapper_Res_Icon_Add="C:\AutoIt3\Icons\MyAutoIt3_Red.ico" ;resource id will be -201 #AutoIt3Wrapper_Res_Icon_Add="C:\AutoIt3\Icons\MyAutoIt3_Blue.ico" ;resource id will be -202 #AutoIt3Wrapper_Res_Icon_Add="C:\AutoIt3\Icons\MyAutoIt3_Green.ico" ;resource id will be -203 #include <GUIMenu.au3> #include <Constants.au3> #include <WinAPIGdi.au3> #include <WinAPIShellEx.au3> #include <WinAPISys.au3> Opt('TrayMenuMode', 3) example() Func example() ;Build tray menu Local $hMenu = TrayItemGetHandle(0) Local $iRed = TrayCreateItem('Red Item') Local $iBlue = TrayCreateItem('Blue Item') Local $iGreen = TrayCreateItem('Green Item') TrayCreateItem('') Local $idExit = TrayCreateItem('Exit') ;Assign ico images to the tray menu items _GUICtrlMenu_SetItemBmp($hMenu, 0, _WinAPI_Create32BitHBITMAP(_WinAPI_ShellExtractIcon(@ScriptFullPath, -201, 16, 16), 1, 1)) _GUICtrlMenu_SetItemBmp($hMenu, 1, _WinAPI_Create32BitHBITMAP(_WinAPI_ShellExtractIcon(@ScriptFullPath, -202, 16, 16), 1, 1)) _GUICtrlMenu_SetItemBmp($hMenu, 2, _WinAPI_Create32BitHBITMAP(_WinAPI_ShellExtractIcon(@ScriptFullPath, -203, 16, 16), 1, 1)) TraySetState() Do Until TrayGetMsg() = $idExit EndFunc For the record, there's no need to give me any credit for helping you with your project. If you do, I'm okay with it, but it is not something that I seek. I don't help other to get any sort of credit or "likes". When I help others it is because I choose to and because helping others helps me. All I look for is a simple "thank you".1 point -
Yeah, I am not that used to using UsedRange as well due to this nature, but then never needed it for my purposes. My 1st code, goes through all rows in used range though and finds the max column no for each. Then either you can keep an array for each row, or make one max col variable and update it. He started with only the last used cell but conversation somehow changed to having empty rows. So not sure what is required atm. Maybe I am understanding it all wrong1 point
-
Getting Value from Last Used Row in a defined range
Siwa reacted to seadoggie01 for a topic
Row.cell.count counts the number of cells in the row, not the number of cells with data like the formula =Count(1:1) Row.Cell.Count returns either 2^8 (xls) or 2^16 (xlsx) One issue with using .UsedRange is that it doesn't always return the "correct" range as being used... I'm unsure of the circumstances, but I remember having issues with this and .SpecialCells(xlCellTypeLastCell) returning the wrong cells occasionally. Also, Siwa mentioned that they wanted the last used cell in a particular column (if I read correctly). Using .UsedRange would return the last used column in the entire sheet, but it might not be the last column the that particular row. Like if you have data in A1 and B2 and call .UsedRange.Columns.Count it would return 2 instead of the expected 1 for Row 1.1 point -
@seadoggie01 Siwa is saying he has empty cells too, so would "row.cell.count" work in that case? Also some empty rows in between In Excel (not sure about AutoIt), you can just use Sheets("name").UsedRange for getting whole range with spaces in between. Then you can do something like this Range = Sheets("sheetname").UsedRange MaxColInRange = Range.Column + Range.Columns.Count -1 For i = Range.Row to (Range.Row + Range.Rows.Count-1) MaxColumnInRow_i = Cells(i, MAxColInRange + 1).End(xlToLeft).Column ; +1 so that you can catch the row with max columns Array[i] = MaxColumnInRow_i next i ----------------- Adding Range.Row and Range.Column to row/column counts since data may not be starting from row = 1, column = 1 Note: From the page linked a few posts above (The UsedRange represents a Range used by an Excel Worksheet. The Used Range starts at the first used cell and ends with the most right, down cell that is used by Excel. This last cell does not need to have any values or formulas as long as it was edited or formatted in any point in time) Or if that doesn't work: A bit more lengthy and can't really test this at the moment, but will give the algorithm. See how you guys like it. MaxEmptyRows= 10 ; Max. Expected Empty Rows InBetween Data Ranges MaxExpectedColumns = 100 ; any suitable number that is sure to be greater than any max column in data MaxColumnNo = 1 EmptyRowCount=0 ; Increment by 1 if row.cells.count = 0 i = FirstRow ; Row where the data starts Do While EmptyRowCount <= MaxEmptyRows If Rows(i).Cells.Count > 0 Then EmptyRowsCount = 0 ; Reset counter CheckCol = 1 ; Set Col to 1 for new row Do While CheckCol < MaxExpectedColumn CheckCol = Cells(i, CheckCol).End(xlToRight).Column If CheckCol > MaxExpectedColumn Then ; extreme rightmost column ; Do Nothing Else If CheckCol > MaxColumnNo Then MaxColumnNo = CheckCol ; Set new max col Else ; Do Nothing EndIf EndIf i += 1 ; Next Row Loop Else ; Empty row, go on checking until maxemptyrows are reached, or a row with data is found i += 1 EmptyRowsCount += 1 EndIf Loop1 point
-
Getting Value from Last Used Row in a defined range
Siwa reacted to seadoggie01 for a topic
There are tons of examples of how to do this. It really depends on your data, but I've found this to be the best method. I usually use something like: Func LastUsedColumnInRow($oSheet, $iRow) ; Requires <Excel.au3> If Not ObjName($oSheet) = "_Worksheet" Then Return SetError(1, 1, False) ; Not a worksheet object If Not IsInt($iRow) Then Return SetError(1, 2, False) ; Bad parameter Local $oErr = ObjEvent("AutoIt.Error", "__Excel_COMErrFunc") #forceref $oErr ; Get the number of cells in a single row (aka the number of columns - works with xls and xlsx) Local $iColumnCount = $oSheet.Cells($iRow, 1).EntireRow.Cells.Count If @error Then Return SetError(2, 0, False) ; Invalid row ; Not defined in Excel.au3 and I don't like magic numbers Local $xlToLeft = -4159 ; Get the last cell in the row and move left Local $iColumn = $oSheet.Cells($iRow, $iColumnCount).End($xlToLeft).Column If @error Then Return SetError(3, 0, False) ; I don't think this will ever happen Return $iColumn EndFunc1 point -
300 x 31 isn't too big. Reading all cells into an array with _Excel_RangeRead is much faster thean reading every cell. Looping through the array will then just access the array in memory.1 point
-
Your matrix is rotating around the bottom right corner, set the matrix to rotate around the centre (half the image width, half the image height, line 42). You will also need to offset the drawn graphic by that much to compensate (line 66). Test label on line 63. You've also got a memory leak, but that's for you to track #include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Global $hAttribute_Alpha Global $tColorMatrix Global $g_back Global $g_Needle Global $g_hImage_Background Global $g_hImage_Needle Global $g_hGfx_Background Global $g_hGfx_needle Global $hMatrix GUISetState() $g_hGUI = GUICreate("Test", 356, 356, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_TOOLWINDOW)) _GDIPlus_Startup() $Needle = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\needle.png") $Background = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\back.png") Func _CreateGraphic() $hAttribute_Alpha = _GDIPlus_ImageAttributesCreate() $tColorMatrix = _GDIPlus_ColorMatrixCreateTranslate(0, 0, 0, 0) ;0 = opaque, -1 = transparent _GDIPlus_ImageAttributesSetColorMatrix($hAttribute_Alpha, 0, True, DllStructGetPtr($tColorMatrix)) $g_back = _GDIPlus_ImageGetDimension($Background) $g_Needle = _GDIPlus_ImageGetDimension($Needle) $g_hImage_Background = _GDIPlus_BitmapCreateFromScan0($g_back[0], $g_back[1]) ; Creeaza imaginea dupa dimensiunile pozei incarcate mai sus $g_hImage_Needle = _GDIPlus_BitmapCreateFromScan0($g_Needle[0], $g_Needle[1]) ; Adaugat $g_hGfx_Background = _GDIPlus_ImageGetGraphicsContext($g_hImage_Background) $g_hGfx_needle = _GDIPlus_ImageGetGraphicsContext($g_hImage_Needle) ; Adaugat _GDIPlus_GraphicsDrawImageRectRect($g_hGfx_Background, $Background, 0, 0, $g_back[0], $g_back[1], 0, 0, $g_back[0], $g_back[1], $hAttribute_Alpha) $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($hMatrix, $g_Needle[0]/2, $g_Needle[1]/2) EndFunc ; Loop until user exits $Rotation = 0 ;Do While Not GUIGetMsg() = $GUI_EVENT_CLOSE If $Rotation=365 Then $Rotation=0 EndIf __Rotate($Rotation) $Rotation += 5; ConsoleWrite($Rotation & @CRLF) Sleep(1000) WEnd Func __Rotate($i) _CreateGraphic() _GDIPlus_GraphicsClear($g_hGfx_needle, 0xFF000000) _GDIPlus_GraphicsDrawImageRectRect($g_hGfx_Background, $Background, 0, 0, $g_back[0], $g_back[1], 0, 0, $g_back[0], $g_back[1], $hAttribute_Alpha) $g_hGfx_Background = _GDIPlus_ImageGetGraphicsContext($g_hImage_Background) _GDIPlus_GraphicsDrawString($g_hGfx_Background, "Test", $g_back[0]/2, 30) _GDIPlus_MatrixRotate($hMatrix, $i) _GDIPlus_GraphicsSetTransform($g_hGfx_Background, $hMatrix) _GDIPlus_GraphicsDrawImageRect($g_hGfx_Background, $Needle, -$g_Needle[0]/2, -$g_Needle[1]/2, $g_Needle[0], $g_Needle[1]) SetBitmap($g_hGUI, $g_hImage_Background, 255) GUISetState() EndFunc IF GUIGetMsg=$GUI_EVENT_CLOSE Then _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_ImageAttributesDispose($hAttribute_Alpha) _GDIPlus_ImageDispose($Needle) _GDIPlus_ImageDispose($g_hImage_Background) _GDIPlus_ImageDispose($Background) _GDIPlus_GraphicsDispose($g_hGfx_Background) _GDIPlus_Shutdown() EndIf Func SetBitmap($hGUI, $hImage, $iOpacity) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", 1) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>SetBitmap1 point
-
May be useful for someone! ; START CODE TEST Local $iTime = TimerInit() Local $Sip = _Get_IP() Local $iError = @error, $iExtended = @extended Local $eTime = TimerDiff($iTime) $iTime = "! IP: " & $Sip & @CRLF & "! ON: " & Round($eTime / 1000, 3) & "s" & @CRLF & "! Error: " & $iError & @CRLF & "! Extended: " & $iExtended & @CRLF ConsoleWrite($iTime) MsgBox(64 + 262144, "_Get_IP()", $iTime) ; END CODE TEST Func _Get_IP() ;~ HttpSetUserAgent('Mozilla/5.0 (Windows NT ' & StringRegExpReplace(FileGetVersion('kernel32.dll'), '^(\d+\.\d+)(.*)$', '$1', 1) & '; ' & (((StringInStr(@OSArch, "64") > 0) And (Not (@AutoItX64 > 0))) ? "WOW64" : "Win64; x64") & ")") HttpSetUserAgent('Mozilla/5.0 (Windows NT Win64; x64)') Local $aUrlGetIP = ["https://api.ipify.org", "https://ip4.seeip.org", "http://checkip.dyndns.org", "http://ip.eprci.net/text", "http://www.networksecuritytoolkit.org/nst/tools/ip.php"] Local $aStunServers[8][2] = [["stun.l.google.com", 19302], ["stun.a-mm.tv", 3478], ["stun.cloopen.com", 3478], ["stun.fbsbx.com", 3478], ["stun.hoiio.com", 3478], ["stun.miwifi.com", 3478], ["stun.pjsip.org", 3478], ["stun.yy.com", 3478]] ;_GetIP_ by Dao Van Trong - TRONG.LIVE Local $bPacketRd12 = BinaryMid(BinaryMid(Binary(Random(1.1, 2 ^ 31 - 1)), 1, 6) & Binary(Random(1.1, 2 ^ 31 - 1)), 1, 12) ;Generate request: some random unique ID in size of 12 bytes ; Binding request has class=0x00 and method=0x000000000001 (Binding) and is encoded into the first two bytes as 0x0001. Check http://tools.ietf.org/html/rfc5389#section-15 Local $bBinary = Binary("0x0001000000000000") & $bPacketRd12, $sReturn = "", $iError = 0, $sIpServ, $iSocket, $bRcvData, $StunID = -1, $iReTry = 2, $stunOK = 1, $MAPPED_ADDRESS = 0x0001, $IPv4 = 0x01, $IPv6 = 0x02, $SumStunSrv = UBound($aStunServers) - 1 TCPStartup() While 1 $bRcvData = "" $StunID += 1 If $StunID > $SumStunSrv Then $iReTry -= 1 If $iReTry < 1 Then $stunOK = 0 $iError = -1 ExitLoop EndIf $StunID = -1 ContinueLoop EndIf If $aStunServers[$StunID][0] = "" Then ContinueLoop $sIpServ = TCPNameToIP($aStunServers[$StunID][0]) If @error Then ContinueLoop ; couldn't resolve server's IP $iSocket = UDPOpen($sIpServ, $aStunServers[$StunID][1]) If @error Then ContinueLoop UDPSend($iSocket, $bBinary) If @error Then UDPCloseSocket($iSocket) ContinueLoop EndIf Local $xTimer = 0, $iTimer = TimerInit() Do Sleep(1) $xTimer = TimerDiff($iTimer) $bRcvData = UDPRecv($iSocket, 1280) Until (@error Or ($bRcvData <> "") Or ($xTimer > 2000)) UDPCloseSocket($iSocket) If $bRcvData = "" Then ContinueLoop EndIf ;~ $xTimer = TimerDiff($iTimer) ;~ ConsoleWrite('+ Connected and Get IP from ' & $aStunServers[$StunID][0] & ':' & $aStunServers[$StunID][1] & ' ON: ' & Round($xTimer / 100, 3) & 's ' & @CRLF) ExitLoop WEnd If $stunOK Then #cs ; Struct can be written now in place of binary data, but it's all big-endian (weird for reading in AutoIt): Local $tSTUN = DllStructCreate("byte Header_[8]; byte Header_ID[12];" & _ "byte Type[2];" & _ "byte Length[2];" & _ "byte Attrib;" & _ "byte Family;" & _ "byte Port[2];" & _ "byte IP[4];") #ce ; ...so I will just parse binary directly instead. Local $iSizeData = BinaryLen($bRcvData) If $iSizeData Then ; sanity check Local $bReadID = BinaryMid($bRcvData, 9, 12) ; server returns my unique "ID" Local $iType, $iLength = 0 Local $iPos = 21 ; further parsing starts after the header, see the struct and STUN doc If $bReadID = $bPacketRd12 Then ; check validity of the response by checking returned ID (handle) While $iPos < $iSizeData $iType = Dec(Hex(BinaryMid($bRcvData, $iPos, 2))) ; Big endian to number $iPos += 2 ; skip the size of "Type" field $iLength = Dec(Hex(BinaryMid($bRcvData, $iPos, 2))) ; Big endian to number $iPos += 2 ; skip the size of "Length" field If $iType = $MAPPED_ADDRESS Then ExitLoop $iPos += $iLength ; skip the size of all of the data in this chunk WEnd EndIf $iPos += 1 ; skip the size of "Attrib" field Local $iFamily = Dec(Hex(BinaryMid($bRcvData, $iPos, 1))) ; read "Family" info. - ; Big endian to number $iPos += 1 ; skip the size of "Family" field $iPos += 2 ; skip the size of "Port" field If $iFamily = $IPv4 Then ; Read IP info. Four bytes are IP in network byte order (big endian) $sReturn = Int(BinaryMid($bRcvData, $iPos, 1)) & "." & Int(BinaryMid($bRcvData, $iPos + 1, 1)) & "." & Int(BinaryMid($bRcvData, $iPos + 2, 1)) & "." & Int(BinaryMid($bRcvData, $iPos + 3, 1)) If ($sReturn <> "") And ($sReturn <> "0.0.0.0") Then UDPShutdown() Return $sReturn EndIf $iError = -2 ElseIf $iFamily = $IPv6 Then ; IPv6 $iError = 1 EndIf ; No such data available $iError = 2 EndIf ; You are blocked or something $iError = 3 EndIf Local $aReturn = 0, $iDomain, $aHost, $sPattern = "^(?i)(?:(?:[a-z]+):\/\/)?(?:(?:(?:[^@:]+))(?::(?:[^@]+))?@)?([^\/:]+)(?::(?:\d+))?(?:\/(?:[^?]+)?)?(?:\?\N+)?" For $i = 0 To UBound($aUrlGetIP) - 1 $aHost = StringRegExp($aUrlGetIP[$i], $sPattern, 1) If Not @error And IsArray($aHost) Then $iDomain = $aHost[0] TCPNameToIP($iDomain) If @error Then ContinueLoop $sReturn = InetRead($aUrlGetIP[$i], 1 + 2 + 8 + 16) If @error Or $sReturn == "" Then ContinueLoop $aReturn = StringRegExp(BinaryToString($sReturn), "((?:\d{1,3}\.){3}\d{1,3})", 3) ; [\d\.]{7,15} If Not @error Then $sReturn = $aReturn[0] ExitLoop EndIf $sReturn = "" Next TCPShutdown() If ($sReturn <> "") And ($sReturn <> "0.0.0.0") Then Return SetError(0, $iError, $sReturn) Return SetError(4, $iError, "") ;_GetIP_ by Dao Van Trong - TRONG.LIVE EndFunc ;==>_Get_IP1 point