Jump to content
Sign in to follow this  
JavaScript_Freek

SGUIM (Sample GUI Menu)

Recommended Posts

posted before trying it

but this one works

$installdir=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt","betaInstallDir")
;            $installdir = StringReplace( $installdir , " " , Chr( 32 ) )
            Run("explorer.exe " & $installdir & "\Examples")
                    Case $msg = $prog2
            Run("explorer.exe " & $installdir & "\Icons")
                    Case $msg = $prog3
            Run("explorer.exe " & $installdir & "\SciTe")
                        Case $msg = $prog4
            Run("explorer.exe " & $installdir & "\AU3Info.exe")
                        Case $msg = $prog5
            Run("explorer.exe " & $installdir & "\Extras")

Share this post


Link to post
Share on other sites

#include-once

; ------------------------------------------------------------------------------
;
; AutoIt Version: 3.1.1 (beta)
; Language:       English
; Description:    Windows constants.
;
; ------------------------------------------------------------------------------

; Window Styles
Global Const $WS_TILED              = 0
Global Const $WS_OVERLAPPED         = 0
Global Const $WS_MAXIMIZEBOX        = 0x00010000
Global Const $WS_MINIMIZEBOX        = 0x00020000
Global Const $WS_TABSTOP            = 0x00010000
Global Const $WS_GROUP              = 0x00020000
Global Const $WS_SIZEBOX            = 0x00040000
Global Const $WS_THICKFRAME         = 0x00040000
Global Const $WS_SYSMENU            = 0x00080000
Global Const $WS_HSCROLL            = 0x00100000
Global Const $WS_VSCROLL            = 0x00200000
Global Const $WS_DLGFRAME           = 0x00400000
Global Const $WS_BORDER             = 0x00800000
Global Const $WS_CAPTION            = 0x00C00000
Global Const $WS_OVERLAPPEDWINDOW   = 0x00CF0000
Global Const $WS_TILEDWINDOW        = 0x00CF0000
Global Const $WS_MAXIMIZE           = 0x01000000
Global Const $WS_CLIPCHILDREN       = 0x02000000
Global Const $WS_CLIPSIBLINGS       = 0x04000000
Global Const $WS_DISABLED           = 0x08000000
Global Const $WS_VISIBLE            = 0x10000000
Global Const $WS_MINIMIZE           = 0x20000000
Global Const $WS_CHILD              = 0x40000000
Global Const $WS_POPUP              = 0x80000000
Global Const $WS_POPUPWINDOW        = 0x80880000

; Dialog Styles
Global Const $DS_MODALFRAME         = 0x80
Global Const $DS_SETFOREGROUND      = 0x00000200
Global Const $DS_CONTEXTHELP        = 0x00002000

; Window Extended Styles
Global Const $WS_EX_ACCEPTFILES         = 0x00000010
Global Const $WS_EX_MDICHILD            = 0x00000040
Global Const $WS_EX_APPWINDOW           = 0x00040000
Global Const $WS_EX_CLIENTEDGE          = 0x00000200
Global Const $WS_EX_CONTEXTHELP         = 0x00000400
Global Const $WS_EX_DLGMODALFRAME       = 0x00000001
Global Const $WS_EX_LEFTSCROLLBAR       = 0x00004000
Global Const $WS_EX_OVERLAPPEDWINDOW    = 0x00000300
Global Const $WS_EX_RIGHT               = 0x00001000
Global Const $WS_EX_STATICEDGE          = 0x00020000
Global Const $WS_EX_TOOLWINDOW          = 0x00000080
Global Const $WS_EX_TOPMOST             = 0x00000008
Global Const $WS_EX_TRANSPARENT         = 0x00000020
Global Const $WS_EX_WINDOWEDGE          = 0x00000100
Global Const $WS_EX_LAYERED             = 0x00080000

; Messages
Global Const $WM_SIZE = 0x05
Global Const $WM_SIZING = 0x0214
Global Const $WM_USER = 0X400
Global Const $WM_GETTEXTLENGTH = 0x000E
Global Const $WM_GETTEXT = 0x000D


Share this post


Link to post
Share on other sites

#include-once

; ------------------------------------------------------------------------------
;
; AutoIt Version: 3.1.1 (beta)
; Language:       English
; Description:    Windows constants.
;
; ------------------------------------------------------------------------------

