Sign in to follow this  
Followers 0
lasse46

If / If not problem

21 posts in this topic

Hi i didn't find anything about the IF and IF NOT commands so I'm just gonna write what i want it to do :)

if pixelgetcolor(150,367)=0x8e0000 then open start.au3

if error / if not (the pixel is 8e0000) then open start2.au3

if some one could solve this one I would be very happy!

Share this post


Link to post
Share on other sites



Hi i didn't find anything about the IF and IF NOT commands so I'm just gonna write what i want it to do :)

if pixelgetcolor(150,367)=0x8e0000 then open start.au3

if error / if not (the pixel is 8e0000) then open start2.au3

if some one could solve this one I would be very happy!

For example:

$a = 5

If $a = 5 Then ConsoleWrite($a & @CRLF)
If @error Or Not $a = 5 Then ConsoleWrite("$a is not 5 or error occurred" & @CRLF)

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

@lasse46

Hi,

if pixelgetcolor(150,367)=0x8e0000 then
Run("start.au3")

If @error then
Msgbox(64,"","Error !")
Else;if no error
Run("start2.au3")
Endif
Endif

And before ask other question please search in helpfile F1 in scite


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

thanks alot, I did search it but didn't find anything

And i didn't get:

if pixelgetcolor(150,367)=0x8e0000 then

Run("start.au3")

If @error then

Msgbox(64,"","Error !")

Else;if no error

Run("start2.au3")

Endif

Endif

to work?

Edited by lasse46

Share this post


Link to post
Share on other sites

Its the Run("start.au3") that doesn't work

When i tried Run("notepad.exe") it worked

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

@lass46

perhaps your script isnt in your main scriptdirectory

Notepad is included in autoit functions so you doesnt have to write full path of it :)

Edit : this can help you

Run("AutoIt3.exe","start.au3")
Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

@firefox

yes it is.

i've even tried giving it full directions like Run("D:\AutoIt3\start.au3")

?? :)

Share this post


Link to post
Share on other sites

Thanks marlo

ShellExecute("start.au3") worked just fine!

Share this post


Link to post
Share on other sites

@lass46

have you tried my example ?

Run("AutoIt3.exe","start.au3")

Open folder :

Run("explorer.exe","C:\")

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

A very complicated problem in software design.

We should all stop a moment and flowchart it.

You can come back to this after you get BSD installed...

:)


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

Share this post


Link to post
Share on other sites

...keen sence of humor

I like it.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

@lass46

perhaps your script isnt in your main scriptdirectory

Notepad is included in autoit functions so you doesnt have to write full path of it :)

Edit : this can help you

Run("AutoIt3.exe","start.au3")

Run ( "filename" [, "workingdir" [, flag[, standard_i/o_flag]]] )

Parameters:

filename The name of the executable (EXE, BAT, COM, or PIF) to run.

Notepad is included in autoit functions so you doesnt have to write full path of it :o

what???

Share this post


Link to post
Share on other sites

@oMBra

I just want to say here that autoit know path of Notepad like it know path of cmd... perhaps it search in sysdir... :)


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

@oMBra

I just want to say here that autoit know path of Notepad like it know path of cmd... perhaps it search in sysdir... :)

that sounds better :o

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

that sounds better :)

Yet it is still wrong.

You can run "notepad.exe" without the full path because it is in a directory included in the Windows PATH environment variable. These directories are by default (if I remember correctly): C:\WINDOWS\, C:\WINDOWS\system32\, and one more that I cannot seem to remember.

Edited by KentonBomb

Share this post


Link to post
Share on other sites

Yet it is still wrong.

You can run "notepad.exe" without the full path because it is in a directory included in the Windows PATH environment variable. These directories are by default (if I remember correctly): C:\WINDOWS\, C:\WINDOWS\system32\, and one more that I cannot seem to remember.

The System PATH as it is stored in the registry, and as it is parsed in the environment:
$sRegPATH = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
$sRegPATH = RegRead($sRegPATH, "Path")
ConsoleWrite("Debug:  Registry Path = " & $sRegPATH & @LF)
$sEnvPATH = EnvGet("Path")
ConsoleWrite("Debug:  Environment Path = " & $sEnvPATH & @LF)

:)


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

Share this post


Link to post
Share on other sites

The System PATH as it is stored in the registry, and as it is parsed in the environment:

$sRegPATH = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
$sRegPATH = RegRead($sRegPATH, "Path")
ConsoleWrite("Debug:  Registry Path = " & $sRegPATH & @LF)
$sEnvPATH = EnvGet("Path")
ConsoleWrite("Debug:  Environment Path = " & $sEnvPATH & @LF)

:)

Well, I was close :o

Share this post


Link to post
Share on other sites

if pixelgetcolor(150,367)=0x8e0000 then open start.au3

if error / if not (the pixel is 8e0000) then open start2.au3

If PixelGetColor(150, 367) = 0x8e000 Then
    #include "Start.au3"
Else
    #include "Start2.au3"
EndIf

You could use this, but if you compile you should use Run. :)

AlmarM


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

If PixelGetColor(150, 367) = 0x8e000 Then
    #include "Start.au3"
Else
    #include "Start2.au3"
EndIf

You could use this, but if you compile you should use Run. :o

AlmarM

Compiler directives are not conditional. I don't think that will do what you want. If there are any Function declarations inside either of those include files, it won't even pass syntax check or run at all.

:)


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

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