Jump to content

Recommended Posts

Posted

Hello, I am trying to use AutoitX with visual basic 6.

I already registered the DLL, and called it in my general section.

What I'm trying to do is MouseMove to a location in calculator.

cAutoit.Opt ("MouseCoordMode,2")

But whenever I try to run this, it says;

"Invalid Outside Procedure"

Could someone help me out here?

Posted (edited)

Ok I'll try that. Do I put it in general section?

How to make it only work in calculator?

Do I need WinGetHandle?

If so, how do I use that? Thanks for replying also.

Edit: When I use your code it says, "Compile error, Expected: ="

Edited by AC130
Posted

Hmm I guess that worked..

Can you tell me why this isn't working?

cAutoit.PixelSearch (0,0,500,500, 0x000000, DEFAULT, DEFAULT)

It says Compile Error Expected: list seperator or )

Posted (edited)

Hello everyone again. Just a few questions.

Does PixelSearch automatically search for a pixel in the active window, or is it the whole screen?

Also, could someone post an example of using PixelSearch using AutoItX.

In Autoit, I use:

PixelSearch ( 0, 0, 500, 500, 0x000000, DEFAULT, DEFAULT, $hwnd)

However this is not working in Visual Basic. I tried removing the parentheses.

I have definitely tried...

Edited by AC130
Posted

Well thanks guys. Everything is working good now. Could you help me do one more thing though?

I'm trying to pixelsearch until the pixel is found. so far I have

Do Until Not Error
c = cAutoIt.PixelSearch(0, 0, 500, 500, &HFF0000, -1, -1)
Loop
MsgBox ( "Pixel Found" )

This I guess isn't working though, considering that I now the pixel is there, and it isn't message boxing.

Thanks in advance. :)

Posted

ok well in AutoIt i use this:

Func Search ()
Do
PixelSearch ( 0, 0, 50, 50, 0x000000, DEFAULT, DEFAULT)
Until Not @Error
MsgBox (0, "Success", "Pixel Found" )
EndFunc

This code keeps pixelsearching in that area until 0x000000 color is found, and then once it's found it Message boxes, Pixel Found.

I'm trying to do that in VB6.

Posted (edited)

Ok here is my current code:

Do Until NonError
PixelSearch = cAutoIt.PixelSearch ( 1000, 1000, 1000, 1000, &H0000000)
Loop
MsgBox ( "Pixel Found" )

NonError:
PixelSearch1 = cAutoIt.PixelSearch ( 1000, 1000, 1000, 1000, &H0000000) = True
EndSub

But it's not working, even though I know the pixel is there. Thanks in advance...

Edited by AC130
Posted

wow that looks exactly right. :) thank you so much. ;) also, &HFCFCFC is the same as 0xFCFCFC right? I don't have to add any more parameters to make it search for that color?

Posted

Case vbKeyF1
PixelSearch = 0
Do While PixelSearch = 0
    PixelSearch = cAutoit.PixelSearch(1000, 1000, 1000, 1000, &H0)
Loop
MsgBox ("Pixel Found")
End Select

Whenver I run this, it automatically says Pixel Found even if it's not there.

Posted

Oh ok I looked it up. It doesn't return 0 on failure. It sets error instead.

Do
    PixelSearch = cAutoit.PixelSearch(1000, 1000, 1000, 1000, &H0)
Loop Until cAutoIt.error = 0
MsgBox ("Pixel Found")

This will run until AutoIt's error is zero, meaning no error.

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
  • Recently Browsing   0 members

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