Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

EasyAHK (A tool for creating scripts)


  • Please log in to reply
20 replies to this topic
TchnclFl
  • Members
  • 48 posts
  • Last active: Oct 11 2009 09:08 PM
  • Joined: 29 Jul 2009
I made this script to make it easier to make AHK scripts. As it's coded in AHK, it got a bit confusing at times to make it, but I hope it turned out all right. I've provided a link to the description of it, but that's not really necessary as it's all included in the application by pressing F1.

; Last updated 8-03-09 (5th Update)
/*
Added warnings when trying to delete a file/exit; Fixed "Cancel" problems; Other bug fixes
*/
Gui, Add, Text, x170 y25 w50 h20 , EasyAHK
Gui, Add, Button, x16 y55 w100 h30 , GUI
Gui, Add, Button, x146 y55 w100 h30 , IF
Gui, Add, Button, x276 y55 w100 h30 , Send
Gui, Add, Button, x16 y95 w100 h30 , URLDownToFile
Gui, Add, Button, x146 y95 w100 h30 , Else
Gui, Add, Button, x276 y95 w100 h30 , MsgBox
Gui, Add, Button, x16 y135 w100 h30 , Variable
Gui, Add, Button, x146 y135 w100 h30 , Return
Gui, Add, Button, x276 y135 w100 h30 , FileAppend
Gui, Add, Button, x16 y175 w100 h30 , FileRead
Gui, Add, Button, x146 y175 w100 h30 , TrayTip
Gui, Add, Button, x276 y175 w100 h30 , Sleep
Gui, Add, Button, x16 y215 w100 h30 , FileDelete
Gui, Add, Button, x146 y215 w100 h30 , InputBox
Gui, Add, Button, x276 y215 w100 h30 , FileCopy
Gui, Add, Button, x16 y255 w100 h30 , Button
Gui, Add, Button, x146 y255 w100 h30 , HotKey
Gui, Add, Button, x276 y255 w100 h30 , GUISubmit
Gui, Add, Button, x16 y295 w100 h30 , GUIDestroy
Gui, Add, Button, x146 y295 w100 h30 , Loop
Gui, Add, Button, x276 y295 w100 h30 , Comment
Gui, Add, Button, x10 y347 w150 h30, View/Edit
Gui, Add, Button, x160 y347 w72 h30, Test
Gui, Add, Button, x232 y347 w150 h30, Delete
;Off-Screen Controls
Gui, Add, Edit, vEdit x392 y0 w300 h347
Gui, Add, Text, x485 y357, Press Control+S to save..
Gui, Show, h377 w392, EasyAHK
varif = off
varelse = off
varloop = off
open = false
viewbutton = off
Update:
URLDownloadToFile, https://ahknet.autohotkey.com/~Tchnclfl/EasyAHK/EasyAHK.ahk, update.txt
FileReadLine, update, update.txt, 1
if (update = "; Last updated 8-03-09 (5th Update)") {
  FileDelete, update.txt
  GoTo ChooseName
} else {
  uptodate = false
  FileReadLine, reason, update.txt, 3
  msgbox, A new version of EasyAHK has been released!  Please press F6 to update to the latest version, or F4 to continue with this version.`n`nReson for update: %reason%
  F6::
  FileCopy, update.txt, EasyAHK.ahk, 1
  FileDelete, update.txt
  msgbox, EasyAHK will now close.  Please restart it to apply the update!
  ExitApp
  return
  F4::
  msgbox, EasyAHK will not be updated!  Please press Control+N to start a new project.
  FileDelete, update.txt
  return
}
ChooseName:
InputBox, name, Name, Choose a name for your file (or press F2 and type the name of a saved AHK project.)`n`n`nFor help with this program`, please press F1!
if ErrorLevel {
  TrayTip, Error, You did not choose a name!, 5, 3
  GoTo ChooseName
} else {
  if (name = "") {
    TrayTip, Error, You must choose a name!, 5, 3
	GoTo ChooseName
  } else {
    if (open = "false") {
	  FileAppend,; This project was created using EasyAHK, %name%.ahk
      TrayTip, %name%.ahk, Project %name%.ahk started!, 5, 1
	  FileRead, view, %name%.ahk
	  GuiControl,, Edit, %view%
	} else {
	  open = false
	  TrayTip, Opened File, You opened the file %name%.ahk!
	  ;Begin "View" update
      FileRead, view, %name%.ahk
      GuiControl,, Edit, %view%
      ;End "View" Update
	}
  }
}
return
GuiClose:
ExitApp
^!D::
{
msgbox, 4, Delete %name%.ahk?, Are you you want to completely delete %name%.ahk?
ifMsgBox Yes
{
FileDelete, %name%.ahk
TrayTip, %name%.ahk, %name%.ahk was successfully deleted!, 5, 1
Gui, Show, h377 w392, EasyAHK
viewbutton = off
GoTo ChooseName
} else {
return
}
}
Esc::
msgbox, 4, Quit?, Are you sure you want to quit?
IfMsgBox Yes
  ExitApp
