Jump to content
Sign in to follow this  

Can Someone Help Me Shorten My Script :D

Recommended Posts


Ok I Came Out With A Great Way... To Multiply Using AutoIt.. But I Was Wondering If There Was A Way To Make The _Equal

Function Shorter Maybe Using Arrays O: Well... Here Ya Go ^^

P.S.: It Can Do 0 - 9,000,000 x 1 , x 2 , x3 , x4 , x5 , x6 , x8 , x9 , x10

Hope You Guys And Girls Can Make It Do x1 - x1000 XD Well Thanks In Advance

#Include <GUIConstants.au3>

GUICreate("", 266, 75)
GUISetOnEvent($GUI_EVENT_CLOSE, '_Exit')
$Input_1 = GUICtrlCreateInput("", 10, 25, 65, 20)
GUICtrlCreateLabel ( "X", 85,27)
$Input_2 = GUICtrlCreateInput("", 100, 25, 65, 20)
$Button = GUICtrlCreateButton ( "=", 168,25,20,20)
GUICtrlSetOnEvent ($Button, "_Equal")
$Input_3 = GUICtrlCreateInput("", 190, 25, 65, 20)
GUISetState (@SW_SHOW)

While 1
Sleep (250) 

Func _Equal ()
If GUICtrlRead($Input_2) = 1 Then
$x1 = GUICtrlRead($Input_1)+0
GUICtrlSetData ($Input_3,$x1)
ElseIf GUICtrlRead($Input_2) = 2 Then 
$x2 = GUICtrlRead($Input_1)+GUICtrlRead($Input_1) 
GUICtrlSetData ($Input_3,$x2)
ElseIf GUICtrlRead($Input_2) = 3 Then
$x3 = GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1) 
GUICtrlSetData ($Input_3,$x3)
ElseIf GUICtrlRead($Input_2) = 4 Then
$x4 = GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1) 
GUICtrlSetData ($Input_3,$x4)
ElseIf GUICtrlRead($Input_2) = 5 Then
$x5 = GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)  
GUICtrlSetData ($Input_3,$x5)
ElseIf GUICtrlRead($Input_2) = 6 Then
$x6 = GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)   
GUICtrlSetData ($Input_3,$x6)
ElseIf GUICtrlRead($Input_2) = 7 Then
$x7 = GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)    
GUICtrlSetData ($Input_3,$x7)
ElseIf GUICtrlRead($Input_2) = 8 Then
$x8 = GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)     
GUICtrlSetData ($Input_3,$x8)
ElseIf GUICtrlRead($Input_2) = 9 Then
$x9 = GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)     
GUICtrlSetData ($Input_3,$x9)
ElseIf GUICtrlRead($Input_2) = 10 Then
$x10 = GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)+GUICtrlRead($Input_1)     
GUICtrlSetData ($Input_3,$x10)

Func _Exit ()

Latest Projects :- New & Improved TCP Chat

Share this post

Link to post
Share on other sites

I don't understand what this is supposed to do. Just looking for a fancy and unnecessarily complicated way to multiply numbers between 1 and 10?

I'm guessing you don't want this?

Func _Equal ()
GUICtrlSetData($Input_3,GUICtrlRead($Input_1) * GUICtrlRead($Input_2)) 
to make it more proper

int(int(GUICtrlSetData($Input_3,GUICtrlRead($Input_1)) * int(GUICtrlRead($Input_2)) ))


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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.