Jump to content
Sign in to follow this  
azman

Check a object exist?

Recommended Posts

azman

I made small script to insert data into a grid with C#. I want when insert invalid data a messagebox will appear! How can i check this mess..box exist?.

I also want when mess..box exist, this script will write in notepad the invalid data( to make report :) ). Please give me your opion!

Thanks!!!! :D

Edited by azman

Share this post


Link to post
Share on other sites
WHRobin566

well if the Box is called somin then you can do

winwaitactive("whatever its called")

if not then you chould do a pixelsearch for it like this and just search for somin on the window

if pixelgetcolor(0, 0) = 0 Then

except in 0 0 0 enter cords and color if you need somin to do that use spy. if you dont got that then heres a script to do it

Hotkeyset("{F8}", "Debug")

Func Debug()

$Mouse = MouseGetPos()

$pix = PixelGetColor($mouse[0], $mouse[1])

MsgBox (0, "MousePos", "X: " & $mouse[0] & "Y: " & $mouse[1] & "Color: "& $pix)

EndFunc

While 1

Sleep(10)

Wend

put the if pixelgetcolor where the part is that the box appears in your script.

then well if it dosent find it then it will just skip it and thats all i have to say.

as for notepad thats easy

run("notepad.exe")

winwaitactive("Untitled - Notepad")

send("Error or whatever you want it to say")

now if you want it show error then i got no clue on that.

or maybe you chould do somin like

after the if pixelsearch whatnot.

Hotkeyset("{F3}", "Error")

func Error()

msgbox(0, "Error", "You had a error")

endfunc

This after pixsearch

Send("{F3}")

But im not sure if that whould stop script hmm well im not gonna test lol.

also on notepad thing you might wanna activate other script back with.

WinActivate("Title", Optional "Text") i think it is or it might be called somin else.

Hope this helps! :)

Edited by WHRobin566

Witch Hunter Robin

Share this post


Link to post
Share on other sites
azman

well if the Box is called somin then you can do

winwaitactive("whatever its called")

if not then you chould do a pixelsearch for it like this and just search for somin on the window

if pixelgetcolor(0, 0) = 0 Then

except in        0  0      0  enter cords and color if you need somin to do that use spy. if you dont got that then heres a script to do it

Hotkeyset("{F8}", "Debug")

Func Debug()

$Mouse = MouseGetPos()

$pix = PixelGetColor($mouse[0], $mouse[1])

MsgBox (0, "MousePos", "X: " & $mouse[0] & "Y: " & $mouse[1] & "Color: "& $pix)

EndFunc

While 1

Sleep(10)

Wend

put the if pixelgetcolor where the part is that the box appears in your script.

then well if it dosent find it then it will just skip it and thats all i have to say.

as for notepad thats easy

run("notepad.exe")

winwaitactive("Untitled - Notepad")

send("Error or whatever you want it to say")

now if you want it show error then i got no clue on that.

or maybe you chould do somin like

after the if pixelsearch whatnot.

Hotkeyset("{F3}", "Error")

func Error()

msgbox(0, "Error", "You had a error")

endfunc

This after pixsearch

Send("{F3}")

But im not sure if that whould stop script hmm well im not gonna test lol.

also on notepad thing you might wanna activate other script back with.

WinActivate("Title", Optional "Text") i think it is or it might be called somin else.

Hope this helps!  :)

<{POST_SNAPBACK}>

Thanks! I thinks I can check a Mess exist!!!

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  

×