Jump to content

Xonos

Active Members
  • Posts

    43
  • Joined

  • Last visited

About Xonos

  • Birthday 08/02/1987

Profile Information

  • Location
    Houston, TX
  • WWW
    http://www.xonos.net
  • Interests
    Programming, Design, Gaming, 3d Modeling & anything else creative that can keep my attention longer than 30 seconds.

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Xonos's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Gotcha! Thank you again for the quick replies and excellent service - without you guys, I'd have to write this all in Visual Studio.
  2. Thank you both - this solved my issue entirely! I tested it using the following and ensured that I had "#include <Array.au3>" included.: If IsArray($LookupUser) Then MsgBox(0, "Variable Array Check", "Your variable is an array - hurray!") Else MsgBox(0, "Variable Array Check", "Your variable is not an array - awww.") EndIf Thanks again guys!
  3. So I have been in and out of AutoIt for a few years now and I've never come across a situration where I'd need to verify if an a variable is an array or not. So here's the deal - I have a database that contains 1 table with a few different columns. When a user initially opens the script, it will see if their "username" pulled from @UserName is stored in the database (which is always unique). If their username is not in the database, it inserts a record (using EzMySql) including their username, full name (pulled from -> _AD_Open() Global $adFullName = _AD_GetObjectAttribute(@UserName, "DisplayName") Global $uSName = @UserName _AD_Close() <-), Time Stamp, Accept Flag (0/1) and Deny Flag (0/1). This is all irrelevant at this point but I just wanted you to understand what I am doing here. Anyways, I am getting to the point to where I am storing specific values from the table into variables. EzMySql will store the data in an array (IF the query finds results) however if it does not, then the variable will not be an array. The problem is, when I run my "If statements" - if I check the variable, there is no way for me to know if the results are stored in array format or not. Here's an example, read the comment above $LookupUser. Func _CheckDatabase() ; Obtain user's Full Name and store as variable. If Not _EzMySql_Startup() Then MsgBox(0, "Error Starting MySql", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg()) Exit EndIf $Pass = "D@#!$dD(#d0939kd(#Dk3093d)(#D039039ddk39dkd" If Not _EzMySql_Open("10.3.3.11", "rug_user", $Pass, "rug", "3306") Then MsgBox(0, "Error opening Database", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg()) Exit EndIf If Not _EzMYSql_Query("SELECT * FROM accept_list WHERE Username = '" & @UserName & "';") Then MsgBox(0, "Query Error", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg()) Exit EndIf If Not _EzMySql_SelectDB("rug") Then MsgBox(0, "Error setting Database to use", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg()) Exit EndIf $LookupUser = _EzMySql_FetchData() ;This is the problem - if there is no data found, $LookupUser[1] for example will not work returning an error. This function currently works but I need more functionality. If $LookupUser == 0 Then $sMySqlStatement = "INSERT INTO accept_list (Username,FullName) VALUES (" & "'" & $uSName & "'," & "'" & $adFullName & "');" If Not _EzMySql_Exec($sMySqlStatement) Then MsgBox(0, "Error inserting data to Table", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg()) Exit EndIf ElseIf $LookupUser <> 0 Then _CheckFlags() ;Call function to verify if user has accepted or not. EndIf _EzMySql_Close() _EzMySql_ShutDown() Return EndFunc
  4. I will read into 3d arrays however I do have a question. I do understand that "$CampusLocation" is not an array however I am using the returned integer to specify which variable to return. $CampusSelector lists (in the same order as $Campus) all of the pre-defined variables as you can see in the variables.au3 file. Global $CampusLocation = _IsArrayItemInString ( $CAMPUS, $Computer ) The function searches the computers name prefix in a list of 23 variants within $CAMPUS.
  5. 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.
  6. Ahhh, WMI. I was looking into WMI but I wasn't sure if I should go that route. Guys, thanks for your help. I really didn't want anyone to "write it out" for me but as always, this community pushes me into the right direction. I appreciate it!! I'm getting a lot better with autoit.
  7. I am writing a utility that will allow me to run commands as another user within my network (AD) when logged onto the system as another user with bare minimum privileges. This utility will have a number of things however I did get stumped on something very small. I need to obtain the "Computer Description" into a variable but I haven't had any luck finding anything remotely close to that. All I could really find was getting network adapter descriptions and that's it. If you're wondering what I mean by Computer Description, it's a field next to changing your computer hostname. Does anyone know of any undocumented macros or something for this? I use computer description for barcodes on over 3000+ systems and this could help tremendously if I need to change it or simply verify that it's correct on local systems.
  8. The title says it all really and me being a highly novice writer, I plea to the gurus of this forum to have a look at my script. What I have is a basic little program that works as a file updater for a game. When a client opens the program, they click "Setup" and it sets the game directory and which patch should be used. After thats done, they click "Update" and it will download a zip file, unzip it into the directory of their game and they're done! They can click play... The issue I have run into is that I need a method of downloading the zip file however inetget doesn't seem to work for me very well. I've considered using FTP connections but I cannot find any with a working progress bar that shows the status of their download. I will attach all files into a zip file and upload it if you'd like to see. In the main script "EQH Patcher", there is a function that is called _patch() when the button "Update" is used. The problem I am facing is that it doesn't seem to work with the progress bar. If anyone sees any detail why this wouldn't work, I am open ears! Thank you for your time. PS: I haven't written the "Unzip File" code yet. I won't until I can get the script to actually download a file with progress. Lines 60 - 62 = function called from download.au3 > I stripped download.au3 from an old post from 2007 that doesn't seem to have much interest. I did use search... VERY extensively but to no avail on my part. Patcher.zip
  9. Allow me to start from the beginning. I am a novice script writer but I wrote a small script that reads a txt file. In the text file, there are executable (IE: halo.exe,tetris.exe,ptanks.exe) names. The script is in a loop constantly reading this file and if a proccess exists, it will close it. (I use this for a school.) Now, unfortunately if the executable is renamed to a random name, it will bypass the script easily and I can't keep track of that. Is there a way to read all running processes hash and have it close programs according to their hash instead? Or perhaps a better method? Here is the previous script: Opt("TrayIconHide", 1) While 1 $file = FileOpen("glist.txt", 0) ;no error checking on opening this file ;since the end user does not need to see that info ;and the loop will attempt to open the file later $whole_file = FileRead($file) FileClose($file) If StringInStr($whole_file, ",") = 0 Then If ProcessExists($whole_file) Then ProcessClose($whole_file) EndIf Else $games = StringSplit($whole_file, ",") For $i = 1 To $games[0] If ProcessExists($games[$i]) Then ProcessClose($games[$i]) Sleep(99) EndIf Next EndIf Sleep(1000) ;every 10 seconds SplashOff() WEnd
  10. Awesome! It works... Hmm, a very different approach than what I was trying. I will learn and observe as much as I can from this. Thank you all for your help!
  11. So I don't understand how to do this. I am trying to get an array of sub-folders within a specific folder however, how do I make FileCopy copy to each folder? This is what I've got so far but I don't know where to start. So I suppose I have to include this function for recursive searching. #include <DArray.au3> Now, how do I call this function into play? I suppose I'd do this. _FileListToArrayXT and now, after it creates the array - what do I do? Declare it as a variable like this? $dirArray = _FileListToArrayXT ? Also, I don't understand how I'd get FileCopy to work with this and copy to each individually found sub directory FileCopy("file.js" "$dirArray???", 1) I've included the FileList array function below. Any ideas? If anyone could point me in the right direction, I'd be so very thankful! I'm not looking for someone to write it for me or anything! DArray.au3 ----------
  12. This can't be impossible. Is there a possible way to do it with a batch file maybe?
  13. Is there a way to copy one single file to a folder and have it copy that file to all sub-directories within that folder. I can't get it to work via batch files so I was wondering if it's possible to do this with AutoIt. Any ideas? >_
  14. I wrote a script that backs up teacher software + documents to my networked drive so that I can re-image computers. This will save my time considering I have roughly 3000 computers to reimage and backup. I'll need to disable the virus protection while I run this script. It doesn't matter that the AV is disabled considering I am reimaging the computer.
  15. Yeah I saw that. Dang, that sucks. I'll just write a script that disables Vexira. Thanks guys. Sorry for wasting your time.
×
×
  • Create New...