Screenshot-Maker

08/22/2010 14:02 luckkylooser#1
Hallo,

ich habe bei meinem Screenshot-Maker ein Problem. Man soll ja mit dem Screenshot-Maker mehrere Bilder erstellen können. Der Dateiname vom Screenshot soll immer GDIPlus_ImageXXX.jpg lauten. Für XXX immer eine Zahl (also GDIPlus_Image1.jpg, GDIPlus_Image2.jpg usw.) Aber wie mache ich das?Hier mal bis jetzt der Code:

PHP Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ScreenCapture.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Screenshot Maker :)", 410, 311, 192, 124)
$Pic1 = GUICtrlCreatePic("C:\Users\Admin\Pictures\Lustige Bilder\sexy-natal_950664287_0063.jpg", 0, 0, 425, 329, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetState(-1, $GUI_DISABLE)
$Button_Screenshot = GUICtrlCreateButton("Screenshot vom Bildschirm!", 96, 136, 235, 33, $WS_GROUP)
GUICtrlSetFont(-1, 10, 800, 2, "Lucida Calligraphy")
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg 
= GUIGetMsg()
Switch 
$nMsg
Case $GUI_EVENT_CLOSE
Exit

Case 
$Button_Screenshot
    Msgbox
(64, "Speicherung", "Speicherung erfolgt in Eigene Dateien!")
    
GUISetState(@SW_HIDE)
    
Sleep(500)
    
_ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image1.jpg")
    
Sleep(500)
    If 
FileExists(@MyDocumentsDir & "\GDIPlus_Image1.jpg") Then
        MsgBox
(64, "Erfolgreich", "Screenshot wurde erfolgreich erstellt")
    EndIf
    
GUISetState(@SW_SHOW)


EndSwitch
WEnd 
08/22/2010 14:51 Imaginär#2
PHP Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ScreenCapture.au3>

Global $zahl = 1
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Screenshot Maker :)", 410, 311, 192, 124)
$Pic1 = GUICtrlCreatePic("C:\Users\Admin\Pictures\Lustige Bilder\sexy-natal_950664287_0063.jpg", 0, 0, 425, 329, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetState(-1, $GUI_DISABLE)
$Button_Screenshot = GUICtrlCreateButton("Screenshot vom Bildschirm!", 96, 136, 235, 33, $WS_GROUP)
GUICtrlSetFont(-1, 10, 800, 2, "Lucida Calligraphy")
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg 
= GUIGetMsg()
Switch 
$nMsg
Case $GUI_EVENT_CLOSE
Exit

Case 
$Button_Screenshot
    Msgbox
(64, "Speicherung", "Speicherung erfolgt in Eigene Dateien!")
    
GUISetState(@SW_HIDE)
    
Sleep(500)
    
_ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image"&$zahl&".jpg")
    
Sleep(500)
    If 
FileExists(@MyDocumentsDir & "\GDIPlus_Image"&$zahl&".jpg") Then
        MsgBox
(64, "Erfolgreich", "Screenshot wurde erfolgreich erstellt")
        
$zahl += $zahl
    
EndIf
    
GUISetState(@SW_SHOW)


EndSwitch
WEnd 
So sollte es funktionieren
08/22/2010 14:57 Shadow992#3
Hier:
PHP Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ScreenCapture.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Screenshot Maker :)", 410, 311, 192, 124)
$Pic1 = GUICtrlCreatePic("C:\Users\Admin\Pictures\Lustige Bilder\sexy-natal_950664287_0063.jpg", 0, 0, 425, 329, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetState(-1, $GUI_DISABLE)
$Button_Screenshot = GUICtrlCreateButton("Screenshot vom Bildschirm!", 96, 136, 235, 33, $WS_GROUP)
GUICtrlSetFont(-1, 10, 800, 2, "Lucida Calligraphy")
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg 
= GUIGetMsg()
Switch 
$nMsg
Case $GUI_EVENT_CLOSE
Exit

Case 
$Button_Screenshot
    Msgbox
(64, "Speicherung", "Speicherung erfolgt in Eigene Dateien!")
    
GUISetState(@SW_HIDE)
;~     
Sleep(50)
    
$count=-1
    
for $i=0 to 100000
        
If FileExists(@MyDocumentsDir & "\GDIPlus_Image"&$i&".jpg")<>1 Then
            $count
=$i
        
EndIf
    
Next
    
if $count<>-1 Then
        _ScreenCapture_Capture
(@MyDocumentsDir & "\GDIPlus_Image"&$count&".jpg")
        
MsgBox(64, "Erfolgreich", "Screenshot wurde erfolgreich erstellt")
    Else
        
MsgBox(64, "Fehlgeschlagen", "Screenshot konnte nicht gespeichert werden")
    EndIf
;~     
Sleep(50)
    
GUISetState(@SW_SHOW)


EndSwitch
WEnd 
08/22/2010 15:31 luckkylooser#4
Eigentlich sollte er 1,2,3 Zählen und nicht 100000, 99999. Trotzdem danke :)
08/22/2010 16:50 KDeluxe#5
Es fehlt eigentlich nur ein "ExitLoop".
PHP Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ScreenCapture.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Screenshot Maker :)", 410, 311, 192, 124)
$Pic1 = GUICtrlCreatePic("C:\Users\Admin\Pictures\Lustige Bilder\sexy-natal_950664287_0063.jpg", 0, 0, 425, 329, BitOR($SS_NOTIFY,$WS_GROUP, $WS_CLIPSIBLINGS))
GUICtrlSetState(-1, $GUI_DISABLE)
$Button_Screenshot = GUICtrlCreateButton("Screenshot vom Bildschirm!", 96, 136, 235, 33, $WS_GROUP)
GUICtrlSetFont(-1, 10, 800, 2, "Lucida Calligraphy")
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While True
    $nMsg 
= GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Exit
        Case 
$Button_Screenshot
            Msgbox
(64, "Speicherung", "Speicherung erfolgt in Eigene Dateien!")
            
GUISetState(@SW_HIDE)
;~             
Sleep(50)
            
$Count = 0
            
For $i = 1 To 100000
                
If Not FileExists(@DesktopDir & "\GDIPlus_Image" & $i & ".jpg") Then
                    $count 
= $i
                    ExitLoop
                
EndIf
            
Next
            
If $Count > 0 Then
                _ScreenCapture_Capture
(@DesktopDir & "\GDIPlus_Image" & $count & ".jpg")
                
MsgBox(64, "Erfolgreich", "Screenshot wurde erfolgreich erstellt")
            Else
                
MsgBox(64, "Fehlgeschlagen", "Screenshot konnte nicht gespeichert werden")
            EndIf
;~             
Sleep(50)
            
GUISetState(@SW_SHOW)
    EndSwitch
WEnd 
08/22/2010 17:28 luckkylooser#6
Kann #geclosed werden.