Jump to content

Search the Community

Showing results for tags 'call array'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. I have a question. I'm piecing together a small script that will read a computer's name and break it apart to determine computers exact location within a school district. This will help us with deploying software that needs to be specifically tweaked on a wide-scale without manually doing it per each classroom. With that in mind and knowing very little on storing data into arrays, I've decided to take on this challenge. The naming convention works like this: ###-#####-#### <12 is Max # of characters in name as well. Campus Abbreviation - Room Location - System Type - Count So, if I were at Rodney King Highschool in room 402 at a teachers computer, it would read: RHS-00402-DT01 (DT = Desktop Teacher) 01= number of system, if there were 2 teachers, there might be DT02 in the room as well. Anyways, with this naming convention in mind, this is the script broken down: #include <Array.au3> #include <CampusVariables.au3> Global $Computer = "MHS-0B234-DT22" Global $CampusLocation = _IsArrayItemInString ( $CAMPUS, $Computer ) Global $TrimABVR = StringLen($CAMPUS[$CampusLocation]) Global $RoomLocation = _IsArrayItemInString ( $CAMPUS_SELECTOR[$CampusLocation], StringTrimLeft($Computer, $TrimABVR + 1)) Global $SystemTypeCheck = _IsArrayItemInString ($SystemType, StringRight($Computer, 4)) ConsoleWrite ( "Campus Array : " & $CAMPUS[$CampusLocation] & @CRLF) ConsoleWrite ( "Room Array : " & $CAMPUS_SELECTOR[$CampusLocation[$RoomLocation]] & @CRLF) ConsoleWrite ( "System Type : " & $SystemType[$SystemTypeCheck] & @CRLF) Func _IsArrayItemInString ( $_Array, $_Item ) For $_A = 1 To UBound ( $_Array ) - 1 If $_Array[$_A] <> '' And StringInStr ( $_Item, $_Array[$_A], 2, 1, 1, StringLen($_Array[$_A])) <> 0 Then Return $_A ;Return ($_A & " and the value for this item is: " & $CAMPUS[$_A]) Next Return "This system is either not named properly or is not a system needing LanSchool configured. LanSchool will not be installed." EndFunc ;==> _IsArrayItemInString ( ) CampusVariables.au3 ;Workstation Type Variables Dim $SystemType[6] = ["DT","DA","DL","DS","MS"] Dim $AHS[21] = ["0A107","0A108","0A202","0B206","CM129","CM157","CM158","CM171","CM229","000F1","FA107","FA108","FA112","FA116","FA117","FA118","0V100","0V200","0V204","0V205","0V207"] Dim $MHS[25] = ["0A120","0A160","0A161","0A170","0A228","0A229","0A232","0A236","0A242","0A244","0B101","0B134","0B205","0B210","0B217","0B234","0C133","0C138","0C243","0C244","0C248","0D106","0D113","0D122","D158B"] Dim $ALC[4] = ["00118","00142","00218","00220"] Dim $AJH[2] = ["00209","00400"] Dim $FJH[2] = ["0A208","0B125"] Dim $HJH[3] = ["00116","00211","00223"] Dim $MJH[2] = ["00308","00406"] Dim $RJH[2] = ["0A124","0B125"] Dim $AES[2] = ["00403","00404"] Dim $APS[1] = ["00210"] Dim $DJE[3] = ["00119","00502","00703"] Dim $ECM[2] = ["0210A","0210B"] Dim $GYE[1] = ["00303"] Dim $HCE[2] = ["00300","00301"] Dim $LFE[2] = ["00418","00528"] Dim $LIW[2] = ["00106","00302"] Dim $MME[2] = ["00119","00501"] Dim $MTP[2] = ["00015","00016"] Dim $PME[2] = ["00501","00502"] Dim $RLS[2] = ["00108","00401"] Dim $SLE[2] = ["00106","00302"] Dim $WDE[2] = ["00CL1","00MR3"] Dim $TSD[2] = ["0LABA","0LABB"] ;Campus Name Variables Dim $CAMPUS[23] = ["AES","APS","DJE","ECM","GYE","HCE","LFE","MME","MTP","PME","RLS","SLE","WDE","LIW","AJH","FJH","HJH","MJH","RJH","AHS","MHS","ALC","TSD"] ;Campus Variables using the same array range as $CAMPUS. Dim $CAMPUS_SELECTOR[23] = [$AES,$APS,$DJE,$ECM,$GYE,$HCE,$LFE,$MME,$MTP,$PME,$RLS,$SLE,$WDE,$LIW,$AJH,$FJH,$HJH,$MJH,$RJH,$AHS,$MHS,$ALC,$TSD] Everything works except for one thing - I am trying to call the appropriate campus variable by what is returned for $CAMPUS when reading the name. Whenever $CAMPUS returns a number, I then call $CAMPUS_SELECTOR[$CampusLocation[$RoomLocation]] in an effort to call the appropriate variable and the corrosponding array number. Apparently I don't fully understand how this links together because it errors out: DevelopmentSrv1DevelopmentSoftwareLanSchool DeploymentInstall LanSchool.au3 (14) : ==> Campus Array : MHS Subscript used with non-Array variable.: ConsoleWrite ( "Room Array : " & $CAMPUS_SELECTOR[$CampusLocation[$RoomLocation]] & @CRLF) ConsoleWrite ( "Room Array : " & $CAMPUS_SELECTOR[$CampusLocation^ ERROR >Exit code: 1 Time: 0.214 Does anyone have insight on a better way to do this or perhaps point out material that would help me? I don't expect anyone to re-write my code, just give me a hint. I am trying hard to learn but I'm hitting my head.
×
×
  • Create New...