Jump to content
Sign in to follow this  

Opening a file

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)

AutoItSetOption("Trayiconhide" , 1)
While 1
    $msg = GuiGetMsg()
        Case $msg = $GUI_EVENT_CLOSE
        case $msg = $Button_3
        case $msg = $menu_tree1
        If $msg = $button_4 then    
            GUICtrlSetData($edit_1, "")
            $doc = GUICtrlRead($Input_4)
            $doc2 = GUICtrlRead($doc)
            GUICtrlSetData($edit_1, $doc)       
        if $msg = $Button_2 Then
            $read = GUICtrlRead($Input_4)
            $read1 = guictrlread($edit_1)

Share this post

Link to post
Share on other sites

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 Rules
Live for the present,
Dream of the future,
Learn from the past.

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  

  • Create New...