To create a function in the file you have to do: ; The point and comma symbol is used for comments #Include C:/.../library.ahk ; This line is used when you want to load a library with other already defined scripts for your script # Example: #Include C:\Users\carlrod2\Documents\CISCO\11 Scripts\Script Library\CRC01.ahk Function_name(argument1,argument2,argument3) ; You have to create it without space between the name of the function and the parenthesis or your script will not work correctly { return ; always put the return value at the end of the function } ;To put a value in a variable you can do: j = 1 ;But to add some data you have to do variable := variable + 10 ;To create a global variable, do: global j ; Sometimes to use the values of the arguments in the function you will have to use %var1%, as following: function(argument1,argument2,argument3) { MouseClick,left,%argument1%,%argument2%,%argument3% return } ; To create a message box to debug you can use: MsgBox, 3, TITLE, Box Message IfMsgBox Yes { Do something if yes... } IfMsgBox Cancel { break, 1 ; break the loop, the number in the break is how many loops or statements it breaks }