AutoHotKey tutorial

05/09/2007 02:23 AvatarOfMight#46
@Hieitk

Thank you very much Hieitk for helping me, reading my code and correcting it :D. I will make the corrections you made as soon as possible.
I really appreciate your help :D, especially because you spent a lot of time reading my noobish code, lol. And btw, I learnt a lot from your comments.

+k for sure :D
05/09/2007 04:59 Tinytox#47
Quote:
Originally posted by Tinytox@May 8 2007, 01:44
HIEITK DOSENT WANT KARMA PPLZ
ok fine - i changed it to this :D!!!

also- you deserve the karma, your keeping up with teh posts, that ALWAYS deserves karma, especialy in a guide like dis.
05/09/2007 05:17 AvatarOfMight#48
Quote:
Originally posted by Tinytox+May 8 2007, 22:59--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (Tinytox @ May 8 2007, 22:59)</td></tr><tr><td id='QUOTE'> <!--QuoteBegin--Tinytox@May 8 2007, 01:44
HIEITK DOSENT WANT KARMA PPLZ
ok fine - i changed it to this :D!!!

also- you deserve the karma, your keeping up with teh posts, that ALWAYS deserves karma, especialy in a guide like dis. [/b][/quote]
Yeah, Tinytox is right :D Hieitk DESERVES karma... He is so gentle that he shares his knowledge and not only his programs.
And btw... I already fixed my bot thanks to hieitk :D It still have some problems but I will fix them. I will release the code as soon as I'm done, which wont be today but soon :D.
05/10/2007 17:11 Tinytox#49
hehe cool :)

