JayFran Posted August 12, 2010 Posted August 12, 2010 (edited) Hey guys, I'm a newbie to autoit. I've been working on a script that basically takes the prefix (3 Letters) of our computer names (at work) and matches them against our spreadsheet. Once the search is finished it prints out in the debug window whether or not the computer prefix is in the spreadsheet. Heres what I have so far. Any help is appreciated. $prefix_open = _ExcelBookOpen("\\phlh72600\new$\New PrefixCodes.xls") $cprefix = StringRegExp(@ComputerName, "[A-Z] {3} [:alpha:] [:upper:]", 0) ;$array1 = _ExcelReadArray($oExcel, 1, 1, 10, 1) ;Direction is Vertical $array = _ExcelReadArray($cprefix, 1, 1, 10, 1) If $cprefix = 1 Then _DebugOut("Computer Prefix: " & @ComputerName & " is equal to " $cprefix) Else _DebugOut(@CRLF & "####################################") _DebugOut("PREFIX IS INVALID: " & @ComputerName) _DebugOut("######################################" & @CRLF) EndIf Edited August 12, 2010 by JayFran
FlyinRiz Posted August 12, 2010 Posted August 12, 2010 Hey guys, I'm a newbie to autoit. I've been working on a script that basically takes the prefix (3 Letters) of our computer names (at work) and matches them against our spreadsheet. Once the search is finished it prints out in the debug window whether or not the computer prefix is in the spreadsheet. Heres what I have so far. Any help is appreciated. $oExcel = _ExcelBookOpen("\\phlh72600\new$\New PrefixCodes.xls") $cprefix = StringLeft(@computername, 3) $array = _ExcelReadArray($oExcel, 1, 1, 10, 1) $result = _ArraySearch($array, $cprefix) If $result > -1 Then _DebugOut("Computer Prefix: " & @ComputerName & " is equal to " $cprefix) Else _DebugOut(@CRLF & "####################################") _DebugOut("PREFIX IS INVALID: " & @ComputerName) _DebugOut("######################################" & @CRLF) EndIf How's that? -Aaron
FlyinRiz Posted August 12, 2010 Posted August 12, 2010 If the code above doesn't make sense, try using in the UDF helpfile and look at the examples. -Aaron
JayFran Posted August 12, 2010 Author Posted August 12, 2010 Thanks Aaron, this really help out alot. Greatly appreciated.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now