AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ImageSearch not working correctly?... Syntax?..

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
trueski



Joined: 08 Apr 2008
Posts: 32

PostPosted: Thu Aug 07, 2008 7:17 pm    Post subject: ImageSearch not working correctly?... Syntax?.. Reply with quote

I'm trying to make a script that will take and save screenshots of a specific window every 200ms, As long as it is different from the last 5... I can't seem to get it to work...

Code:
#Persistent
#SingleInstance force

FileCreateDir, ScreenShots

loop

   IfWinNotActive, Window Title
     {
       Sleep, 200
       Continue
     }

   LastPic := A_Index - 1
   LastPic2 := A_Index - 2
   LastPic3 := A_Index - 3
   LastPic4 := A_Index - 4
   LastPic5 := A_Index - 5



  Loop
    {

     ImageSearch, OutputVarX1, OutputVarY, 0, 0, A_ScreenWidth, A_ScreenHeight, *150 ScreenShots\%LastPic%.gif
     ImageSearch, OutputVarX2, OutputVarY, 0, 0, A_ScreenWidth, A_ScreenHeight, *150 ScreenShots\%LastPic2%.gif
     ImageSearch, OutputVarX3, OutputVarY, 0, 0, A_ScreenWidth, A_ScreenHeight, *150 ScreenShots\%LastPic3%.gif
     ImageSearch, OutputVarX4, OutputVarY, 0, 0, A_ScreenWidth, A_ScreenHeight, *150 ScreenShots\%LastPic4%.gif
     ImageSearch, OutputVarX5, OutputVarY, 0, 0, A_ScreenWidth, A_ScreenHeight, *150 ScreenShots\%LastPic5%.gif

     IfEqual, OutputVarX1,
       IfEqual, OutputVarX2,
         IfEqual, OutputVarX3,
           IfEqual, OutputVarX4,
             IfEqual, OutputVarX5,
               Break

      Sleep, 200
    }

   run, i_view32.exe "/capture=2 /convert=ScreenShots\%A_index%.gif" , ,hide 
   Sleep, 200

}
return

_________________
-Trueski-
Back to top
View user's profile Send private message
trueski



Joined: 08 Apr 2008
Posts: 32

PostPosted: Thu Aug 07, 2008 9:30 pm    Post subject: Reply with quote

Updated... Still doesn't work
Code:
#Persistent
#SingleInstance force

FileCreateDir, ScreenShots


loop

   WinWaitActive, NW956s1.WS

   IfLess, A_Index, 6
       {
         run, i_view32.exe "/capture=2 /convert=ScreenShots\%A_Index%.gif" , ,hide 
         Sleep, 200
         Continue
       }


   LastPic := A_Index - 1
   LastPic2 := A_Index - 2
   LastPic3 := A_Index - 3
   LastPic4 := A_Index - 4
   LastPic5 := A_Index - 5



  Loop
    {
 
     TotalError := 0

     ImageSearch, OutputVarX, OutputVarY, 0, 0, %A_ScreenWidth%, %A_ScreenHeight%, *5 ScreenShots\%LastPic%.gif
     IfEqual, ErrorLevel, 1
       TotalError += 1

     Sleep, 200

     ImageSearch, OutputVarX, OutputVarY, 0, 0, %A_ScreenWidth%, %A_ScreenHeight%, *5 ScreenShots\%LastPic2%.gif
     IfEqual, ErrorLevel, 1
       TotalError += 1

     Sleep, 200

     ImageSearch, OutputVarX, OutputVarY, 0, 0, %A_ScreenWidth%, %A_ScreenHeight%, *5 ScreenShots\%LastPic3%.gif
     IfEqual, ErrorLevel, 1
       TotalError += 1

     Sleep, 200

     ImageSearch, OutputVarX, OutputVarY, 0, 0, %A_ScreenWidth%, %A_ScreenHeight%, *5 ScreenShots\%LastPic4%.gif
     IfEqual, ErrorLevel, 1
       TotalError += 1

     Sleep, 200

     ImageSearch, OutputVarX, OutputVarY, 0, 0, %A_ScreenWidth%, %A_ScreenHeight%, *5 ScreenShots\%LastPic5%.gif
     IfEqual, ErrorLevel, 1
       TotalError += 1

     Sleep, 200

     IfEqual, TotalError, 5
       Break
    }

   run, i_view32.exe "/capture=2 /convert=ScreenShots\%A_index%.gif" , ,hide 
   Sleep, 200

}

_________________
-Trueski-
Back to top
View user's profile Send private message
Superfraggle



Joined: 02 Nov 2004
Posts: 970
Location: London, UK

PostPosted: Thu Aug 07, 2008 9:30 pm    Post subject: Reply with quote

I havent looked at your code, but if you want to make sure the screen is different then you can use this instead of imagesearch.

http://www.autohotkey.com/forum/viewtopic.php?t=22100
_________________
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle
Back to top
View user's profile Send private message MSN Messenger
trueski



Joined: 08 Apr 2008
Posts: 32

PostPosted: Thu Aug 07, 2008 9:39 pm    Post subject: Reply with quote

Got it working, forgot,
Code:
CoordMode, Pixel, Screen


The CPU load is extremely high however
_________________
-Trueski-
Back to top
View user's profile Send private message
trueski



Joined: 08 Apr 2008
Posts: 32

PostPosted: Thu Aug 07, 2008 9:40 pm    Post subject: Reply with quote

sweet, thanks
_________________
-Trueski-
Back to top
View user's profile Send private message
Guest






PostPosted: Thu Aug 07, 2008 9:58 pm    Post subject: Reply with quote

Very Happy lmao you pwned yourself made me laugh, Thx Wink
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group