else
  return
^N::
GoTo ChooseName
return
F2::
open = true
TrayTip, Open File, Type the name of your file into the field to open a previously saved file.., 5, 1
return
^R::
Run, %name%.ahk
return
F1::
msgbox, This script was created to make it simpler and more intuitive to create basic AutoHotKey scripts.  Although it was primarily designed for beginners who are just getting used to AutoHotKey`, it can prove useful to people who are more veteran to AHK.  To add one of the basic commands listed`, click the button labeled what you need.  You will most likely be led through a few InputBoxes that will ask for information about the command you are attempting to insert, and then insert it for you`n`nTo view your current script`, as it is`, press the "View/Edit" button at any time.  You may leave this window open while adding commands and it will automatically update.  `nTo edit the script manually`, press the "View/Edit" button at any time.  Don't forget to Press Control+S after you are done manually editing`, or your work will not be saved!  `nIf you do not see the command you would like to use`, you can simply use the View/Edit function to add it yourself.`nTo completely delete your script`, press Control+Alt+D.`nTo Run your script`, press Control+R`, or press the "Run" Button.`nFor a quicker way to exit the application completely`, press the Escape key.`n`nThanks for trying it out`, and if you have any questions`, please post/contact me!
return
^S::
Gui, Submit, NoHide
FileDelete, %name%.ahk
FileAppend, %Edit%, %name%.ahk
TrayTip, Manual Edit, Your script has been manually edited., 5, 1
return
;
;-------------
;Buttons
;-------------
;
ButtonGUI:
IfExist, SmartGUI.exe
  run, SmartGUI.exe
IfNotExist, SmartGUI.exe
  msgbox, SmartGUI either not installed or not in this directory.  Please download or move!
 return
 ;
 ;
 ;
 ButtonIF:
if (varif = "off") {
    InputBox, statement, IF Scenario, Type the scenario here without parenthesis; EXAMPLE:   variable = off
    if ErrorLevel
	  return
	else
	FileAppend, `nif (%statement%) {, %name%.ahk
	varif = on
	;Begin "View" update
    FileRead, view, %name%.ahk
    GuiControl,, Edit, %view%
    ;End "View" Update
	TrayTip, IF, "if (%statement%)" was added to your script!  Press the IF button again to close the tag., 5, 1
} else {
  if (varif = "on") {
    FileAppend, `n}, %name%.ahk
	varif = off
	;Begin "View" update
    FileRead, view, %name%.ahk
    GuiControl,, Edit, %view%
    ;End "View" Update
    TrayTip, IF, IF statement has been closed., 5, 1
  }
}
return
;
;
;
ButtonElse:
if (varelse = "off") {
  if ErrorLevel
	return
  else
  FileAppend, ` else {, %name%.ahk
  varelse = on
  ;Begin "View" update
  FileRead, view, %name%.ahk
  GuiControl,, Edit, %view%
  ;End "View" Update
  TrayTip, Else, Else has been added to the end of the last line.  Press Else again to close the tag., 5, 1
} else {
  if (varelse = "on") {
    FileAppend, `n}, %name%.ahk
	varelse = off
	;Begin "View" update
    FileRead, view, %name%.ahk
    GuiControl,, Edit, %view%
    ;End "View" Update
	TrayTip, Else, Your Else tag has been closed., 5, 1
  }
}
return
;
;
;
ButtonMsgBox:
InputBox, msg, MsgBox, Type the text to be displayed in the message box here, including options.
if ErrorLevel
  return
