Jump to content

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


testingtest
 Share

Recommended Posts

#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

Link to comment
Share on other sites

#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.
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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...?
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Moderators

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...