Eru Posted March 2, 2007 Posted March 2, 2007 This is kindof a wierd request, but I'm trying to think of a way that I could have autoit wait for a mouseclick on a certain spot, then when I click that spot, capture all pixels within, oh lets say 55 pixels from the mouseclick and save them to either a file, variable or an array. I can't find any functions that would do something similar, and now I'm wondering if I can tie another program in to autoit to get what I'm trying to do. Any input is appreciated, and if you can point me in the right direction, I can probably figure it out from there. Thanks again guys. : )
PaulIA Posted March 2, 2007 Posted March 2, 2007 This is kindof a wierd request, but I'm trying to think of a way that I could have autoit wait for a mouseclick on a certain spot, then when I click that spot, capture all pixels within, oh lets say 55 pixels from the mouseclick and save them to either a file, variable or an array. I can't find any functions that would do something similar, and now I'm wondering if I can tie another program in to autoit to get what I'm trying to do.Any input is appreciated, and if you can point me in the right direction, I can probably figure it out from there.Thanks again guys. : )There is a screen capture module in Auto3Lib that allows you to take a snapshot of a region of the screen. It is written in AutoIt and does not require any Dlls. Auto3Lib: A library of over 1200 functions for AutoIt
Eru Posted March 2, 2007 Author Posted March 2, 2007 Excellent! Thanks! I have it making the screenshot now, but when I try to have the script open the file for the user to see, It doesn't show up. I've tried using Run (Pic.bmp) Run(blah\mspaint.exe) FileOpen (pic.bmp) and played around with a few flags, but it's not showing up anywhere I thought of using WinSetState, but it's based off the title instead of the process ID, and there's no way of knowing what the user opens the pic up in by default. I'm such a noob at this.
Valuater Posted March 2, 2007 Posted March 2, 2007 ShellExecute("C:\temp\picture.jpg") **** tested 8)
Eru Posted March 2, 2007 Author Posted March 2, 2007 Yay! Thank you! One last question and the project is FINISHED! I'm using this for my screen shot capture function. It takes a 200x200 pixel SS where the mouse is at. Func SSCapture() $SSPosition = MouseGetPos() Local $SSPositionTLX = $SSPosition[0] - 100 Local $SSPositionTLY = $SSPosition[1] - 100 Local $SSPositionBRX = $SSPosition[0] + 100 Local $SSPositionBRY = $SSPosition[1] + 100 $ViewScreenShot = _ScreenCap_Capture ($SSpath, $SSPositionTLX, $SSPositionTLY, $SSPositionBRX, $SSPositionBRY) Sleep (1000) GUICtrlSetImage ($SSDisplay, $SSPath) ;SSPath is my screenshot file. EndFunc I have a button set to 200x200 pixels ($SSDisplay). problem is, when this function runs, there's no change in the button. I've messed with formatting and spacing thinking that there might be a diplay error or something. I've made the button bigger, I've made it smaller, i've changed the image size, i've read the function reference, i kicked a puppy for laughing at me... Still nothing.
PaulIA Posted March 2, 2007 Posted March 2, 2007 (edited) Yay! Thank you! One last question and the project is FINISHED! I'm using this for my screen shot capture function. It takes a 200x200 pixel SS where the mouse is at. Func SSCapture() $SSPosition = MouseGetPos() Local $SSPositionTLX = $SSPosition[0] - 100 Local $SSPositionTLY = $SSPosition[1] - 100 Local $SSPositionBRX = $SSPosition[0] + 100 Local $SSPositionBRY = $SSPosition[1] + 100 $ViewScreenShot = _ScreenCap_Capture ($SSpath, $SSPositionTLX, $SSPositionTLY, $SSPositionBRX, $SSPositionBRY) Sleep (1000) GUICtrlSetImage ($SSDisplay, $SSPath) ;SSPath is my screenshot file. EndFunc I have a button set to 200x200 pixels ($SSDisplay). problem is, when this function runs, there's no change in the button. I've messed with formatting and spacing thinking that there might be a diplay error or something. I've made the button bigger, I've made it smaller, i've changed the image size, i've read the function reference, i kicked a puppy for laughing at me... Still nothing.Without seeing a working script, it's hard to spot the problem. Here's a couple of things to try: 1. Kick the puppy again. 2. Check the values you're passing to _ScreenCap_Capture. The coordiante values passed to _ScreenCap_Capture need to be positive numbers. 3. Post a working example so we can see the problem. Oh, and _ScreenCap_Capture doesn't return a value when you save the bitmap to a file. Edited March 2, 2007 by PaulIA Auto3Lib: A library of over 1200 functions for AutoIt
Eru Posted March 2, 2007 Author Posted March 2, 2007 Kicking the puppy didn't make it work, but I set a new distance record. And the screenshot is being captured correctly since it shows up in my save path (200x200)... but I just tried to put a label below the button and it was strangly blocked out by something. Same when I tried to put it above. I'm going to go through my controls and see if one of them is in the wrong position maybe.
Eru Posted March 3, 2007 Author Posted March 3, 2007 Got it working by using GUICtrlCreatePic instead, and adding a button above to do what the button would have done. I tested around and couldn't seem to get any of my scripts to put an image on a button, so maybe it's not possible. :/ aah well.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now