Jump to content

Recommended Posts

Posted

I am working in the images scanning. I couldn't figure out why the begining of loop in the image GUI won't load. Even the beginning of their element in array keep looping as well. For example as below. I started load the image as $a = 1 (bga_1.jpg) then keep looping until $a = 20 (bga_20.jpg). The result I got these which are wrong

1 - 1262 - FAILED

2 - 1262 - FAILED

3 - 0 - PASSED

4 - 516 - FAILED

5 - 269 - FAILED

6 - 393 - FAILED

7 - 0 - PASSED

8 - 327 - FAILED

9 - 0 - PASSED

10 - 829 - FAILED

11 - 101 - PASSED

12 - 111 - PASSED

13 - 219 - PASSED

14 - 147 - PASSED

15 - 469 - FAILED

16 - 220 - PASSED

17 - 169 - PASSED

18 - 201 - PASSED

19 - 111 - PASSED

20 - 218 - PASSED

Instead these

1 - 1262 - FAILED

2 - 0 - PASSED

3 - 516 - FAILED

4 - 269 - FAILED

5 - 393 - FAILED

6 - 0 - PASSED

7 - 327 - FAILED

8 - 0 - PASSED

9 - 829 - FAILED

10 - 101 - PASSED

11 - 111 - PASSED

12 - 219 - PASSED

13 - 147 - PASSED

14 - 469 - FAILED

15 - 220 - PASSED

16 - 169 - PASSED

17 - 201 - PASSED

18 - 111 - PASSED

19 - 218 - PASSED

20 - 236 - PASSED

Please help. Thanks

##=============================================================================##

#include <IE.au3>

#include <array.au3>

#include <ExcelCOM_UDF.au3>

#include <File.au3>

#include <string.au3>

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

#include <ProgressConstants.au3>

#include <TreeViewConstants.au3>

#include <ButtonConstants.au3>

GUICreate ("ScanDefect (Beta)",323,408)

GUICtrlCreateLabel ("Press Run To Start",10,10,200)

$text = GUICtrlCreateButton ("Run",10,40,75)

$exit = GUICtrlCreateButton ("Exit", 215, 40,75)

GUISetState()

While 1

$msg = GUIGetMsg()

Select

Case $msg = $exit

ExitLoop

Case $msg = $text

For $a = 1 To 20

$image = GUICtrlCreatePic ("C:\ScanDefect\images\bga_"& $a &".jpg", 10, 75, 300, 300)

$result = 0

$color = 0xF70921

For $i = 546 To 724

For $j = 456 To 635

$coord = PixelSearch ($i,$j,$i,$j,$color,10)

If Not @error Then

result+=1

ndIf

Next

Next

If $result <= 250 Then

$fileoutput= FileOpen ("C:\ScanDefect\result.txt", 1)

FileWriteLine ($fileoutput, $a & " - " & $result & " - PASSED")

FileClose ($fileoutput)

Else

$fileoutput= FileOpen ("C:\ScanDefect\result.txt", 1)

FileWriteLine ($fileoutput, $a & " - " & $result & " - FAILED")

FileClose ($fileoutput)

EndIf

Next

ShellExecute ("C:\ScanDefect\result.txt")

EndSelect

WEnd

Posted

Create only one picture control and use GuiCtrlSetImage() in your loop to get next image.

Oh!..Thanks, AndReik. I am very applicate for your help ^o^

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
×
×
  • Create New...