Sign in to follow this  
Followers 0
epicjawa

Hey guys im a noob!

4 posts in this topic

Hey guys, so I'm a Noob at this AutoIt program however I have some experience messing around with VBA and Matlab. So I was just wondering how to make this GUI run more than once. It calculates the first value fine the first time but if i put in another value it doesn't calculate it. Thanks if you take a look, peace!

#region
#AutoIt3Wrapper_useUpx=n
#AutoIt3Wrapper_Usex64=n
#EndRegion

#cs

#ce

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <Constants.au3>
#include <Math.au3>
#include <StaticConstants.au3>

Global $nMsg, $convert1,$alchprice,$shopbuyprice


GUICreate("High Alch Approximator by Epic Jawa 2013", 400, 200, -1, -1)
$HighA = GUICtrlCreateGroup("High Alchemy Calculator", 8, 16,384, 100)
GUICtrlCreateLabel("The price that the shop would pay:", 20, 40)
$shopbuyprice = GUICtrlCreateInput("",200,37,40,21)
GUICtrlCreateLabel("The high alchemy value is:", 20, 60)
$convert1 = GUICtrlCreateButton("Convert", 20, 80)
$clear = GUICtrlCreateButton("Clear Values", 100, 80)
GUISetState(@SW_SHOW)
$alchprice = GUICtrlCreateLabel("",150,60,40,20)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $convert1
            $shopbuyprice = GUICtrlRead($shopbuyprice)
            GUICtrlSetData($alchprice, round($shopbuyprice*1.313433))
        Case $clear
        GUICtrlSetData($alchprice,"")
        GUICtrlSetdata($shopbuyprice,0,"")

    EndSwitch

WEnd

GUIDelete()

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Maybe...

 
#region
#AutoIt3Wrapper_useUpx=n
#AutoIt3Wrapper_Usex64=n
#endregion
 
#cs
 
#ce
 
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <Constants.au3>
#include <Math.au3>
#include <StaticConstants.au3>
 
Global $nMsg, $convert1, $alchprice;, $shopbuyprice
 
 
GUICreate("High Alch Approximator by Epic Jawa 2013", 400, 200, -1, -1)
$HighA = GUICtrlCreateGroup("High Alchemy Calculator", 8, 16, 384, 100)
GUICtrlCreateLabel("The price that the shop would pay:", 20, 40)
$shopbuyprice = GUICtrlCreateInput("", 240, 37, 40, 21)
GUICtrlCreateLabel("The high alchemy value is:", 20, 60)
$convert1 = GUICtrlCreateButton("Convert", 20, 80)
$clear = GUICtrlCreateButton("Clear Values", 100, 80)
GUISetState(@SW_SHOW)
$alchprice = GUICtrlCreateLabel("", 190, 60, 40, 20)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $convert1
$readshopbuyprice = GUICtrlRead($shopbuyprice)
GUICtrlSetData($alchprice, Round($readshopbuyprice * 1.313433))
Case $clear
GUICtrlSetData($alchprice, "")
GUICtrlSetData($shopbuyprice, "", "")
 
EndSwitch
 
WEnd
 
GUIDelete()
 
Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

A control and a variable can not have the same name

$shopbuyprice

8)

PS.  Nice try for a first post... 8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

Your Awesome! Thnx!

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