Jump to content
Sign in to follow this  
ashley

OShell [Version 1.7] *new menu* *u choose password*

Recommended Posts

Hey Ashley! Check out the changes I made:

#include <GUIConstants.au3>
#include <Misc.au3>
#include <Date.au3>

Opt("RunErrorsFatal",0)

Global $List1, $Close, $Open, $Start, $Form1, $startmenu
Global $DoubleClicked   = False
Global Const $WM_NOTIFY = 0x004E
Global $StartMenuShow=False
Global $DateMenuShow=False

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("OS shell", 633, 430, 193, 115)
$ContMenu=GUICtrlCreateContextMenu()
$Run=GUICtrlCreateMenuItem("Run an application",$ContMenu)
GUICtrlCreateMenuItem("",$ContMenu)
$ChangeColor=GUICtrlCreateMenuItem("Change Background Color",$ContMenu)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUISetBkColor(0x808080)
$Start = GUICtrlCreateButton("Start", 3, 409, 75, 17, 0)
$Open = GUICtrlCreateButton("Open", 3, 409, 75, 17, 0)
GUICtrlSetState(-1, $GUI_HIDE)
$startmenu = GUICtrlCreateListView("Applications ", 8, 305, 85, 97,$LVS_NOSORTHEADER)
GUICtrlSetState(-1, $GUI_HIDE)
GUICtrlCreateListViewItem("Paint",$startmenu )
GUICtrlSetImage (-1, "shell32.dll",-35)
GUICtrlCreateListViewItem("Notepad",$startmenu )
GUICtrlSetImage (-1, "shell32.dll",-71)
$date = GUICtrlCreateMonthCal("2007/10/14", 432, 246, 191, 161)
GUICtrlSetState(-1, $GUI_HIDE)
$Time = GUICtrlCreateButton(_NowTime(), 544, 409, 75, 17, 0)
$Paint = GUICtrlCreateButton("Paint", 8, 8, 59, 49,BitOR($BS_PUSHBOX,$BS_FLAT,$BS_ICON))
GUICtrlSetImage (-1, "shell32.dll",-35)
$Notepad = GUICtrlCreateButton("Notepad", 8, 80, 59, 49, BitOR($BS_PUSHBOX,$BS_FLAT,$BS_ICON))
GUICtrlSetImage (-1, "shell32.dll",-71)
GUISetState()
#EndRegion ### END Koda GUI section ###

AdlibEnable("refresh_time",1000)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Start
            Startmenu()
        Case $Time
            If not $DateMenuShow Then
                GUICtrlSetState($date, $GUI_SHOW)
                $DateMenuShow=True
            Else
                GUICtrlSetState($date, $GUI_HIDE)
                $DateMenuShow=False
            EndIf
        Case $Paint
            GUICtrlDelete($Paint)
            $Paint = GUICtrlCreateButton("Paint", 8, 8, 59, 49,BitOR($BS_PUSHBOX,$BS_FLAT,$BS_ICON))
            GUICtrlSetImage (-1, "shell32.dll",-35)
            Run("MSpaint")
        Case $Notepad
            GUICtrlDelete($Notepad)
            $Notepad = GUICtrlCreateButton("Notepad", 8, 64, 59, 49, BitOR($BS_PUSHBOX,$BS_FLAT,$BS_ICON))
            GUICtrlSetImage (-1, "shell32.dll",-71)
            Run("notepad")
        Case $Run
            _Run()
        Case $ChangeColor
            _ChangeColor()
        EndSwitch
    If $DoubleClicked Then
        DoubleClickFunc()
        $DoubleClicked = False
    EndIf
WEnd
Func Startmenu()
    If not $StartMenuShow Then
        GUICtrlSetState($Startmenu, $GUI_SHOW)
        $StartMenuShow=True
    Else
        GUICtrlSetState($Startmenu, $GUI_HIDE)
        $StartMenuShow=False
    EndIf

EndFunc

Func refresh_time()
    GUICtrlSetData($Time,_NowTime())
EndFunc

Func WM_NOTIFY($hWnd, $MsgID, $wParam, $lParam)
    Local $tagNMHDR, $event, $hwndFrom, $code
    $tagNMHDR = DllStructCreate("int;int;int", $lParam)
    If @error Then Return 0
    $code = DllStructGetData($tagNMHDR, 3)
    If $wParam = $startmenu And $code = -3 Then $DoubleClicked = True
    Return $GUI_RUNDEFMSG
EndFunc

Func DoubleClickFunc()
   $App=GUICtrlRead(GUICtrlRead($Startmenu))
   Switch $App
       Case "Notepad"
           Run("notepad")
       Case "Paint"
            Run("mspaint")
    EndSwitch
