Jump to content

Opening a file


 Share

Recommended Posts

i am working on a personal notepad. I had the open button before open a specified file taht was written in the input.

So if i type c:\windows\edit.txt

it would read the input box

read taht file and show it on the edit window

Then i started messing with options and it doesnt work anymore and i can't figure out why.

Heres my code

#include <GuiConstants.au3>


GuiCreate("AcidPad -by: AcidFear", 628, 451,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Edit_1 = GuiCtrlCreateEdit("", 10, 10, 610, 320)
$Button_2 = GuiCtrlCreateButton("Save", 20, 360, 70, 30)
$Button_3 = GuiCtrlCreateButton("Exit", 120, 360, 70, 30)
$Button_4 = GuiCtrlCreateButton("Open", 220, 360, 70, 30)

$Input_4 = GuiCtrlCreateInput("c:\documents and settings\acidfear\desktop\", 295, 365, 330, 20)
$menu = GUICtrlCreateMenu("File")
$menu_tree2=Guictrlcreatemenuitem("Open", $menu)
$menu_tree1=Guictrlcreatemenuitem("Exit", $menu)


GuiSetState()
AutoItSetOption("Trayiconhide" , 1)
While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        case $msg = $Button_3
            Exit
        case $msg = $menu_tree1
            exit
        
            
            
EndSelect
        
        
        If $msg = $button_4 then    
            GUICtrlSetData($edit_1, "")
            $doc = GUICtrlRead($Input_4)
            $doc2 = GUICtrlRead($doc)
            GUICtrlSetData($edit_1, $doc)       
            EndIf
        
        if $msg = $Button_2 Then
            $read = GUICtrlRead($Input_4)
            $read1 = guictrlread($edit_1)
            FileWriteLine($read,$read1)
        EndIf
    
        ;;;
    
WEnd
Exit
Link to comment
Share on other sites

  • Developers

Shouldn't this be something like:

$doc2 = FileRead($doc)
        GUICtrlSetData($Edit_1, $doc2)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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