Sign in to follow this  
Followers 0
FATIHTALI

if not doesnt work

9 posts in this topic

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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

IF Not ($var = "N") then

or

IF $var <> "N" then

It worked well.

Thank you so much.

I dont know programing. It is my hoby only.

Thanks for help so so much.


Startup Agent It is my small Startup Agent. You can install programs on startup Domain pc without Admin rights.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

@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

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
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
Sign in to follow this  
Followers 0