Jump to content

guictrlread


Recommended Posts

Hello, i'm an italian boy (sorry, but my english isn't perfect...).

I met autoit about 1 year ago and I think it's simply FANTASTIC!

During this year I used other lenguages like C, Java, vb, Perl,Python, PHP, etc but I prefer program with autoit... It's easy and power... <_<

Now I'd like to ask something...

In this srcript:

;...:::*$$_/'''made up by darkjoker'''\_$$*:::...
#NoTrayIcon
#include <GUIConstants.au3>
GUICreate("File editor", 250, 350)
$input = GUICtrlCreateInput ("inserire il nome del file da creare o editare", 10, 30)
$edit = GUICtrlCreateEdit ("inserire il testo da inserire nel file", 10, 100)
$ok = GUICtrlCreateButton ("Go", 70, 300, 100, 30)
$about = GUICtrlCreateButton ("About the author", 70, 265, 100, 30)
GUISetState () 
While 1 
    $msg = GUIGetMsg() 
    Select 
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    case $msg = $ok 
        FileOpen(guictrlread ($input), 1)
        FileWriteLine (guictrlread ($input), guictrlread ($edit))
    case $msg = $about
        MsgBox (32, "About the author", "File editor è stato creato da darkjoker"&@crlf&"http://xhack.forumitalian.net")
    EndSelect
Wend

why can't i do it:

$var = guictrlread ($input)
$var2 = guictrlread ($edit)
;and then, in the loop
case $msg = $ok
    FileOpen($var, 1)
    FileWriteLine ($var, $var2)

???

Thanks

darkjoker

PS: can i create a link in a messagebox?

goodbye

Link to comment
Share on other sites

Hello, i'm an italian boy (sorry, but my english isn't perfect...).

I met autoit about 1 year ago and I think it's simply FANTASTIC!

During this year I used other lenguages like C, Java, vb, Perl,Python, PHP, etc but I prefer program with autoit... It's easy and power... :)

Now I'd like to ask something...

In this srcript:

;...:::*$$_/'''made up by darkjoker'''\_$$*:::...
#NoTrayIcon
#include <GUIConstants.au3>
GUICreate("File editor", 250, 350)
$input = GUICtrlCreateInput ("inserire il nome del file da creare o editare", 10, 30)
$edit = GUICtrlCreateEdit ("inserire il testo da inserire nel file", 10, 100)
$ok = GUICtrlCreateButton ("Go", 70, 300, 100, 30)
$about = GUICtrlCreateButton ("About the author", 70, 265, 100, 30)
GUISetState () 
While 1 
    $msg = GUIGetMsg() 
    Select 
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    case $msg = $ok 
        FileOpen(guictrlread ($input), 1)
        FileWriteLine (guictrlread ($input), guictrlread ($edit))
    case $msg = $about
        MsgBox (32, "About the author", "File editor è stato creato da darkjoker"&@crlf&"http://xhack.forumitalian.net")
    EndSelect
Wend

why can't i do it:

$var = guictrlread ($input)
$var2 = guictrlread ($edit)
;and then, in the loop
case $msg = $ok
    FileOpen($var, 1)
    FileWriteLine ($var, $var2)
Welcome to AutoIt! :)

I don't see any reason why you can't do it that way, what happens when you try it? One thing to watch for is that the input and edit control data may have changed between the time it was saved to the variables and when the OK button gets clicked. And you need a FileClose() after the WEnd. It would also be easier to use a file handle:

While 1 
    $msg = GUIGetMsg() 
    Select 
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    case $msg = $ok 
        $hFile = FileOpen(guictrlread ($input), 1)
        FileWriteLine ($hFile, guictrlread ($edit))
    case $msg = $about
        MsgBox (32, "About the author", "File editor è stato creato da darkjoker"&@crlf&"http://xhack.forumitalian.net")
    EndSelect
Wend
FileClose($hFile)

:P

PS: can i create a link in a messagebox?

Hmm... good question... <_<
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...