Jump to content
Sign in to follow this  

MemoWrite in GUI help

Recommended Posts

hello, i was wondering if you guys(and girls) could help me with this problem.

i would like the inputed name and other factors put into the memo part of the GUI (in this format "$Input_Name & "-" & $Input_3 & "-" & $Input_2 & "-" & $Input_1 & "=" & $total & " -" & $Input_rank")

for some reason it keeps coming out "5-9-11-13=62 -7" no matter what i put...

also maybe someone can explain what arrays are and how they work cause i dont understand them one bit..

;============= Script =============
; version: 1.00
; Language:    English
; Author:        Bryce
; Date:11-06-2011
; ----------------------------------------------------------------------------
; Script Start
; ----------------------------------------------------------------------------

#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <WindowsConstants.au3>
#Include <Date.au3>
#include <EditConstants.au3>
#include <WinAPI.au3>
#include <Crypt.au3>
#include <WindowsConstants.au3>

Global $iMemo,$BTNEXIT,$Paused,$success,$error
Global $mouse,$ratio,$total,$mouse2,$data
Global $Input_3,$Input_2,$Input_1,$3,$2,$1,$total
Global $msg,$Input_Name,$Input_rank
Opt('MustDeclareVars', 1)
Func Example1()
    Local $msg,$button
    GUICreate("Statistics Helper",430,500)
$iMemo = GUICtrlCreateEdit("", 5, 50, 400, 440, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
;note: loc l2r,loc u2d,sizexL,sizexh
GUICtrlCreateLabel("user Name", 10,5,100,20)
$Input_Name = GUICtrlCreateInput("" , 10,25,100,20,$ES_WANTRETURN)

GUICtrlCreateLabel("rank", 120,5)
$Input_rank=GUICtrlCreateCombo("Gladiator", 120, 25,85,20)
    GUICtrlSetData(-1, "Junior Gladiator|Cavalier|Praetor|Rider of Rohan|Advisor|Leader", "Gladiator")

GUICtrlCreateLabel("3P", 210,5,30,20)
$Input_3 = GUICtrlCreateInput("" , 210,25,30,20,$ES_WANTRETURN)

GUICtrlCreateLabel("2P", 250,5,30,20)
$Input_2 = GUICtrlCreateInput("" , 250,25,30,20,$ES_WANTRETURN)

GUICtrlCreateLabel("1P", 290,5,30,20)
$Input_1 = GUICtrlCreateInput("" , 290,25,30,20,$ES_WANTRETURN)

  $button=GUICtrlCreateButton("copy", 330,25,30,20)
  ;GUICtrlSetState(-1, $GUI_FOCUS)
If $msg = $button then
    While 1
        $msg = GUIGetMsg()
   case $msg = $GUI_EVENT_CLOSE 
   case $msg=$button
          $msg = GUIGetMsg()
$3= $Input_3 * 3
$2= $Input_2 * 2
$1= $Input_1 * 1
$total= $1+$2+$3
MemoWrite($Input_Name & "-" & $Input_3 & "-" & $Input_2 & "-" & $Input_1 & "=" & $total & "            -" & $Input_rank)

Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
func _1()


thanks in advance


Share this post

Link to post
Share on other sites

You're referencing the control ID of the control, and not its contents, use GUICtrlRead($Input_3) instead of $Input_3, as an example.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post

Link to post
Share on other sites

$inputname for example is the ID fo the control, and the IDs for controls are all numbers, which is why you see a number. When you create a control like this

$somecontrol = GuiCtrCreateSomething

then the returned value is the number for the next control, say 21. So $somecontrol is 21; it is control number 21 etc.

What you want is the text that is in the control whose ID is $inputname and you do that with the GuiCtrlRead function. Have a look in the help.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...