Jump to content

Excel Help


Recommended Posts

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 by JayFran
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...