else
FileAppend, `nMsgBox`, %msg%, %name%.ahk
;Begin "View" update
FileRead, view, %name%.ahk
GuiControl,, Edit, %view%
;End "View" Update
TrayTip, MsgBox, Your message box has been addedl., 5, 1
return
;
;
;
ButtonVariable:
InputBox, var, Variable, Enter the name for your variable
if ErrorLevel
  return
else
InputBox, value, Value, Enter the value or contents of your variable
if ErrorLevel
  return
else
FileAppend, `n%var% = %value%, %name%.ahk
;Begin "View" update
FileRead, view, %name%.ahk
GuiControl,, Edit, %view%
;End "View" Update
TrayTip, %var%, Your variable`, %var%`, has been set to equal %value%., 5, 1
return
;
;
;
ButtonReturn:
FileAppend, `nreturn, %name%.ahk
;Begin "View" update
FileRead, view, %name%.ahk
GuiControl,, Edit, %view%
;End "View" Update
TrayTip, Return, A return command has been added to your script., 5, 1
Return
;
;
;
ButtonSend:
InputBox, send, Send, Please type what you would like the script to send.
if ErrorLevel
  return
else
FileAppend, `nsend`, %send%, %name%.ahk
;Begin "View" update
FileRead, view, %name%.ahk
GuiControl,, Edit, %view%
;End "View" Update
TrayTip, Send, A command to send %send% has been added to your script., 5, 1
return
;
;
;
ButtonURLDownToFile:
InputBox, URL, URL, Please type the URL to download
if ErrorLevel
  return
else
InputBox, filename, File Name, Please type the name to save the file as
if ErrorLevel
  return
else
FileAppend, `nURLDownloadToFile`, %URL%`, %filename%, %name%.ahk
;Begin "View" update
FileRead, view, %name%.ahk
GuiControl,, Edit, %view%
;End "View" Update
TrayTip, URLDownloadToFile, A command to download %URL% to the file %filename% has been added to your script., 5, 1
return
;
;
;
ButtonFileAppend:
InputBox, text, Text, Type the text to be added to the file
if ErrorLevel
  return
else
InputBox, appendedfile, Append To, Type the file to append the text to
if ErrorLevel
  return
else
FileAppend, `nFileAppend`, %text%`, %appendedfile%, %name%.ahk
;Begin "View" update
FileRead, view, %name%.ahk
GuiControl,, Edit, %view%
;End "View" Update
TrayTip, FileAppend, A command to append your text to %appendedfile% has been added to your script., 5, 1
return
;
;
;
ButtonFileRead:
InputBox, readvar, Variable Select, Please type a variable to read the file to
if ErrorLevel
  return
else
InputBox, readfile, File Select, Please choose a file to read from
if ErrorLevel
  return
else
FileAppend, `nFileRead`, %readvar%`, %readfile%, %name%.ahk
;Begin "View" update
FileRead, view, %name%.ahk
GuiControl,, Edit, %view%
;End "View" Update
TrayTip, FileRead, A command to FileRead %readfile% to %readvar% has been added to your script., 5, 1
return
;
;
;
ButtonTrayTip:
InputBox, traytiptitle, Title, Please choose a title for your TrayTip
if ErrorLevel
  return
else
InputBox, traytipcontents, Contents, Please type the contents of your tray tip, including any options
if ErrorLevel
  return
else
FileAppend, `nTrayTip`, %traytiptitle%`, %traytipcontents%, %name%.ahk
;Begin "View" update
FileRead, view, %name%.ahk
GuiControl,, Edit, %view%
;End "View" Update
TrayTip, TrayTip, A command to use a TrayTip titled %traytiptitle% has been added to your script., 5, 1
return
;
;
;
ButtonSleep:
InputBox, sleeptime, Sleep Time, Please enter the time to sleep in seconds.`n`nExample: 15
if ErrorLevel
  return
