Jump to content

math problem


hugo321
 Share

Recommended Posts

ok, i have this code.

#include <GUIConstants.au3>
#include <Math.au3>

$Form1 = GUICreate("Form1", 625, 445, 193, 125)
$Button1 = GUICtrlCreateButton("Button1", 24, 24, 137, 65, 0)
$x1 = GUICtrlCreateInput("x1", 264, 40, 57, 21)
$y1 = GUICtrlCreateInput("y1", 344, 40, 49, 21)
$x2 = GUICtrlCreateInput("x2", 456, 40, 49, 21)
$y2 = GUICtrlCreateInput("y2", 528, 40, 49, 21)
$Label1 = GUICtrlCreateLabel(",", 328, 48, 12, 17)
$Label2 = GUICtrlCreateLabel(",", 512, 48, 12, 25)
GUISetState(@SW_SHOW)
$Label6 = GUICtrlCreateLabel("Label5", 168, 333, 276, 25)
;finalform
$Label3 = GUICtrlCreateLabel("Label3", 168, 288, 276, 25)
$Label4 = GUICtrlCreateLabel("Label4", 168, 310, 276, 25)
$Label5 = GUICtrlCreateLabel("Label5", 168, 333, 276, 25)


#EndRegion ### END Koda GUI section ###
$i = 100
Do
    $msg = GUIGetMsg()

$x1v = GUICtrlRead($x1)
$x2v = GUICtrlRead($x2)
$y1v = GUICtrlRead($y1)
$y2v = GUICtrlRead($y2)

    if $Msg = $Button1 then  $yy = (($y2v) - ($y1v))
    if $Msg = $Button1 then  $xx = (($x2v) - ($x1v))


    if $Msg = $Button1 then  $a = (($yy) / ($xx))   

    if $Msg = $Button1 then MsgBox(4096, "A=", $a) 

    if $Msg = $Button1 then  GUICtrlSetData($label3,"a=" & $a)
    if $Msg = $Button1 then  $b = $y1v-($a*$x1v)
    if $Msg = $Button1 then  GUICtrlSetData($label4,"b=" & $b)  
        
    ;formel
    if $Msg = $Button1 then  GUICtrlSetData($label5, "ponies=" & $a & "huggies+" $b )

until $msg = $GUI_EVENT_CLOSE

but!

error happens " GUICtrlSetData($label5, "ponies=" & $a & "huggies+" $b ) "

i want the final output to be

ponies=45huggies+50

given that $a is 45 and $b is 50

i dont get that autoit cant handle my ponies :P . (the text)

anyone can put the text in there and just give the final output as i want it? ;)

Link to comment
Share on other sites

You forgot an & on that line between "huggies+" and $b

Correct line:

if $Msg = $Button1 then  GUICtrlSetData($label5, "ponies=" & $a & "huggies+" & $b )
aaaah, you win :P

thanks

what confused me was that the autoit error was at "ponies="

right under the first "

i tought i was using """ wrong

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...