I'm glad to announce that I resolved the highest number jpg file finder issue. Now on to the user manual and publishing my code, the "hard part".
So the issue was that autoit reads the file names as it comes (and the way my program names the images) and the main issue was that if you have more than 10 images, I didn't check the design logic carefully to consider the way it reads first file and then find next file. So what it does is that it reads 1,10,2,20,3,4,... so on and so forth.
The solution was that I needed to insert a temporary variable holder to perform value comparison and that did the trick and I have successfully module and complete system tested it so it now doesn't have any problems reading the image file names.
Just a heads up, the files are numerically and sequentially named so if you have picture1.jpg it will not consider to count it as my parameters which I define when I was coding the software is that you are already using my existing software and naming / numbering system.