Jump to content

Add variables


autow
 Share

Recommended Posts

hi everyone,I need to add variables and multiply the result by six thousand,look my code:

HotKeySet ("\","Terminate")
$x = InputBox ("value","How much?")
$Y = InputBox ("value","How much?")
$Z = InputBox ("value","How much?")
$X1 = InputBox ("value","How much?")
$Y1 = InputBox ("value","How much?")
$Z1 = InputBox ("value","How much?")
$X2 = InputBox ("value","How much?")
$Y3 = InputBox ("value","How much?")
$time = ???

I try this:

$time = ($x += $y += $z) *6000

but i can´t someone can help me?

Edited by autow
Link to comment
Share on other sites

Hello autow,

First I'd like to Welcome you to the AutoIt Forums ;)

Try this:

$time = ($x + $y + $z) *6000

Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

HotKeySet ("\","_Terminate")


$x = InputBox ("value","How much?")
$Y = InputBox ("value","How much?")
$Z = InputBox ("value","How much?")
$X1 = InputBox ("value","How much?")
$Y1 = InputBox ("value","How much?")
$Z1 = InputBox ("value","How much?")
$X2 = InputBox ("value","How much?")
$Y3 = InputBox ("value","How much?")
$time = ($x + $y + $z) *6000


Func _Terminate()
Exit
EndFunc

If you noticed , I mad two changes. One up here... "HotKeySet ("\","_Terminate")" ... I added an underscore. No really really, I just like it better like that. I bring that up before there has to a function that the hotkeyset points to. So I created a function called _Terminate , ( like you had in the HotKeySet ) ... Which, I assumed by the name of it, was intended to exit the script. So thats what I did.

Are you wanting this script to run through one time, and then exit? Or keep on repeating until you press \

Edited by Dreu
Link to comment
Share on other sites

HotKeySet("\", "Terminate")

Global $x = 0

For $i = 1 To 8 Step 1
    $x += InputBox("value", "How much?")
Next

Global $time = $x * 6000

MsgBox(0, "$time", $time)

Func Terminate()
    Exit
EndFunc ;==>Terminate

or

HotKeySet("\", "Terminate")

Global $x

While 1
    $x += InputBox("Value", "How much?")
WEnd

Func Terminate()
    Local $time = $x * 6000
    MsgBox(0, "$time", $time)
    Exit
EndFunc ;==>Terminate
Edited by jaberwocky6669
Link to comment
Share on other sites

HotKeySet ("\","_Terminate")


$x = InputBox ("value","How much?")
$Y = InputBox ("value","How much?")
$Z = InputBox ("value","How much?")
$X1 = InputBox ("value","How much?")
$Y1 = InputBox ("value","How much?")
$Z1 = InputBox ("value","How much?")
$X2 = InputBox ("value","How much?")
$Y3 = InputBox ("value","How much?")
$time = ($x + $y + $z) *6000


Func _Terminate()
Exit
EndFunc

If you noticed , I mad two changes. One up here... "HotKeySet ("\","_Terminate")" ... I added an underscore. No really really, I just like it better like that. I bring that up before there has to a function that the hotkeyset points to. So I created a function called _Terminate , ( like you had in the HotKeySet ) ... Which, I assumed by the name of it, was intended to exit the script. So thats what I did.

Are you wanting this script to run through one time, and then exit? Or keep on repeating until you press \

I want terminate the script pressing \

HotKeySet("\", "Terminate")

Global $x = 0

For $i = 1 To 8 Step 1
    $x += InputBox("value", "How much?")
Next

Global $time = $x * 6000

MsgBox(0, "$time", $time)

Func Terminate()
    Exit
EndFunc ;==>Terminate

or

HotKeySet("\", "Terminate")

Global $x

While 1
    $x += InputBox("Value", "How much?")
WEnd

Func Terminate()
    Local $time = $x * 6000
    MsgBox(0, "$time", $time)
    Exit
EndFunc ;==>Terminate

This code is for repeate script?

Thanks

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