Jump to content

if not doesnt work


Recommended Posts

CODE
$var = StringRight(@ComputerName, 1)

IF Not $var = "N" then

$rc = _RunDos("powercfg /HIBERNATE OFF")

MsgBox(0, "", "This computername end with:"&$var)

endif

MsgBox(0, "", "this is not notebook")

I am recieving everytime this is not notebook error.

If not doesnt work.

what is wrong.

"not" command deleted from program. I didnt found in help.

Startup Agent It is my small Startup Agent. You can install programs on startup Domain pc without Admin rights.
Link to comment
Share on other sites

Put a Msgbox at the beginning to display the @ComputerName to verify that the last character is indeed Not 'N'

Use <> "N" instead of NOT and try.

I am not sure if you expect the @ComputerName to be 'Notebook' unless it is indeed 'named' so.

CODE
$var = StringRight(@ComputerName, 1)

IF Not $var = "N" then

$rc = _RunDos("powercfg /HIBERNATE OFF")

MsgBox(0, "", "This computername end with:"&$var)

endif

MsgBox(0, "", "this is not notebook")

I am recieving everytime this is not notebook error.

If not doesnt work.

what is wrong.

"not" command deleted from program. I didnt found in help.

Link to comment
Share on other sites

Put a Msgbox at the beginning to display the @ComputerName to verify that the last character is indeed Not 'N'

Use <> "N" instead of NOT and try.

I am not sure if you expect the @ComputerName to be 'Notebook' unless it is indeed 'named' so.

Hello. Our computername standart is if computer is a notebook it name end with "N". Qua1001N or RES0025N like that.

If I check Last name it will be enought for me...

Startup Agent It is my small Startup Agent. You can install programs on startup Domain pc without Admin rights.
Link to comment
Share on other sites

It worked well.

Thank you so much.

I dont know programing. It is my hoby only.

Thanks for help so so much.

Try

$var = StringRight(@ComputerName, 1)
If $var <> "N" Then
    $rc = _RunDOS("powercfg /HIBERNATE OFF")
    MsgBox(0, "", "This computername end with:" & $var)
Else
    MsgBox(0, "", "this is not notebook")
EndIf
Link to comment
Share on other sites

  • 7 years later...

I got same problem but with this bit of code:

MsgBox(0,'Window','is activated - C2',1)

WinWaitActive("Microsoft Visual C++ 2010  x86 Redistributable Setup")
If Not (WinActive("Microsoft Visual C++ 2010  x86 Redistributable Setup")) Then WinActive("Microsoft Visual C++ 2010  x86 Redistributable Setup")
WinWaitActive("Microsoft Visual C++ 2010  x86 Redistributable Setup")

...why it doesn't want to work?

Link to comment
Share on other sites

If Not (WinActive("Microsoft Visual C++ 2010  x86 Redistributable Setup")) Then WinActive("Microsoft Visual C++ 2010  x86 Redistributable Setup")

This line is nonsence because

  • is not needed the window is already active. or
  • is needed, but then script hangs already in the line before

i suggest correct your windowtitle or better use the hwnd of the window

Link to comment
Share on other sites

  • Moderators

@cheeroke If you want to wait until the window is active, your second line should simply be this:

WinWaitActive("Microsoft Visual C++ 2010  x86 Redistributable Setup")

If the window is there and you want to try to activate it, something like this:

If WinExists("Microsoft Visual C++ 2010  x86 Redistributable Setup") Then WinActivate("Microsoft Visual C++ 2010  x86 Redistributable Setup")

 

Edit: Just noticed that you resurrected a 7 year old thread to ask your question. In the future, please start a new thread.

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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