Sign in to follow this  
Followers 0
iHonda

My Screen Cover

1 post in this topic

It's been a while since I did anything with AutoIt almost a year, I started this project as a simple way to prevent my instructor from seeing me chatting in class and decided to advance it further to allow other features. What I have now is very simple and gave me a lot of trouble to figure out. Please let me know what could be changed and what could be added to make it better.

#Region;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=..\My Documents\pink-folders\pink_folders\icons\cd.ico
#AutoIt3Wrapper_Res_Fileversion=2.0.0.1
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_LegalCopyright=Copyright (c) HondaDesigns.com, 2008
#EndRegion;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>


;Global Variables
Global $Password_match
Global $Cover_Pic
Global $Password
Global $Password_Reveal
Global $Image_Path

;Hotkeys
HotKeySet("{HOME}", "_PasswordHandle")
HotKeySet("{Enter}", "_PasswordVerify")
HotKeySet("{END}", "_hide")


#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Screen Cover v1.1", 498, 196, 193, 125, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS))
$Group1 = GUICtrlCreateGroup("Cover Image", 16, 8, 465, 65)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Cover_Pic_Directory = GUICtrlCreateInput("", 32, 32, 353, 22)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Browse = GUICtrlCreateButton("Browse", 392, 32, 73, 25, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("Options", 16, 88, 305, 89)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
;$Startup = GUICtrlCreateCheckbox("Launch on Windows Startup", 32, 112, 161, 25)
;GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Password_Reveal = GUICtrlCreateCheckbox("Password on reveal", 32, 136, 121, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Password = GUICtrlCreateInput("", 160, 136, 137, 22, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL,$ES_PASSWORD))
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Start = GUICtrlCreateButton("Start", 368, 96, 113, 33, 0)
$Exit = GUICtrlCreateButton("Exit", 368, 144, 113, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###





While 1
    $nMsg = GUIGetMsg()
    Select
        Case $nMsg = $Browse
            $Image_Path = FileOpenDialog("Browse", @MyDocumentsDir, "Images (*.jpg;*.bmp)", 1 + 2)
            GUICtrlSetData($Cover_Pic_Directory, $Image_Path)
        Case $nMsg = $Start
            GUISetState(@SW_HIDE, "Form1")
            _CoverCreate()
        Case $nMsg = $Exit
            Exit
        Case $nMsg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd

;Functions
Func _CoverCreate()
    $Image = GUICtrlRead($Cover_Pic_Directory)
    $Cover = GUICreate("", @DesktopWidth + "3", @DesktopHeight + "3")
    $Cover_Pic = GUICtrlCreatePic($Image, -1, -1, @DesktopWidth + "3", @DesktopHeight + "3", BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    $Password_match = GUICtrlCreateInput ( "", @DesktopWidth/2-100, @DesktopHeight/2-35, 200, 20, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL,$ES_PASSWORD,$SS_CENTER))
    GUICtrlSetState($Password_match, $GUI_HIDE)
    GUISetState(@SW_HIDE, "Cover")
EndFunc
    
Func _PasswordHandle()
    $pPrompt = GUICtrlRead($Password_Reveal)
    If $pPrompt = $GUI_CHECKED Then
        GUICtrlSetState($Password_match, $GUI_SHOW)
        GUICtrlSetState($Cover_Pic, $GUI_HIDE)
    Else
        GUISetState(@SW_HIDE, "Cover")
    EndIf
EndFunc

Func _PasswordVerify()
    $Prompt = GUICtrlRead($Password_match)
    $Password_Return = GUICtrlRead($Password)
    If $Prompt = $Password_Return Then
        GUISetState(@SW_HIDE, "Cover")
    EndIf
EndFunc

Func _hide()
    GUISetState(@SW_SHOW, "Cover")
EndFunc

A great place to start Autoit 1-2-3

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  
Followers 0