eekhoorn12 Posted November 15, 2005 Share Posted November 15, 2005 (edited) Why doesn't this work? expandcollapse popup#include <array.au3> #include <string.au3> #include <GUIConstants.au3> GUICreate ( "title" , 800 , 600 ); will create a dialog box that when displayed is centered $RESULT = GUICtrlCreateInput("", 110, 40, 100, 20) $Start = GUICtrlCreateButton ("OK", 60, 70, 50) GUICtrlSetState(-1,$GUI_DEFBUTTON) GUISetState (@SW_SHOW) Global $LETTERS[6] $LETTERS[0] = "a" $LETTERS[1] = "b" $LETTERS[2] = "c" $LETTERS[3] = "d" $LETTERS[4] = "e" $LETTERS[5] = "f" $END_RESULT = "" For $x = 1 to StringLen($RESULT) $i = StringMid($RESULT,$x,1) $a = Asc ($i) If $a = 97 Then $a_i = $LETTERS[5] $END_RESULT = $END_RESULT & $a_i EndIf Next While 1 $msg = GUIGetMsg() Select Case $MSG = $GUI_EVENT_CLOSE Exit Case $msg = $Start MsgBox(0, '', $END_RESULT) EndSelect Wend I have changed the original code a bit. What I want is when I press ok it shows END_RESULT Edited November 15, 2005 by eekhoorn12 Link to comment Share on other sites More sharing options...
GaryFrost Posted November 15, 2005 Share Posted November 15, 2005 (edited) expandcollapse popup#include <array.au3> #include <string.au3> #include <GUIConstants.au3> GUICreate("title", 800, 600); will create a dialog box that when displayed is centered $RESULT = GUICtrlCreateInput("", 110, 40, 100, 20) $Start = GUICtrlCreateButton("OK", 60, 70, 50) GUICtrlSetState(-1, $GUI_DEFBUTTON) GUISetState(@SW_SHOW) Global $LETTERS[6] $LETTERS[0] = "a" $LETTERS[1] = "b" $LETTERS[2] = "c" $LETTERS[3] = "d" $LETTERS[4] = "e" $LETTERS[5] = "f" $END_RESULT = "" While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Start $s_Result = GUICtrlRead($RESULT) For $x = 1 To StringLen($s_Result) $i = StringMid($s_Result, $x, 1) $a = Asc($i) If $a = 97 Then $a_i = $LETTERS[5] $END_RESULT = $END_RESULT & $a_i EndIf Next MsgBox(0, '', $END_RESULT) EndSelect WEnd Edited November 15, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
SpookMeister Posted November 15, 2005 Share Posted November 15, 2005 I took a stab at what you were trying to do.. expandcollapse popup#include <array.au3> ;#include <string.au3> #include <GUIConstants.au3> GUICreate("title", 800, 600); will create a dialog box that when displayed is centered $RESULT = GUICtrlCreateInput("", 110, 40, 100, 20) $Start = GUICtrlCreateButton("OK", 60, 70, 50) GUICtrlSetState(-1, $GUI_DEFBUTTON) GUISetState(@SW_SHOW) Global $LETTERS[6] $LETTERS[0] = "a" $LETTERS[1] = "b" $LETTERS[2] = "c" $LETTERS[3] = "d" $LETTERS[4] = "e" $LETTERS[5] = "f" $END_RESULT = "" While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Start $data = GUICtrlRead($RESULT) $END_RESULT = $data & compute($data) MsgBox(0, '', $END_RESULT) EndSelect WEnd Func compute($var) For $x = 1 To StringLen($var) $i = StringMid($var, $x, 1) $a = Asc($i) If $a = 97 Then $a_i = $LETTERS[5] Return $a_i EndIf Next EndFunc ;==>compute [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
eekhoorn12 Posted November 15, 2005 Author Share Posted November 15, 2005 Have used the example given by gafrost and it works fine Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now