mist3r Posted August 9, 2006 Share Posted August 9, 2006 Im trying to run a script that will check the computer name and msgbox if the machine name doesnt equal any of the list. Theres only 10machines. Dim $computer $computer = @ComputerName IF $computer NOT == "607-01" OR "607-02" OR "607-03" OR "607-04" THEN MsgBox(48, "WARNING", "Warning, the computer name does not match the 607 range!") ENDIF Ive tried noend of different things like removing the "" even adding OR NOT "607-01" OR NOT "607-02" etc.. tried all within brackets. Im a PHP person and I generally use IF $computer != (("607-01") OR ("607-02")) but this seems alot more confusing Any help appreciated.. thanks for any help Link to comment Share on other sites More sharing options...
ChrisL Posted August 9, 2006 Share Posted August 9, 2006 $computer = @ComputerName IF $computer <> "607-01" OR $computer <> "607-02" OR $computer <> "607-03" OR $computer <> "607-04" THEN MsgBox(48, "WARNING", "Warning, the computer name does not match the 607 range!") ENDIF [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
MHz Posted August 9, 2006 Share Posted August 9, 2006 For the 607 range could just use this code If StringLeft(@ComputerName, 3) <> '607' Then MsgBox(48, "WARNING", "Warning, the computer name does not match the 607 range!") EndIf Link to comment Share on other sites More sharing options...
mist3r Posted August 9, 2006 Author Share Posted August 9, 2006 Hey, I tried ChrisL's but put my computer name in there as 1 of the names that should exist and it still prompts saying it doesnt match. Not sure whats going on there Still, thanks for your help. As for MHz's - Very cool way of checking for that! Im going to your that function me thinks :"> Still wondering why ChrisL's didnt work for me though? As im sure i'd be using more then 1 match sometime in the future. Thanks for your help again!! Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 9, 2006 Share Posted August 9, 2006 (edited) Hey, I tried ChrisL's but put my computer name in there as 1 of the names that should exist and it still prompts saying it doesnt match. Not sure whats going on there Still, thanks for your help. As for MHz's - Very cool way of checking for that! Im going to your that function me thinks :"> Still wondering why ChrisL's didnt work for me though? As im sure i'd be using more then 1 match sometime in the future. Thanks for your help again!! Looking at the ChrisL code: 1. Let's assume $computer = "607-03" 2. As soon as the first compare occurs: IF $computer <> "607-01" you get a TRUE compare and the rest of the statement is ignored 3. To make his technique work, it would have to be: IF $computer <> "607-01" AND $computer <> "607-02" AND $computer <> "607-03" AND $computer <> "607-04" THEN MsgBox(48, "WARNING", "Warning, the computer name does not match the 607 range!") ENDIFoÝ÷ صêÚײ'«¶{Z|(ºW[y«¢+ØÀÌØí ½µÁÕÑÉ1¥ÍÐôÅÕ½ÐíðØÀÜ´ÀÅðØÀÜ´ÀÉðØÀÜ´ÀÍðØÀÜ´ÀÑðÅÕ½Ðì()%9½ÐMÑÉ¥¹%¹MÑÈ ÀÌØí ½µÁÕÑÉ1¥ÍаÅÕ½ÐíðÅÕ½ÐìµÀì ½µÁÕÑÉ9µµÀìÅÕ½ÐíðÅÕ½Ðì¤Q¡¸5Í ½à Ðà°ÅÕ½Ðí]I9%9ÅÕ½Ðì°ÅÕ½Ðí]ɹ¥¹°Ñ¡½µÁÕÑȹµ½Ì¹½ÐµÑ Ñ¡ØÀÜɹÌÌìÅÕ½Ðì¤ Note the pipe characters bracket every entry, including the first and last, so as not to get matches where the computer name is a substring of one in the list. Edited August 9, 2006 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
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