Search the Community
Showing results for tags 'Address'.
-
I'm using the excellent _Excel UDF to read a whole spreadsheet into an array I want to operate on. I can read a specified range without a problem. What I'd like to do is allow the user in Excel to select a range (contiguous is fine) and be able to read that range so that I know what range to operate on without having the user input the range via a keyboard. I'm stuck and any hints greatly appreciated. The code below uses the Helpfile .xls to illustrate where I crash. ; #AutoIt3Wrapper_run_debug_mode=Y ; use this to debug in console window <--- LOOK #include <Excel.au3> #include <MsgBoxConstants.au3> #include <Debug.au3> ;for _DebugArrayDisplay $sExcelFullFileName = "C:\Program Files (x86)\AutoIt3\Examples\Helpfile\Extras\_Excel1.xls" ;use Autoit test for example $oExcel = _Excel_Open() ;Create application object and open an Excel workbook $oWorkbook = _Excel_BookOpen($oExcel, $sExcelFullFileName) $aExcelArray = _Excel_RangeRead($oWorkbook, Default) _DebugArrayDisplay($aExcelArray, $aExcelArray) ;let's look at it $aI5K6 = _Excel_RangeRead($oWorkbook, Default,"I5:K6") ;read a rangeI5:K6 and return value _DebugArrayDisplay($aI5K6, $aI5K6) ;let's look at range it ;rather than defining the range explicity I'd like to read the selection in Excel and use it ;need a function like _Excel_SelectionRead ;try hacking Excel.au3 _Excel_RangeRead to see if can create _Excel_SelectionRead looks like .Selection .Value .Text and .Address possible MsgBox($MB_SYSTEMMODAL, "Info", "Select cells in Excel then click OK") ;ACTUALLY get range of the selection and this will suffice for us to use on the $aExcelArray $vRange = $oWorkbook.ActiveSheet.Selection.Address($vRange) ;tried all sorts of permutations and clearly I need help _DebugArrayDisplay($vRange, $vRange) ;let's look at range it ;$vResult = $oExcel.Transpose($vRange.Value) ;_DebugArrayDisplay($vResult, $vResult) ;let's look at range it _Excel_Close($oExcel, False, True) Exit
-
Version 1.0
765 downloads
Did this because i needed, retrieves a list of adapters from the registry, shows you your current Mac Address of the adapter in use, the user simply changes the second input field to the address he wants, then select the adapter on the list, and click 'set', after a reboot, the mac should be changed. (The field to input the mac to set accepts '-' ':' or no separation character. ex: AA:BB:CC... or AA-BB-CC... or AABBCC...)- 1 comment
- 1 review
-
- Mac Address
- Address
-
(and 1 more)
Tagged with:
-
The code works on windows 7 but not on XP... why so? #include <File.au3> Global $sIP, $MAs $Station=InputBox("Workstation", "enter the workstation", "") _GetMACFromIP($sIP) Local $text = StringReplace($MAs, "-", "") IniWrite(@ScriptDir & "\MAC.ini", "mac_addresses", $Station, $text) Func _GetMACFromIP($sIP) Local $MAC,$MACSize Local $MAi,$MAr ;Create the struct $MAC = DllStructCreate("byte[6]") ;Create a pointer to an int $MACSize = DllStructCreate("int") ;*MACSize = 6; DllStructSetData($MACSize,1,6) ;call inet_addr($sIP) $MAr = DllCall ("Ws2_32.dll", "int", "inet_addr", _ "str", $sIP) $iIP = $MAr[0] ;Make the DllCall $MAr = DllCall ("iphlpapi.dll", "int", "SendARP", _ "int", $iIP, _ "int", 0, _ "ptr", DllStructGetPtr($MAC), _ "ptr", DllStructGetPtr($MACSize)) ;Format the MAC address into user readble format: 00:00:00:00:00:00 $MAs = "" For $MAi = 0 To 5 If $MAi Then $MAs = $MAs & "-" $MAs = $MAs & Hex(DllStructGetData($MAC,1,$MAi+1),2) Next ;Return the user readble MAC address Return $MAs EndFunc Resolved by using this code instead: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=MAG.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <WinAPI.au3> #include <File.au3> $IPDetails=_IPDetails() $Station=InputBox("Workstation", "enter the workstation", "") Local $text = StringReplace($IPDetails[1], ":", "") IniWrite(@ScriptDir & "\MAC.ini", "mac_addresses", $Station, $text) Func _IPDetails() Local $oWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & "." & "\root\cimv2") Local $oColItems = $oWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True", "WQL", 0x30), $aReturn[5] = [4] If IsObj($oColItems) Then For $oObjectItem In $oColItems If $oObjectItem.IPAddress(0) == @IPAddress1 Then $aReturn[1] = $oObjectItem.MACAddress $aReturn[2] = $oObjectItem.DefaultIPGateway(0) EndIf Next Return $aReturn EndIf Return SetError(1, 0, $aReturn) EndFunc ;==>_IPDetails
-
I could use some help with a Regex pattern. I am attempting to extract some names and addresses (US format) from some free form text. Examples: Jane Doe PO Box 1234 Pensacola, FL 32524 Jane Doe 123 Sunset Blvd Apt 456 Pensacola, FL 32524 Jane Doe 555 Any Street Pensacola, FL 32524-1234 Second address line is optional. There are instances where the city or state may be missing. I came up with the following pattern through research / trial & error, but it isn't working exactly as I desire: (.+)(?>\r\n)(.+)(?>\r\n)(.+)(?>\r\n)?(.+)?,\h+(\w+)? ([-\d]+) When the second address line is missing, the value for city ends up in the wrong place. Suggestions on how I can fix / improve the pattern? TIA, Dan
-
Quick function for validating IPV6. It's not advanced, but can validate several notations. ; Default example If _ISIPV6IP('3ffe:1900:4545:3:200:f8ff:fe21:67cf') Then MsgBox(0, '', 'Valid IPV6 address!') ; Leading zeroes If _ISIPV6IP('2001:db8:85a3:0:0:8a2e:370:7334') Then MsgBox(0, '', 'Valid IPV6 address!') ; Groups of zeroes If _ISIPV6IP('2001:db8:85a3::8a2e:370:7334') Then MsgBox(0, '', 'Valid IPV6 address!') Func _ISIPV6IP($Addr) Return StringRegExp($Addr, "(([\da-f]{0,4}:{0,2}){1,8})") EndFunc