; Window Styles
Global Const $WS_TILED              = 0
Global Const $WS_OVERLAPPED         = 0
Global Const $WS_MAXIMIZEBOX        = 0x00010000
Global Const $WS_MINIMIZEBOX        = 0x00020000
Global Const $WS_TABSTOP            = 0x00010000
Global Const $WS_GROUP              = 0x00020000
Global Const $WS_SIZEBOX            = 0x00040000
Global Const $WS_THICKFRAME         = 0x00040000
Global Const $WS_SYSMENU            = 0x00080000
Global Const $WS_HSCROLL            = 0x00100000
Global Const $WS_VSCROLL            = 0x00200000
Global Const $WS_DLGFRAME           = 0x00400000
Global Const $WS_BORDER             = 0x00800000
Global Const $WS_CAPTION            = 0x00C00000
Global Const $WS_OVERLAPPEDWINDOW   = 0x00CF0000
Global Const $WS_TILEDWINDOW        = 0x00CF0000
Global Const $WS_MAXIMIZE           = 0x01000000
Global Const $WS_CLIPCHILDREN       = 0x02000000
Global Const $WS_CLIPSIBLINGS       = 0x04000000
Global Const $WS_DISABLED           = 0x08000000
Global Const $WS_VISIBLE            = 0x10000000
Global Const $WS_MINIMIZE           = 0x20000000
Global Const $WS_CHILD              = 0x40000000
Global Const $WS_POPUP              = 0x80000000
Global Const $WS_POPUPWINDOW        = 0x80880000

; Dialog Styles
Global Const $DS_MODALFRAME         = 0x80
Global Const $DS_SETFOREGROUND      = 0x00000200
Global Const $DS_CONTEXTHELP        = 0x00002000

; Window Extended Styles
Global Const $WS_EX_ACCEPTFILES         = 0x00000010
Global Const $WS_EX_MDICHILD            = 0x00000040
Global Const $WS_EX_APPWINDOW           = 0x00040000
Global Const $WS_EX_CLIENTEDGE          = 0x00000200
Global Const $WS_EX_CONTEXTHELP         = 0x00000400
Global Const $WS_EX_DLGMODALFRAME       = 0x00000001
Global Const $WS_EX_LEFTSCROLLBAR       = 0x00004000
Global Const $WS_EX_OVERLAPPEDWINDOW    = 0x00000300
Global Const $WS_EX_RIGHT               = 0x00001000
Global Const $WS_EX_STATICEDGE          = 0x00020000
Global Const $WS_EX_TOOLWINDOW          = 0x00000080
Global Const $WS_EX_TOPMOST             = 0x00000008
Global Const $WS_EX_TRANSPARENT         = 0x00000020
Global Const $WS_EX_WINDOWEDGE          = 0x00000100
Global Const $WS_EX_LAYERED             = 0x00080000

; Messages
Global Const $WM_SIZE = 0x05
Global Const $WM_SIZING = 0x0214
Global Const $WM_USER = 0X400
Global Const $WM_GETTEXTLENGTH = 0x000E
Global Const $WM_GETTEXT = 0x000D
Thanks time to write revisions! :whistle:

[center]Cookyx.com :: Simple LAN Chat[/center]

Share this post


Link to post
Share on other sites

While 1
    $installdir = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "betaInstallDir")
    $msg = GUIGetMsg()
    
    Select
        Case $msg = $fileitem
            $file = FileOpenDialog("Choose file...", @TempDir, "All (*.*)")
            If @error <> 1 Then GUICtrlCreateMenuitem($file, $recentfilesmenu)
        Case $msg = $exititem
            ExitLoop
        Case $msg = $GUI_EVENT_CLOSE
;~    $oRP.SaveFile (@ScriptDir & "RichText.rtf", 0)
            Exit
        Case $msg = $TagsPageC
            Run(@ComSpec & ' /c start http://www.autoitscript.com/autoit3%27"]http://www.autoitscript.com/autoit3', '', @SW_HIDE)
            
        Case $msg = $aboutitem
            MsgBox(0, "About Sample GUI Menu", "Sample GUI Menu V2" & @CRLF & @CRLF & "Created by: Javascript_Freek" & @CRLF & "" & @CRLF & "©AutoIt")
        Case $msg = $prog1
            Run("explorer.exe " & $installdir & "\Examples")
        Case $msg = $prog2
            Run("explorer.exe " & $installdir & "\Icons")
        Case $msg = $prog3
            Run("explorer.exe " & $installdir & "\SciTe")
        Case $msg = $prog4
            Run($installdir & "\AU3Info.exe")
        Case $msg = $prog5
            Run("explorer.exe " & $installdir & "\Extras")
        Case $msg = $GUI_EVENT_CLOSE
            $msg = GUIGetMsg()
        Case $msg = $Button_7
            GUICtrlSetData($Edit_1, FileRead(FileOpenDialog("Select a file to open", @ScriptDir, "All Files (*.*)")))
        Case $msg = $button
            MsgBox(0, "listview item", GUICtrlRead(GUICtrlRead($listview)), 2)
        Case $msg = $listview
            MsgBox(0, "listview", "clicked=" & GUICtrlGetState($listview), 2)
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd

