Sign in to follow this  
Followers 0
D4rk^S0ul

Saving test from gui text box

8 posts in this topic

$savetext = GuiCtrlCreateMenu("Save")

$Edit_1 = GUICtrlCreateEdit("", 5, 45, 230, 130)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Case $msg = $savetext
    $edit_2 = GuiCtrlRead($Edit_1)
    $file = FileOpen("test.txt", 1)
    FileWrite($file, $edit_2)

That is my code so far can any1 help me to see what is wrong with this?

Share this post


Link to post
Share on other sites



$savetext = GuiCtrlCreateMenu("Save")

$Edit_1 = GUICtrlCreateEdit("", 5, 45, 230, 130)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Case $msg = $savetext
    $edit_2 = GuiCtrlRead($Edit_1)
    $file = FileOpen("test.txt", 1)
    FileWrite($file, $edit_2)

That is my code so far can any1 help me to see what is wrong with this?

<{POST_SNAPBACK}>

This is the whole script ?????????????

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

no thats the example of wat writes the file i dont see why this does not work, i normally get a random number in the file instead of the text

Share this post


Link to post
Share on other sites

no thats the example of wat writes the file i dont see why this does not work, i normally get a random number in the file instead of the text

<{POST_SNAPBACK}>

If you have a question it helps when you give a working script and you explain exactly what is going wrong... that saves a lot of "Let guess what his problem is" posts...

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

$savetext = GuiCtrlCreateMenu("Save")

$Edit_1 = GUICtrlCreateEdit("", 5, 45, 230, 130)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Case $msg = $savetext
    $edit_2 = GuiCtrlRead($Edit_1)
    $file = FileOpen("test.txt", 1)
    FileWrite($file, $edit_2)

That is my code so far can any1 help me to see what is wrong with this?

<{POST_SNAPBACK}>

Case $msg = $savetext
    $file = FileOpen("test.txt", 1)
    FileWrite($file, GuiCtrlRead($edit_1))
    FileClose($file)
EndSelect

you may have other issues in the script if that's not working, you may want to post a larger listing of the code, atleast all parts that concern variables or statements in segment listed...


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

#include <GUIConstants.au3>

Opt("TrayIconHide", 1)

GUICreate("QuickPad",240,180)

$filemenu = GuiCtrlCreateMenu ("File")
$fileitem = GuiCtrlCreateMenuitem ("Open...",$filemenu)
$recentfilesmenu = GuiCtrlCreateMenuitem ("Recent Files:",$filemenu)
$fileexit = GuiCtrlCreateMenuItem ("Exit",$filemenu)
$savetext = GuiCtrlCreateMenu("Save")

$Edit_1 = GUICtrlCreateEdit("", 5, 45, 230, 130)

GUISetState()

While(1)
    
    $msg = GUIGetMsg() 
    
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
            
        Case $msg = $fileexit
            Exitloop
        
        Case $msg = $savetext
            $edit_2 = GuiCtrlRead($Edit_1)
            $file = FileOpen("test.txt", 1)
            FileWrite($file, GuiCtrlRead($edit_1))
            FileClose($file)
        
        Case $msg = $fileitem
            $file = FileOpenDialog("Choose file...",@TempDir,"(*.txt)")
            If @error <> 1 Then GuiCtrlCreateMenuItem ($file,$recentfilesmenu)
                
        
    EndSelect
    
Wend

This isent goin to be a used program ;) just for my own learning really.

Edited by D4rk^S0ul

Share this post


Link to post
Share on other sites

Case $msg = $savetext is never true because $savetext is not a MenuItem...

Try:

#include <GUIConstants.au3>

Opt("TrayIconHide", 1)

GUICreate("QuickPad",240,180)

$filemenu = GuiCtrlCreateMenu ("File")
$fileitem = GuiCtrlCreateMenuitem ("Open...",$filemenu)
$recentfilesmenu = GuiCtrlCreateMenuitem ("Recent Files:",$filemenu)
$fileexit = GuiCtrlCreateMenuItem ("Exit",$filemenu)
$savetext = GUICtrlCreateMenuitem("Save",-1)

$Edit_1 = GUICtrlCreateEdit("", 5, 45, 230, 130)

GUISetState()

While(1)
    
    $msg = GUIGetMsg() 
    
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
            
        Case $msg = $fileexit
            Exitloop
        
        Case $msg = $savetext
            $edit_2 = GuiCtrlRead($Edit_1)
            $file = FileOpen("test.txt", 1)
            FileWrite($file, GuiCtrlRead($edit_1))
            FileClose($file)
        
        Case $msg = $fileitem
            $file = FileOpenDialog("Choose file...",@TempDir,"(*.txt)")
            If @error <> 1 Then GuiCtrlCreateMenuItem ($file,$recentfilesmenu)
                
        
    EndSelect
    
Wend

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Thanks ;) works gr8

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  
Followers 0