im still in basic stuff on here tho, not been much time lately :(

TTYL you all
05/10/2007 20:30 bombica23#50
Here, I upgrade my calculator with password.
But I have 1 problem.
When I log in there are still old buttons in the background.
Is there any way it can be fixed
And here is code (only login).

Code:
;login

Gui, Show , w400 h120, Login
Gui, Add, Edit, w50 h19 x20 y50 vNUMBER9 Left,
Gui, Add, Text, x20 y20 w90 Left,Enter password here.
Gui, Add, Button, x150 y20 w90 h50 vFIFTHBUTTON gtest , Login
return

test&#58;
{
Gui, Submit, NoHide
if NUMBER9 = lol
{
msgbox,,Loged in, You know the right password.
Gui, Add, Button, x20 y80 w90 vSIXTHBUTTON gcalculator, Login
return
}
else
{msgbox,,HAHHAHAHAHA, Wrong password.
return
}
}

calculator&#58;
{...
05/10/2007 21:37 hieitk#51
Quote:
Originally posted by bombica23@May 10 2007, 20:30
Here, I upgrade my calculator with password.
But I have 1 problem.
When I log in there are still old buttons in the background.
Is there any way it can be fixed
And here is code (only login).

Code:
;login

Gui, Show , w400 h120, Login
Gui, Add, Edit, w50 h19 x20 y50 vNUMBER9 Left,
Gui, Add, Text, x20 y20 w90 Left,Enter password here.
Gui, Add, Button, x150 y20 w90 h50 vFIFTHBUTTON gtest , Login
return

test&#58;
{
Gui, Submit, NoHide
if NUMBER9 = lol
{
msgbox,,Loged in, You know the right password.
Gui, Add, Button, x20 y80 w90 vSIXTHBUTTON gcalculator, Login
return
}
else
{msgbox,,HAHHAHAHAHA, Wrong password.
return
}
}

calculator&#58;
{...
send the whole code so i can run it and understand what u mean ^^
05/10/2007 23:37 Zeko#52
hieitk why dont u just make tha first Thread will all like this its easyer too read and will take less time to ppl learn :p just an idea
05/11/2007 06:42 bombica23#53
Here is it, password is lol.
05/11/2007 06:51 hieitk#54
Quote:
Originally posted by bombica23@May 11 2007, 06:42
Here is it, password is lol.
hhaa nice password =P
here you have the solution ^^
In red is what I had to add

Quote:

;login

Gui, Show , w400 h120, Login
Gui, Add, Edit, w50 h19 x20 y50 vNUMBER9 Left,
Gui, Add, Text, x20 y20 w90 vPASSTEXT Left,Enter password here.
Gui, Add, Button, x150 y20 w90 h50 vFIFTHBUTTON gtest , Login
return

test:
{
Gui, Submit, NoHide
if NUMBER9 = lol
{
msgbox,,Loged in, You know the right password.
Gui, Add, Button, x20 y80 w90 vSIXTHBUTTON gcalculator, Login
return
}
else
{
msgbox,,HAHHAHAHAHA, Wrong password.
return
}
}

calculator:
{

;#Hide old Gui elements#
GuiControl, Hide, NUMBER9
GuiControl, Hide, PASSTEXT
GuiControl, Hide, FIFTHBUTTON
GuiControl, Hide, SIXTHBUTTON



; sestevanje
Gui, Add, Edit, w50 h19 x20 y20 vNUMBER1 Left,
Gui, Add, Edit, w50 h19 x97 y20 vNUMBER2 Left,
Gui, Add, Text, x80 y22 w90 Left,+
Gui, Add, Button, x150 y20 w90 h20 vFIRSTBUTTON gsestevanje , sum up
Gui, Add, Edit, w65 h19 x270 y20 vRESULT ReadOnly Left,

; odstevanje
Gui, Add, Edit, w50 h19 x20 y40 vNUMBER3 Left,
Gui, Add, Edit, w50 h19 x97 y40 vNUMBER4 Left,
Gui, Add, Text, x77 y37 w90 Left,__
Gui, Add, Button, x150 y40 w90 h20 vTHIRDBUTTON godstevanje , count out
Gui, Add, Edit, w65 h19 x270 y40 vRESULT1 ReadOnly Left


; mnozenje
Gui, Add, Edit, w50 h19 x20 y60 vNUMBER5 Left,
Gui, Add, Edit, w50 h19 x97 y60 vNUMBER6 Left,
Gui, Add, Text, x80 y60 w90 Left,.
Gui, Add, Button, x150 y60 w90 h20 vSECONDBUTTON gmnozenje , multiplicate
Gui, Add, Edit, w65 h19 x270 y60 vRESULT2 ReadOnly Left

; deljnje
Gui, Add, Edit, w50 h19 x20 y80 vNUMBER7 Left,
Gui, Add, Edit, w50 h19 x97 y80 vNUMBER8 Left,
Gui, Add, Text, x80 y80 w90 Left,:
Gui, Add, Button, x150 y82 w90 h20 vFORTHBUTTON gdeljenje , divide
Gui, Add, Edit, w65 h19 x270 y80 vRESULT3 ReadOnly Left
return
}

sestevanje:
{
Gui, Submit, NoHide
sestevanje := NUMBER1+NUMBER2
GuiControl,, RESULT, %sestevanje%
return
}

odstevanje:
{
Gui, Submit, NoHide
odstevanje := NUMBER3-NUMBER4
GuiControl,, RESULT1, %odstevanje%
return
}

mnozenje:
{
Gui, Submit, NoHide
mnozenje := NUMBER5*NUMBER6
GuiControl,, RESULT2, %mnozenje%
return
}

deljenje:
{
Gui, Submit, NoHide
if input NUMBER8 = 0
{
msgbox,,Error message, You cannot divide with %NUMBER8%.
}
deljenje := NUMBER7/NUMBER8
GuiControl,, RESULT3, %deljenje%
return
}

GuiClose:
ExitApp
forgot to say, very well done :D
I like the idea of using a password to display gui elements =P
and u also added a msg for division by zero ^^

keep it up ;)


oh forgot about another thing, try this
Quote:

Gui, Add, Text, x20 y20 w90 Password vPASSTEXT Left,Enter password here.
This will display the input like a password ^^
05/11/2007 08:30 hieitk#55
@bombica23
and here u have a little sample of a calculator I just made ^^
hope it helps to give you ideas =D

Code:
Gui, Show , w140 h120 , MyCalc

;#EDIT#
Gui, Add, Edit, w95 h19 x20 y10 vNUM Number Center,0
Gui, Add, Edit, w95 h19 x20 y90 vOP Center ReadOnly,

;#BUTTONS
Gui, Add, Button, x20 y35 w20 gMAS Center, +
Gui, Add, Button, x42 y35 w20 gMENOS Center, -
Gui, Add, Button, x20 y60 w20 gDIVISION Center, /
Gui, Add, Button, x42 y60 w20 gMULTIPLICACION Center, *
Gui, Add, Button, x65 y35 w55 gIGUAL Center, =
Gui, Add, Button, x65 y60 w55 gCLEAR Center, C

return

MAS&#58;
{
Gui, Submit, NoHide
 if NUM =
 {
 msgbox,,Error,Enter a number
 }
 else
 {
 function &#58;= 1
 NUM1 &#58;= NUM
 GuiControl,, OP, %NUM% +
 GuiControl,, NUM, 
 }
return
}

MENOS&#58;
{
Gui, Submit, NoHide
 if NUM =
 {
 msgbox,,Error,Enter a number
 }
 else
 {
 function &#58;= 2
 NUM1 &#58;= NUM
 GuiControl,, OP, %NUM1% -
 GuiControl,, NUM, 
 }
return
}

MULTIPLICACION&#58;
{
Gui, Submit, NoHide
 if NUM =
 {
 msgbox,,Error,Enter a number
 }
 else
 {
 function &#58;= 3
 NUM1 &#58;= NUM
 GuiControl,, OP, %NUM1% *
 GuiControl,, NUM, 
 }
return
}

DIVISION&#58;
{
Gui, Submit, NoHide
 if NUM =
 {
 msgbox,,Error,Enter a number
 }
 else
 {
 function &#58;= 4
 NUM1 &#58;= NUM
 GuiControl,, OP, %NUM1% /
 GuiControl,, NUM, 
 }
return
}

IGUAL&#58;
{
 if function &#60;> 0
 {
 Gui, Submit, NoHide
 NUM2 &#58;= NUM
  if function = 1
  {
  RESULT &#58;= NUM1+NUM2
  SYMBOL = +
  }
  else if function = 2
  {
  RESULT &#58;= NUM1-NUM2
  SYMBOL = -
  }
  else if function = 3
  {
  RESULT &#58;= NUM1*NUM2
  SYMBOL = *
  }
  else if function = 4
  {
   if NUM2 &#60;> 0
   {
   RESULT &#58;= NUM1/NUM2
   SYMBOL = /
   }
   else
   {
   msgbox,,Error,Division by zero
   RESULT &#58;= NUM1 
   SYMBOL &#58;= 
   NUM1 &#58;=
   NUM2 &#58;=
   }
  }
 function = 0
 GuiControl,, NUM, %RESULT%
 GuiControl,, OP, %NUM1% %SYMBOL% %NUM2% = %RESULT%

 }
 else
 {
 msgbox,,Error,Please input a number
 }
return
}

CLEAR&#58;
{
 GuiControl,, NUM, 0
 GuiControl,, OP, 
 function = 0
}
return

GuiClose&#58;
ExitApp
05/11/2007 13:27 bombica23#56
@hieitk
Ty for helping me.
Great calculator.
Hm, interesting avatar.
05/13/2007 06:48 Tinytox#57
hieitk :O

omg dude, i liked ur old pic 5X betta :P

other then that, just droppin in to say whazzup :P
05/13/2007 08:13 bombica23#58
Quote:
Originally posted by Tinytox@May 13 2007, 06:48
hieitk :O

omg dude, i liked ur old pic 5X betta :P

other then that, just droppin in to say whazzup :P
Yea your old avatar was much better.
05/13/2007 08:57 hieitk#59
Quote:
Originally posted by bombica23+May 13 2007, 08:13--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (bombica23 @ May 13 2007, 08:13)</td></tr><tr><td id='QUOTE'><!--QuoteBegin--Tinytox@May 13 2007, 06:48
hieitk :O

omg dude, i liked ur old pic 5X betta :P

other then that, just droppin in to say whazzup :P
Yea your old avatar was much better.[/b][/quote]
thx guys, but I like this one better xD
I guess is becuz i got bored of the old one, besides this character is from a very good anime (that almost nobody knows xD)
imma change it soon anyway =P
I enjoy watching her face more than naruto's mad face lol

one more thing, let's try not to go off-topic lol
if u guys dont have questions related to the topic (autohotkey) use pm or something
anyway glad to hear from u guys, i Hope u keep progressing
ok guys, take care :)
05/13/2007 14:22 Nakor5#60
ok, excellent guide, this is what I made.
Be nice to know how to change the icon, I read the help file and it's all greek to me.
Looking forward to being able to add tabs so i can add a cost calculator without running a new prog.

@memorized128 - good idea, but couldn't think how to do it. So i mucked about with it a bit more and came up with the attached solution. Thnx for making me think :) Appreciate it.

Take the composition calculator link