just some minor tweaks

Edited by CWorks

Share this post


Link to post
Share on other sites

just a few changes so executable works without beta (uses "InstallDir" for regread)

also moved regread to top so GUISetIcon and SciTE menu can use $installdir

;***********************
; Sample GUI Menu
; Coded by: Dan
; August 2, 2006
; Special Thanks to: gafrost, SmOke_N, Skruge, Paulie, CWorks, and codemyster!
;***********************

#include <GUIConstants.au3>
#include <Misc.au3>
#include <File.au3>
#include <GuiListView.au3>
#include <Process.au3>
FileWrite("c:/blank.txt", "")
Global $oRP

$installdir = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "betaInstallDir")
If $installdir = "" Then $installdir = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir")

$name = InputBox("Log In", "Please enter your name:")

; GUI
GUICreate("Sample GUI Menu", 400, 400)
;\Icons\au3.ico only found in beta version this is in both \Aut2Exe\Icons\AutoIt_HighColor.ico
;not really needed since it will default to this unless compiled with different icon
GUISetIcon($installdir & "\Aut2Exe\Icons\AutoIt_HighColor.ico", 0)oÝ÷ Ùجi¹^u'"LIæ§uÈZ¶b²ZÊ«¨µ'"LIèµú.Ú®¢ØbËZWjëh×6; MENU
$filemenu = GUICtrlCreateMenu("File")
$fileitem = GUICtrlCreateMenuitem("Open...", $filemenu)
$recentfilesmenu = GUICtrlCreateMenu("Recent Files", $filemenu)
$separator1 = GUICtrlCreateMenuitem("", $filemenu)
$exititem = GUICtrlCreateMenuitem("Exit", $filemenu)
$filemenu = GUICtrlCreateMenu("AutoIt")
$prog4 = GUICtrlCreateMenuitem("Run AutoIt",$filemenu)
$prog5 = GUICtrlCreateMenuitem("Extras",$filemenu)
$prog1 = GUICtrlCreateMenuitem("Scripts",$filemenu)
$prog2 = GUICtrlCreateMenuitem("Icons",$filemenu)
; not pointing to anything
;$sguim1 = GUICtrlCreateMenuitem("Sample GUI Menu V1",$filemenu)
If FileExists ($installdir & "\SciTE\") Then 
    $prog3 = GUICtrlCreateMenuitem("SciTE",$filemenu)
Else
    $prog3 = GUICtrlCreateMenuitem("SciTE not found",$filemenu)
GUICtrlSetState(-1,$GUI_DISABLE)
    EndIf
$helpmenu = GUICtrlCreateMenu("About")
$aboutitem = GUICtrlCreateMenuitem("About", $helpmenu)
GUISetState(@SW_Show)
Edited by CWorks

Share this post


Link to post
Share on other sites

you need to remove the regread at the bottom (before While 1) since it will defeat the purpose of the one's at the top

btw i gave an example of using space to close program here

Edited by CWorks

Share this post


Link to post
Share on other sites

I just noticed that SciTE is installed with AutoIt so you can remove that part

I always installed it after installing AutoIt and never realized it came with it :whistle:

oh well i like the extra stuff you get with the seperate install of SciTE


Share this post


Link to post
Share on other sites

I just noticed that SciTE is installed with AutoIt so you can remove that part

I always installed it after installing AutoIt and never realized it came with it :whistle:

oh well i like the extra stuff you get with the seperate install of SciTE

What extra stuff? I wasn't aware there was any. I have used VIM until I started with Autoit.

I did look at SciTE years past but left it alone. I perfer VIM's RegExp better...

vim

Share this post


Link to post
Share on other sites

CWorks threw me with the "extra stuff" about SciTE. I realized I went off-topic with my reply to him.

This is a great example of a sample GUI. Great job!

vim... what do you mean? o_o

( VIM = vi improved - was my editor of choice in UNIX)

Share this post


Link to post
Share on other sites

Bump.

very nice :whistle: I can now figure out how to do a table in a GUI! Thanks, you saved me some searching. One thing though, does this require beta? The combo and text box on the main tab don't let me edit them.

correction: they don't let me *click* them for some reason. But I can tab to them and use arrow keys/alt/etc... to do whatever with them.

Edited by fisofo

Share this post


Link to post
Share on other sites

Hey JSF, I've helped you with your questions and other stuff, why am I not in the recognition list. Just wondering.

AutoIt Smith

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...