RogerRabbitsClone Posted March 10, 2012 Share Posted March 10, 2012 hey autoiters, i dont know how to explain it much better than whats in the title. heres a simple example followed by my actual code. $quantity = user input $type = user input $sub = $($quantity)($type)sub any help is greatly appreciated. $250colorsub = 44 $500colorsub = 70 $1000colorsub = 122 $250blacksub = 26 $500blacksub = 34 $1000blacksub = 50 $500foilsub = 150 $1000foilsub = 255 $quantity = inputbox ("quantity", "how many cards? answer can be 250, 500 or 1000) $type = inputbox("type", "what kind? answers can be the following: " & @crlf & "color" & @crlf & "black" & @crlf & "foil") $sub = $($quantity)($type)sub $tax = $sub * .0875 $total = $sub + $tax <--a good way to start you day Link to comment Share on other sites More sharing options...
DW1 Posted March 10, 2012 Share Posted March 10, 2012 Not sure what the scenario is here, so I could be wrong, but there are probably better ways to do this than rely on a variables name. If for some reason this is what you want instead of, for instance, using an array to reference a string to a numeric value, then you could use Execute(): Local $quantity, $type $250colorsub = 44 $500colorsub = 70 $1000colorsub = 122 $250blacksub = 26 $500blacksub = 34 $1000blacksub = 50 $500foilsub = 150 $1000foilsub = 255 While Not StringRegExp($quantity, "^(250|500|1000)$") $quantity = InputBox("quantity", "how many cards? answer can be 250, 500 or 1000") WEnd While Not StringRegExp($type, "^(color|black|foil)$") $type = InputBox("type", "what kind? answers can be the following: " & @CRLF & "color" & @CRLF & "black" & @CRLF & "foil") WEnd $sSub = '$' & $quantity & $type & 'sub' $sub = Execute($sSub) $tax = $sub * .0875 $total = $sub + $tax MsgBox(0, 'test', 'Total = ' & $total & @CRLF & $sSub & ' = ' & $sub) AutoIt3 Online Help Link to comment Share on other sites More sharing options...
Chimaera Posted March 10, 2012 Share Posted March 10, 2012 Try this, i think this is what your after. $quantity = "test" $type ="middle" $sub = $quantity & $type & "sub" ConsoleWrite($sub & @CRLF) If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
RogerRabbitsClone Posted March 11, 2012 Author Share Posted March 11, 2012 @danwilli thats exactly what i needed. THANK YOU GUYS! $sSub = '$' & $quantity & $type & 'sub' $sub = Execute($sSub) <--a good way to start you day Link to comment Share on other sites More sharing options...
RogerRabbitsClone Posted March 11, 2012 Author Share Posted March 11, 2012 (edited) one more thing, im pasting these into indesign, how do i force them to be 2 decimal points? i know python would be: hours = 16.189 print(format(hours, ".2f")) >>>16.19 Edited March 11, 2012 by RogerRabbitsClone <--a good way to start you day Link to comment Share on other sites More sharing options...
DW1 Posted March 11, 2012 Share Posted March 11, 2012 You could use StringFormat(), or easier yet, just Round(): $hours = 16.189 ConsoleWrite(Round($hours, 2) & @CRLF) AutoIt3 Online Help 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