Jump to content

if then statement


Recommended Posts

hi there,

i wana use

if then, else if statement. i put this

If ProcessExists (help.Exe) Then

MsgBox(4096,"", "Value might be hexadecimal!")

Else

ShellExecute ("help.exe")

EndIf

simply i want my application to do nothing if the help.exe in alredy opened, but it uses condition MsgBox(4096,"", "Value might be hexadecimal!"). please tell me how i can fix it.

Link to comment
Share on other sites

If you don't want it to do anything under one condition, then you don't need an else.

If Not ProcessExists("help.exe") then ShellExecute("help.exe")

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

actually if the help file is already opened, it should not do anything. and if not opened then it should open help.exe through shell execute.

If you don't want it to do anything under one condition, then you don't need an else.

If Not ProcessExists("help.exe") then ShellExecute("help.exe")
Link to comment
Share on other sites

skruge's solution does what you are asking.

Alternatively you could also simply comment out (or delete) the MsgBox line:

If ProcessExists(help.Exe) Then
    ;MsgBox(4096, "", "Value might be hexadecimal!")
Else
    ShellExecute("help.exe")
EndIf

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

leaving blank msg box do not show any msg. :D wen i del the complete msg box line, it show the error for then condition

is there any command to pause script?

no way without box?

:o

skruge's solution does what you are asking.

Alternatively you could also simply comment out (or delete) the MsgBox line:

If ProcessExists(help.Exe) Then
    ;MsgBox(4096, "", "Value might be hexadecimal!")
Else
    ShellExecute("help.exe")
EndIf
Link to comment
Share on other sites

@ youknowwho

i wana use shell execute as a "else" statement

this (If ProcessExists("help.exe") = 0 then ShellExecute("help.exe)

shows this

C:\Documents and Settings\vindos\Desktop\new.au3(1,52) : ERROR: syntax error (illegal character)

If ProcessExists("help.exe") = 0 then ShellExecute("

:D

Link to comment
Share on other sites

no a do until loop will sleep until the set condition is true. What ever you want to set that condition to.

Same with the while loop except inverse. It will repeat the sleep until the condition is no longer not true (so I guess not inverse)

Giggity

Link to comment
Share on other sites

can u paste my complete script with your idea

actually i cant understand

$condition=true

here

If ProcessExists("help.Exe") Then

sleep(100)

untill $condition=true

Else

ShellExecute("help.exe")

EndIf

is it correct?

Link to comment
Share on other sites

  • Developers

can u paste my complete script with your idea

actually i cant understand

$condition=true

here

If ProcessExists("help.Exe") Then

sleep(100)

untill $condition=true

Else

ShellExecute("help.exe")

EndIf

is it correct?

Try learning some programming/scrip basics before starting to script.

Open the helpfile and look at the commands used in your little piece of code and sort out what is wrong.

Learn....

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

i've been learning for a long time to solve it. now im fedup thats why im asking here.

Don't make your impatience our problem.

*click*

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...