Jump to content

Scripting help


keen
 Share

Recommended Posts

Ok well i'm making a text editor and i need to have a New command. How can i make it so when i press a button it clears the GUICRTLCREATEEDIT and makes it blank?

Also i need to make it so when i press a button it will go to save it.

Please help me!

[center]Kesne's Bar & Grill[/center]

Link to comment
Share on other sites

Well here is my current script:

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

; GUI
$gui = GUICreate("Delmen Text Editor", 640, 640, _
(@DesktopWidth - 800) / 2, (@DesktopHeight - 800) / 2, _
$WS_MAXIMIZE + $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
GUISetIcon("C:\Program Files\AutoIt3\beta\Icons\au3.ico", 0)


; BANNER
$s_TempFile = _TempFile()
InetGet("http://i37.photobucket.com/albums/e91/Zombie1992/logo4.gif", $s_TempFile)
GUICtrlCreatePic($s_TempFile, 0, 0, 400, 67)


; TAB
GUICtrlCreateTab(1, 70, 600, 400)
$tab1 = GUICtrlCreateTabItem("Welcome")

GUICtrlCreateTabItem("Text Editor")
$Edit_1 = GuiCtrlCreateEdit("", 15, 100, 350, 100, $WS_MAXIMIZE)
$New = GuiCtrlCreateButton("New", 20, 220, 100, 30)
$Open = GuiCtrlCreateButton("Open", 120, 220, 100, 30)
$Saveas = GuiCtrlCreateButton("Save", 220, 220, 100, 30)

GUISetState ()


While 1
    $msg = GUIGetMsg()
    
    Select          
            Case $msg = $Open
            GUICtrlSetData($Edit_1,Fileread(FileOpenDialog("Select a file to open",@ScriptDir, "All Files (*.*)")))
            
            Case $msg = $SaveAs
            GUICtrlSetData($Edit_1,Fileread(FileSaveDialog("Save As",@ScriptDir, "Delmen Text Editor (*.DTE)")))
        
        EndSelect   
     If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

So how will that work?

[center]Kesne's Bar & Grill[/center]

Link to comment
Share on other sites

$SaveDir = FileSaveDialog("Where would you like to save?",@DocumentsDir,"Text Document(*.txt)",16)

@documentsdir = path to current user "My Documents"

"Text Document(*.txt)" = Shows .txt files, and allows filtering in the bottom input

16 = Prompt to overwrite file

After that user $SaveDir as the path, if the user presses cancle then it might return blank or set @error to 1

Link to comment
Share on other sites

"Scripts (*.aut;*.au3)|Text files (*.ini;*.txt)|All programs (*.*)"

Seperate with horizontal line (under backspace on my computer when you hold shift, actually looks like a line-type colon though)

...Open the helpfile and go to search tab, then type FileSaveDialog for more help

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