else
sleepthousands:= sleeptime * 1000
FileAppend, `nSleep`, %sleepthousands%, %name%.ahk
;Begin "View" update
FileRead, view, %name%.ahk
GuiControl,, Edit, %view%
;End "View" Update
TrayTip, Sleep, A command to sleep %sleeptime% seconds has been added to your script., 5, 1
return
;
;
;
ButtonComment:
InputBox, comment, Comment, Type the comment to be added to your script.
if ErrorLevel
  return
else
FileAppend, `n`; %comment%, %name%.ahk
;Begin "View" update
FileRead, view, %name%.ahk
GuiControl,, Edit, %view%
;End "View" Update
TrayTip, Comment, Your comment has been added to the end of your script.
return
;
;
;
ButtonFileDelete:
InputBox, deletedfile, File, Please type which file to delete.
if ErrorLevel
  return
else
FileAppend, `nFileDelete`, %deletedfile%, %name%.ahk
;Begin "View" update
FileRead, view, %name%.ahk
GuiControl,, Edit, %view%
;End "View" Update
TrayTip, FileDelete, A command to FileDelete %deletedfile% has been added to your script., 5, 1
return
;
;
;
ButtonInputBox:
InputBox, inputvariable, Variable, Please type a variable to store the user input in.
if ErrorLevel
  return
else
InputBox, inputtitle, Title, Please type a title for the InputBox.
if ErrorLevel
  return
else
InputBox, inputcontent, Content, Please type the content of the InputBox.
if ErrorLevel
  return
else
FileAppend, `nInputBox`, %inputvariable%`, %inputtitle%`, %inputcontent%, %name%.ahk
;Begin "View" update
FileRead, view, %name%.ahk
GuiControl,, Edit, %view%
;End "View" Update
TrayTip, InputBox, Your InputBox titled "%inputtitle%" has been added to your script., 5, 1
return
;
;
;
ButtonFileCopy:
InputBox, copysource, Source, Please type the path of the source file you wish to copy.
if ErrorLevel
  return
else
InputBox, copylocation, Location, Please type the file and path where you want the file to be copied to.
if ErrorLevel
  return
else
FileAppend, `nFileCopy`, %copysource%`, %copylocation%, %name%.ahk
;Begin "View" update
FileRead, view, %name%.ahk
GuiControl,, Edit, %view%
;End "View" Update
TrayTip, FileCopy, A command to copy %copysource% to %copylocation% has been added to your script., 5, 1
return
;
;
;
ButtonButton:
InputBox, buttonname, Button Name, Type the name of the button you wish to state commands for when pushed.`n`nAlways remember to add a "return" when done stating a button's commands!
if ErrorLevel
  return
else
FileAppend, `nButton%buttonname%:, %name%.ahk
;Begin "View" update
FileRead, view, %name%.ahk
GuiControl,, Edit, %view%
;End "View" Update
TrayTip, Button, You have started the commands for Button "%buttonname%"., 5, 1
return
;
;
;
ButtonHotKey:
InputBox, combo, Hot Key, Type the hotkey you would like to add a command to.`nRemember to use ^ for Control`, ! for Alt`, and # for the "Windows" Key.
if ErrorLevel
  return
else
FileAppend, `n%combo%::, %name%.ahk
;Begin "View" update
FileRead, view, %name%.ahk
GuiControl,, Edit, %view%
;End "View" Update
TrayTip, Hot Key, You have started the commands for Hot Key "%combo%"., 5, 1
return
;
;
;
ButtonGUISubmit:
FileAppend, `nGui`, Submit`, NoHide, %name%.ahk
;Begin "View" update
FileRead, view, %name%.ahk
GuiControl,, Edit, %view%
;End "View" Update
TrayTip, GUI Submit, A command to "Gui`, Submit`, NoHide" has been added to your script., 5, 1
return
;
;
;
ButtonGUIDestroy:
FileAppend, `nGui`, Destroy, %name%.ahk
;Begin "View" update
FileRead, view, %name%.ahk
GuiControl,, Edit, %view%
;End "View" Update
TrayTip, GUI Destroy, A command to "Gui`, Destroy" has been added to your script., 5, 1
return
;
;
;
ButtonLoop:
if (varloop = "off") {
  InputBox, iterations, Iterations, How many times would you like this to loop for?`n`nLeave blank for infinite.
  if ErrorLevel
    return
  else
  FileAppend, `nLoop`, %iterations%`n{, %name%.ahk
  varloop = on
  ;Begin "View" update
  FileRead, view, %name%.ahk
  GuiControl,, Edit, %view%
  ;End "View" Update
  TrayTip, Loop, A command to loop has been added to your script.  Press Loop again to close the loop., 5, 1
} else {
  FileAppend, `n}, %name%.ahk
  varloop = off
  ;Begin "View" update
  FileRead, view, %name%.ahk
  GuiControl,, Edit, %view%
  ;End "View" Update
  TrayTip, Loop, The open loop has been closed., 5, 1
}
  return
