Jump to content
Sign in to follow this  
testingtest

Picture Taker (No Dll) not that great >.<

Recommended Posts

testingtest

#include <GuiConstants.au3>
#include <Misc.au3>
Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Global $Form1
$Form1 = GUICreate("AForm1", 322, 218, 193, 115)
$Edit1 = GUICtrlCreateEdit("", 0, 0, 321, 185)
GUICtrlSetData(-1, StringFormat("Picture Taker Beta 1.04v \r\n\r\n* Advantages \r\n- No dll required \r\n\r\n* Disadvantages\r\n- Flickering\r\n- 99.9% chance of working\r\n- Not completely user friendly because of flickering\r\n"))
$Button1 = GUICtrlCreateButton("Picture Test", 0, 192, 75, 25, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            GUISetState(@SW_HIDE) ;hides GUI
            _Pic()
    EndSwitch
WEnd


Func _Pic()
BlockInput(1) ;blocks user input
Send("{PRINTSCREEN}") ;takes a picture of the screen
Run("mspaint") ;runs paint to put the print screen in since you can't put it in the clipboard for example ClipPut(Send("{PRINTSCREEN}"))
WinWait("untitled - Paint") ;waits for window 
WinSetTrans("untitled - Paint" , "" , 0)
If Not WinActive("untitled - Paint") Then WinActivate("untitled - Paint") ;activates window
WinWaitActive("untitled - Paint") ;waits until active
Send("{CTRLDOWN}v{CTRLUP}") ;pastes the image
Sleep(500) ;sleeps to wait for the paint window

;you only get this window if the image is bigger then the box
If WinExists("Paint") Then ;checks if window exists
WinActivate("Paint","The image in the cli") ;activates window
WinWaitActive("Paint","The image in the cli") ;waits until active
Send("Y") ;hits yes on the message box
Send("{ALTDOWN}fs{ALTUP}") ;opens the file menu and hits save 
EndIf

BlockInput(0) ;accepts user input
WinWait("Save As","Save as &type:") ;wait for save window
If Not WinActive("Save As","Save as &type:") Then WinActivate("Save As","Save as &type:") ;activate save window
WinWaitActive("Save As","Save as &type:") ;wait until activated
While 1 ;loop
    If Not WinExists("Save As") Then 
    ProcessClose("mspaint.exe") ;double checking
    GUISetState(@SW_SHOW) ;shows GUI
    EndIf
;   WinKill("untitled - Paint") ;kill after saved
    ExitLoop
WEnd ;loop end
Exit
EndFunc

will try and make it better

Share this post


Link to post
Share on other sites
Generator

#include <GuiConstants.au3>
#include <Misc.au3>
Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Global $Form1
$Form1 = GUICreate("AForm1", 322, 218, 193, 115)
$Edit1 = GUICtrlCreateEdit("", 0, 0, 321, 185)
GUICtrlSetData(-1, StringFormat("Picture Taker Beta 1.04v \r\n\r\n* Advantages \r\n- No dll required \r\n\r\n* Disadvantages\r\n- Flickering\r\n- 99.9% chance of working\r\n- Not completely user friendly because of flickering\r\n"))
$Button1 = GUICtrlCreateButton("Picture Test", 0, 192, 75, 25, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            GUISetState(@SW_HIDE) ;hides GUI
            _Pic()
    EndSwitch
WEnd
Func _Pic()
BlockInput(1) ;blocks user input
Send("{PRINTSCREEN}") ;takes a picture of the screen
Run("mspaint") ;runs paint to put the print screen in since you can't put it in the clipboard for example ClipPut(Send("{PRINTSCREEN}"))
WinWait("untitled - Paint") ;waits for window 
WinSetTrans("untitled - Paint" , "" , 0)
If Not WinActive("untitled - Paint") Then WinActivate("untitled - Paint") ;activates window
WinWaitActive("untitled - Paint") ;waits until active
Send("{CTRLDOWN}v{CTRLUP}") ;pastes the image
Sleep(500) ;sleeps to wait for the paint window

;you only get this window if the image is bigger then the box
If WinExists("Paint") Then ;checks if window exists
WinActivate("Paint","The image in the cli") ;activates window
WinWaitActive("Paint","The image in the cli") ;waits until active
Send("Y") ;hits yes on the message box
Send("{ALTDOWN}fs{ALTUP}") ;opens the file menu and hits save 
EndIf

BlockInput(0) ;accepts user input
WinWait("Save As","Save as &type:") ;wait for save window
If Not WinActive("Save As","Save as &type:") Then WinActivate("Save As","Save as &type:") ;activate save window
WinWaitActive("Save As","Save as &type:") ;wait until activated
While 1 ;loop
    If Not WinExists("Save As") Then 
    ProcessClose("mspaint.exe") ;double checking
    GUISetState(@SW_SHOW) ;shows GUI
    EndIf
;   WinKill("untitled - Paint") ;kill after saved
    ExitLoop
WEnd ;loop end
Exit
EndFunc

will try and make it better

It almost killed me, my OS is in Chinese, winwait doesn't work here. I had to use Ctrl+Alt+Del while testing. Other hand i can't test it, but i think it will be great.

Share this post


Link to post
Share on other sites
PaulIA

Using Auto3Lib:

#include <A3LScreenCap.au3>

Global $hGUI, $iButton, $iCount=1

$hGUI    = GUICreate("Picture Taker", 200, 100)
$iButton = GUICtrlCreateButton("Take Picture", 64, 72, 75, 25)
GUISetState()

while 1
  Switch GUIGetMsg()
    case $iButton
      GUISetState(@SW_HIDE)
      Sleep(100)
      _ScreenCap_Capture("C:\Image" & $iCount & ".jpg")
      GUISetState()
      $iCount += 1
    case $GUI_EVENT_CLOSE
      Exit
  EndSwitch
wend

Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites
testingtest

Using Auto3Lib:

#include <A3LScreenCap.au3>

Global $hGUI, $iButton, $iCount=1

$hGUI    = GUICreate("Picture Taker", 200, 100)
$iButton = GUICtrlCreateButton("Take Picture", 64, 72, 75, 25)
GUISetState()

while 1
  Switch GUIGetMsg()
    case $iButton
      GUISetState(@SW_HIDE)
      Sleep(100)
      _ScreenCap_Capture("C:\Image" & $iCount & ".jpg")
      GUISetState()
      $iCount += 1
    case $GUI_EVENT_CLOSE
      Exit
  EndSwitch
wend
wow but whats autoit lib...?

Share this post


Link to post
Share on other sites
Generator

wow but whats autoit lib...?

You are late mate, read the sticky lol, great addition to scripting.

Share this post


Link to post
Share on other sites
testingtest

==> Error opening the file.: #include <A3LScreenCap.au3>

I don't understand is the file missing?

Share this post


Link to post
Share on other sites
testingtest

You need to install The PaulIA Lib.

I did hmm

Share this post


Link to post
Share on other sites
PaulIA

Then there should be no problem.

Amen. I have $100 that says that A3LScreenCap.au3 isn't in the production Include directory. Any takers? :rolleyes:

Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites
SalazarCheats

i can't run it... missing the include file... and don't ask if i have lib installed yes i do


Ok im 14 with a spelling age of a 9 year old... that explanes all my spelling mistakes

Share this post


Link to post
Share on other sites
i542

hmmm download/reinstall latest version of AutoIt Libary

@First post: Ok it is good picture taker. Four (* * * *) on the topic


I can do signature me.

Share this post


Link to post
Share on other sites
PaulIA

i can't run it... missing the include file... and don't ask if i have lib installed yes i do

I'll take you up on that $100 bet too. I'm betting you don't have any A3L*.au3 files in your production Include directory or you're not running the script using the latest production release.

Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites
PaulIA

Make sure, that if your running beta, the PaulIA's includes go into the beta include directory too

The Auto3Lib thread, the Auto3Lib download section and the Auto3Lib installer all tell you that Auto3Lib has to be run with the latest production version of AutoIt. In fact, the installer will give you a error message telling you that you need to update your AutoIt version if it's lower than 3.2.4.9 and it won't install. However, I've had a few bright people that have installed the latest version of AutoIt and then switched back to an old beta version of AutoIt before running the scripts. :rolleyes:

I'm afraid that stupidity is a cancer and I haven't found the cure yet (other than a .50 caliber suppository). :rambo:


Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites
SmOke_N

I'm afraid that stupidity is a cancer and I haven't found the cure yet (other than a .50 caliber suppository). :rambo:

:rolleyes: ... Can I be the trigger man?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
PaulIA

:rolleyes: ... Can I be the trigger man?

Take a number... :rambo:

Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.