Jump to content

BurninSun

Members
  • Posts

    5
  • Joined

  • Last visited

BurninSun's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Check out: https://www.autoitscript.com/forum/topic/66545-find-bmp-in-another-bmp-imagesearch Basically converts your image into a string and uses built-in string matching. Would probably be even easier in your case since you know exactly where the image would be located.
  2. Here is a snippet of the code. Most of it is somewhat unreadable because it references controls on various programs that won't make sense without seeing those programs running ControlClick("Print", "What to print", "[CLASS:Button; INSTANCE:6]") ; print setup, ok button WinWait("Print", "Printer") ControlClick("Print", "Printer", "[CLASS:Button; INSTANCE:10]") ; standard print dialog, ok button WinWait("PDFCreator") ControlClick("PDFCreator", "", "[CLASS:ThunderRT6CommandButton; INSTANCE:7]") ; pdfcreator, save button WinWait("Save as") ControlSetText("Save as", "", "[CLASS:Edit; INSTANCE:1]", $name[0]) ; standard save as dialog, fill in filename ControlClick("Save as", "", "[CLASS:Button; INSTANCE:2]") ; standard save as dialog, ok button Using WinSetOnTop helps a bit visually but you're correct in that it doesn't stop focus stealing. @SW_HIDE is what I've been looking into, but I'm not using Run() or ShellExecute(), so I can't hide it from the start. At best, I can detect the creation of the window using shell hooks then use WinSetState to hide it, but it still takes focus for a split second. My hope was to use a shell hook on window creation to call WinSetState with @SW_HIDE before the window activation event. So far, even though I have the hooks, it seems autoit's hook won't run until after the window is activated.
  3. TL;DR: I'm looking for a way to prevent specific newly created (not created via autoit) windows from stealing focus (or from showing at all if possible) for the split second it takes for the script to automate them. About once a week I have to print a bunch of pages, 1 at a time, to a PDF printer. I already have the process scripted and it takes about 30 minutes so normally I just turn it on and go to lunch. I'm trying to modify the script so the whole process runs in the background and I can keep using my computer without interruption. The script already uses all Control...() functions so none of the windows need to have focus to work. But, every minute or so, a couple windows pop up (print dialog, pdf program, save as dialog, etc) stealing the focus for a split second which can interrupt my typing/mouse clicking in other windows. That's what I'm trying to fix. I figure I need to hook the window creation event somehow as I need to interrupt the process before the window gets displayed. I've tried the hooking example from '?do=embed' frameborder='0' data-embedContent>> and using WinSetState(..., @SW_HIDE) but the window still appears and steals focus for a brief moment. Basically, the code looks like this: while true press print wait for print dialog press ok wait for pdf dialog press save wait for save as dialog fill in file name press ok go to next page wend I'd like to do something like: register that the print dialog is about to open press print event handler fires from registered print dialog opening and doesn't allow it to take focus unregister print dialog press ok etc... Any help would be appreciated.
  4. Fixed $iPos is initialized as 0 so the first iteration sends a 0 as the search start parameter for StringInStr which then fails. Initializing $iPos to 1 fixes the problem.
  5. I've been trying to get this to work for hours now, but all it ever returns is false. First I made a file called ImageSearch.au3 and put in #include <GDIPlus.au3> #Include <ScreenCapture.au3> const $c24RGBFullMatch=1 ;Load as 24 bits and full match const $c24RGBPartialMatch=2 ;Load as 24 bits and partial match const $c16RGBFullMatch=3 ;Load as 16 bits and full match const $c16RGBPartialMatch=4 ;Load as 16 bits and partial match followed by a complete copy/paste of the 2nd script (I've also tried directly embedding the code into mine with the same result) I downloaded the attached pics and ran this: #include "ImageSearch.au3" _GDIPlus_Startup() $imgInfo = FindBMP("D:\pics\Calculator.bmp", "D:\pics\backspace.bmp", $c24RGBFullMatch) ConsoleWrite($imginfo) _GDIPlus_Shutdown() In the console, I get False;0;-1;-1;72;29;-1;-1 I've tried a few combinations of the attached bitmaps, I've tried comparing files with themselves, and I've tried all the various arguments for the 3rd parameter and all return false. Any ideas? Autoit 3.3.0.0 Windows XP Pro SP3
×
×
  • Create New...