;
;-------------------------
;View/Delete/Test Buttons
;-------------------------
;
ButtonView/Edit:
if (viewbutton = "off") {
  viewbutton = on
  ;Gui, 2:Add, Edit, vEdit x0 y0 w300 h347
  ;Gui, 2:Add, Text, x95 y357, Press Control+S to save..
  ;Gui, 2:Show, x0 y0 h377 w300, Script
  Gui, Show, h377 w692, EasyAHK
  ;Begin "View" update
  FileRead, view, %name%.ahk
  GuiControl,, Edit, %view%
  ;End "View" Update
  TrayTip, You have opened View/Edit, You can view your script as it progresses along.  If you want to manually add something`, just type it where ever you need it and press Control+S to save it., 5, 1
} else {
  Gui, Show, h377 w392, EasyAHK
  viewbutton = off
  return
}
return
;
ButtonTest:
Run, %name%.ahk
return
;
ButtonDelete:
msgbox, 4, Delete %name%.ahk?, Are you you want to completely delete %name%.ahk?
ifMsgBox Yes
{
FileDelete, %name%.ahk
TrayTip, %name%.ahk, %name%.ahk was successfully deleted!, 5, 1
Gui, Show, h377 w392, EasyAHK
viewbutton = off
GoTo ChooseName
} else {
return
}

return
;

DIRECT DOWNLOADS:
EasyAHK.ahk
EasyAHK.exe
Help.txt (Also accessible by pressing F1 while running EasyAHK)

Please tell me if you find any mistakes/have any suggestions!

Bumblebee3unlogged in
  • Guests
  • Last active:
  • Joined: --
wow this is a great idea, have to try it tomrw when on comp

TchnclFl
  • Members
  • 48 posts
  • Last active: Oct 11 2009 09:08 PM
  • Joined: 29 Jul 2009
Posted an update which eliminates a few crucial typos including:
[*:zwnzo9b0]Else commands
[*:zwnzo9b0]Help message
[*:zwnzo9b0]Loop commands

peterm
  • Members
  • 60 posts
  • Last active: Jul 04 2013 05:24 PM
  • Joined: 25 Jul 2006
I love this idea. I would like to see help tips as I always struggle with "does the variable need %%" or not.

TchnclFl
  • Members
  • 48 posts
  • Last active: Oct 11 2009 09:08 PM
  • Joined: 29 Jul 2009
EasyAHK has been updated:
[*:1936pqk6]Added a system that checks for updates upon launching and applies them if you choose. You can also bypass the update by following the instructions!
Everyone please now use the latest version (the code listed here, the AHK download file, and the EXE are all up to date!) to insure that you stay current with any bugfixes / upgrades!

TchnclFl
  • Members
  • 48 posts
  • Last active: Oct 11 2009 09:08 PM
  • Joined: 29 Jul 2009
Major Update!:
[*:33v82mfn]MAJOR update including a new View/Edit system that doesn't rely on text editors, making this program more universal. Many typos have also been fixed, and the program itself has been generally streamlined.

TchnclFl
  • Members
  • 48 posts
  • Last active: Oct 11 2009 09:08 PM
  • Joined: 29 Jul 2009
5th Update today!
[*:50excrfc]GUI Improvements
[*:50excrfc]Bug Fixes

purloinedheart
  • Members
  • 538 posts
  • Last active: Sep 22 2014 09:35 PM
  • Joined: 04 Apr 2008
The 'Else' button might need some work, it adds it to the same line (Eg, try pressing If -> Msgbox->Else)

Looks very good :O


Edit: Might want to add a prompt before the Esc hot key, incase it's pressed by accident, etc.

TchnclFl
  • Members
  • 48 posts
  • Last active: Oct 11 2009 09:08 PM
  • Joined: 29 Jul 2009

The 'Else' button might need some work, it adds it to the same line (Eg, try pressing If -> Msgbox->Else)

Looks very good :O


Yes I know that. I used the One True Bracket style of else. It's meant to be used after the closing bracket of an if statement, which is ended on a new line if you use the script to do it.

Example:
if (condition = true) {
  msgbox, This is an example.
} Else {
  msgbox, This is the else statement.
}

Thanks :). The updating system should come in handy to fix bugs, etc. If you haven't, I recommend you use the version I've provided a download for / copy and paste the code.

Edit: Might want to add a prompt before the Esc hot key, incase it's pressed by accident, etc.


That will probably be included in the next update. It's not worth releasing a whole new version for something simple like that. I'll wait until a few non urgent bugs pop up to send out the update.

Fry
  • Members
  • 885 posts
  • Last active: Jan 17 2011 09:57 PM
  • Joined: 01 Nov 2007
Nice script, easy for beginners, however, you have some big problems.

If i click msgbox, then click cancel, its still added, this works for all of them

TchnclFl
  • Members
  • 48 posts
  • Last active: Oct 11 2009 09:08 PM
  • Joined: 29 Jul 2009

Nice script, easy for beginners, however, you have some big problems.

If i click msgbox, then click cancel, its still added, this works for all of them


Hmm..That is an issue. I suppose an if ErrorLevel could fix that. I would think this will also be included in the next update. In the meantime, you can edit it out manually (via View/Edit) and save it.

TchnclFl
  • Members
  • 48 posts
  • Last active: Oct 11 2009 09:08 PM
  • Joined: 29 Jul 2009
I went ahead and updated those problems:
[*:1z8uoszq]Cancel buttons will now work
[*:1z8uoszq]You will be prompted to continue when attempting to delete your file or exit.
The script should inform you of an update the next time you run it. If it doesn't please use the version provided here.

Fry
  • Members
  • 885 posts
  • Last active: Jan 17 2011 09:57 PM
  • Joined: 01 Nov 2007
Nice work, however why not just using return when they click cancel?

If they accidentaly clicked it, it puts them in a loop.

TchnclFl
  • Members
  • 48 posts
  • Last active: Oct 11 2009 09:08 PM
  • Joined: 29 Jul 2009

Nice work, however why not just using return when they click cancel?

If they accidentaly clicked it, it puts them in a loop.


I did make it return when they click cancel via if ErrorLevel.. I'm not sure what you're talking about. All works fine for me..

raiderball1
  • Members
  • 5 posts
  • Last active: Aug 11 2009 09:23 AM
  • Joined: 05 Aug 2009
great script.. I'm glad I stumbled across this thread after just downloading it, helping me learn a lot faster. Only thing I have is that when you click on a command button it should insert the command where the cursor is located on the text editor to the right. Its annoying when you need to insert something you forget and it goes to the bottom instead of where you need it at the top of the script, so far so good though on the script! Thanks a lot