Jump to content

IF NOT THEN


Recommended Posts

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 :whistle:

Link to comment
Share on other sites

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! :whistle:

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

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! :whistle:

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 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

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...