EndFunc

Func _Run()
    GUISetState(@SW_DISABLE,$Form1)
    $RunCHild=GUICreate("Run", 291, 120, 226, 156, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS),-1,$Form1)
    GUICtrlCreateLabel("Type the name of the application you wish to execute", 8, 16, 276, 17)
    $Path = GUICtrlCreateInput("", 8, 40, 273, 21)
    $RunButton = GUICtrlCreateButton("&Run", 8, 80, 73, 25, $BS_DEFPUSHBUTTON)
    $CancelButton= GUICtrlCreateButton("&Cancel", 104, 80, 75, 25, 0)
    $Browse = GUICtrlCreateButton("&Browse", 200, 80, 75, 25, 0)
    GUISetState()
    While 1
        $CMsg=GUIGetMsg()
        Select 
        Case $CMsg=$GUI_EVENT_CLOSE OR $CMsg=$CancelButton
            GUISetState(@SW_ENABLE,$Form1)
            GUIDelete($RunChild)
            ExitLoop
        Case $CMsg=$RunButton
            Run(GUICtrlRead($Path))
            If @error Then
                MsgBox(4112,"Error","Unable to execute external program")
            Else
                GUISetState(@SW_ENABLE,$Form1)
                GUIDelete($RunChild)
                ExitLoop
            EndIf
        Case $CMsg=$Browse
            $PathOfFile=FileOpenDialog("Run Application",@Programfilesdir,"Programs (*.exe)", 1 )
            If not @error Then
                GUICtrlSetData($Path,$PathofFile)
            EndIf
        EndSelect
    WEnd
EndFunc


Func _ChangeColor()
    $bkColor=_ChooseColor(2)
    If not @error Then
        GUISetBkColor($bkColor)
    EndIf
EndFunc
*Removed X buttons

*Changed time format in time button

*Added context menu

*Run application

*Change background color

Edited by Nahuel

Share this post


Link to post
Share on other sites

It look nice.

Some suggestion:

1.Make it full screen.

2.Able to set wallpaper.

3.Right click menu.


[u]My Projects[/u]:General:WinShell (Version 1.6)YouTube Video Downloader Core (Version 2.0)Periodic Table Of Chemical Elements (Version 1.0)Web-Based:Directory Listing Script Written In AutoIt3 (Version 1.9 RC1)UDFs:UnicodeURL UDFHTML Entity UDF[u]My Website:[/u]http://dhilip89.hopto.org/[u]Closed Sources:[/u]YouTube Video Downloader (Version 1.3)[quote]If 1 + 1 = 10, then 1 + 1 ≠ 2[/quote]

Share this post


Link to post
Share on other sites

Very nifty. One item of note - in the line:

$date = GUICtrlCreateMonthCal("2007/10/14", 432, 246, 191, 161)

... be sure to clear the default date value in the quotes before compiling so 14 OCT isn't selected by default (today's date was correctly defined, but the 14th had a red "selection" border).


- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Share this post


Link to post
Share on other sites

Very nifty. One item of note - in the line:

$date = GUICtrlCreateMonthCal("2007/10/14", 432, 246, 191, 161)

... be sure to clear the default date value in the quotes before compiling so 14 OCT isn't selected by default (today's date was correctly defined, but the 14th had a red "selection" border).

tyvm FOR THE FEEDBACK, ANY IDEAS ON HOW TO FIX THE OTHER BUGS.

Share this post


Link to post
Share on other sites

this is a little script to demonstrate the full screen function. the code is quiet dirty but you make it.

CODE
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****

#AutoIt3Wrapper_icon=Icon.ico

#AutoIt3Wrapper_Res_Comment=Viel Spaß

#AutoIt3Wrapper_Res_Description=Blitzer

#AutoIt3Wrapper_Res_Fileversion=1.0.0.1

#AutoIt3Wrapper_Res_LegalCopyright=Paul

#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <GuiConstants.au3>

#region Global Variables and Constants

Global Const $WM_NCPAINT = 133 ; Message Rahmen neu zeichnen

Global Const $GWL_STYLE = -16 ; Windowstyle mit GetWindowLong/SetWindowLong abfragen/setzen

Global Const $GWL_EXSTYLE = -20 ; erweiterter Windowstyle mit GetWindowLong/SetWindowLong abfragen/setzen

#endregion

$Wait = 60

HotKeySet("{ESC}", "Ende")

$GUI = GUICreate("Techno")

_SetWinStyle($GUI)

GUISetCursor(16) ; maus verstecken

WinSetOnTop($GUI, "", 1)

GUISetState()

GUISetState(@SW_MAXIMIZE)

While 1

Sleep($Wait)

GUISetBkColor(0x000000, $GUI)

Sleep($Wait)

GUISetBkColor(0xFFFFFF, $GUI)

WEnd

Func Ende()

Exit

EndFunc

;===============================================================================

Func _SetWinStyle($StyleHandle)

$wh = WinGetHandle($StyleHandle)

$WinStyle = _WinGetStyle($wh)

; _WinSetStyle($wh, "", BitAND($WinStyle[0], BitNOT($WS_OVERLAPPEDWINDOW)))

_WinSetStyle($wh, "", BitAND($WinStyle[0], BitNOT($WS_OVERLAPPEDWINDOW), BitNOT($WS_EX_TOOLWINDOW) ) )

;;;;;;

dllCall("user32.dll", "long", "ShowWindow", "hwnd", $wh, "long", 0)

dllCall("user32.dll", "long", "SetWindowLong", "hwnd", $wh, "int", -20, "long", 0x80)

dllCall("user32.dll", "long", "ShowWindow", "hwnd", $wh, "long", 5)

EndFunc

;===============================================================================

;

; Description: Gibt die Fensterstile zurück

; Parameter(s): $WinTitle = Handle oder Titel des Fensters, das gelesen werden soll

; (optional) $WinText = Text des Fensters, das gelesen werden soll

; Requirement(s): keine

; Return Value(s): bei Erfolg: Array{0] = Fensterstil

; Array[1] = erweiterter Fensterstil

; bei Fehler: Leerstring und @error = 1

; Author(s): bernd670

;

;===============================================================================

Func _WinGetStyle($WinTitle, $WinText = "")

Local $RetValue[2], $Temp, $h_window

$h_window = $WinTitle

If Not IsHWnd($h_window) Then

$h_window = WinGetHandle($WinTitle, $WinText)

If @error Then

SetError(1)

Return ""

EndIf

EndIf

; read Windowstyle

$Temp = DllCall("user32.dll", "long", "GetWindowLong", "hwnd", $h_window, "long", $GWL_STYLE)

If @error Then

SetError(1)

Return ""

EndIf

$RetValue[0] = $Temp[0]

; read extended Windowstyle

$Temp = DllCall("user32.dll", "long", "GetWindowLong", "hwnd", $h_window, "long", $GWL_EXSTYLE)

If @error Then

SetError(1)

Return ""

EndIf

$RetValue[1] = $Temp[0]

SetError(0)

Return $RetValue

EndFunc

;===============================================================================

;

; Description: setzt die Fensterstile

; Parameter(s): $WinTitle = Handle oder Titel des Fensters, das gelesen werden soll

; (optional) $WinText = Text des Fensters, das gelesen werden soll

; (optional) $Style = Fensterstil (Standard = $WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU)

; (optional) $ExStyle = erweiterter Fensterstil (Standard = $WS_EX_APPWINDOW ,$WS_EX_WINDOWEDGE)

; Requirement(s): keine

; Return Value(s): bei Erfolg: 1

; bei Fehler: 0 und @error = 1

; Author(s): bernd670

;

;===============================================================================

Func _WinSetStyle ($WinTitle, $WinText = "", $Style = -1, $ExStyle = -1)

Local $h_window

$h_window = $WinTitle

If Not IsHWnd($h_window) Then

$h_window = WinGetHandle($WinTitle, $WinText)

If @error Then

SetError(1)

Return 0

EndIf

EndIf

; write Windowstyle

If $Style = -1 Then $Style = BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU)

DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $h_window, "long", $GWL_STYLE, "long", $Style)

If @error Then

SetError(1)

Return 0

EndIf

; write extended Windowstyle

If $ExStyle = -1 Then $ExStyle = BitOR($WS_EX_APPWINDOW ,$WS_EX_WINDOWEDGE)

DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $h_window, "long", $GWL_EXSTYLE, "long", $ExStyle)

If @error Then

SetError(1)

Return 0

EndIf

DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_window, "int", $WM_NCPAINT, "int", 1, "int", 0)

SetError(0)

Return 1

EndFunc

suggestion:

make GUICtrlSetCursor(0) for buttons and any else

Edited by health

Share this post


Link to post
Share on other sites

That looks very good Ashley! You could take a look at _ControlHover.au3 to hide the Start menu when the mouse is not over it. And maybe add more apps, would be nice to something made by you.

Btw, what's that poll for? :) Looks like you are in a competition or something...

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...