QuickAHK v2.2
If you do a lot of quick-and-dirty script development or testing, you probably use a tool that allows you to run the script on the fly. These tools include a number of text editors (I use PSPad), one of the tools posted on the AutoHotkey forum (see the References section for a few), or you've written your own. QuickAHK is another one of these tools... with a few differences.
QuickAHK
Key features:
[*:2kjnltkv]Sandbox. Scripts are edited and run in an isolated workspace. OK, not entirely. See the Issues/Considerations section for more information.
[*:2kjnltkv]Restore & Revert. Restore to a specific point-in-time or revert to the last saved workspace.
[*:2kjnltkv]Run. Run the current script or just the commands in the selected text.
[*:2kjnltkv]Stop. Terminate a lost or unruly script at any time.
[*:2kjnltkv]HiEdit. The HiEdit control is used to display/edit the workspace and to display the restore points in the pop-up Restore Point viewer. In addition to syntax highlighting, the control has additional features like a line numbers bar and extended undo/redo.
[*:2kjnltkv]AutoHotkey Path. If desired, the path to the AutoHotkey program can be specified. This is useful if AutoHotkey is not installed (portable developers) or if you want to test using alternate versions of AutoHotkey.Screenshots
The Code
The pertinent files are as follows:Project: QuickAHK.zip (Includes EXE, library files, and source (files, folders, and icons))
Documentation/Help: The program has a Help option that displays help for most of the features.
Issues/Considerations
[*:2kjnltkv]Sandbox. The program only provides a limited sandbox environment. If the script is well behaved and only creates or updates files/folders in the local directory, the sandbox will protect the script from contaminating any other files/folders. Just remember to clear the sandbox (the Run workspace) regularly. See the Options window ("Run" tab) for more information.
[*:2kjnltkv]Toolbar. Although a lot of work has been done to make sure that the toolbar works correctly, a few glitches remain. Most the problems occur when trying to add one or more buttons to a toolbar when there is not enough space for a new button. If you experience one of these glitches, stop and restart the script. The toolbar should display correctly when the script is restarted. These toolbar bugs will be fixed in future releases.
[*:2kjnltkv]Toolbar Icons. Most of the custom icons used for the toolbar were created with 32-bit color (True color (24 bits) + Alpha channel (8 bits)). These icons may not display correctly (or at all) on older operating systems.
[*:2kjnltkv]Shell menu. The "Integrate QuickAHK into shell context menu" option adds an "Open with QuickAHK..." context menu item to the .AHK extension in the registry. Since there is not an uninstall module, be sure to unselect this option before uninstalling (deleting) this program. To fix any incorrectly defined registry keys (Ex: compiled script moved after setting the option), simply unselect the option, save the changes, and then reselect the option.
[*:2kjnltkv]External functions. This script uses external functions which have been included in a "_Function" folders. Some of the functions are mine and should be clearly marked and documented. Functions written by others should be clearly marked but may contain custom modifications. Thanks to the original authors for sharing their work.
[*:2kjnltkv]Unicode. The HiEdit control does not currently support Unicode and it appears that there is no plans to include support for Unicode in the future.References
The following posts contain scripts with similar capabilities:
ACConsole
http://www.autohotke...opic.php?t=7831
AHKPad
http://www.autohotke...opic.php?t=8436
http://www.autohotke...opic.php?t=8532
https://ahknet.autoh...ovis/index.html
A scripting pad
http://www.autohotke...opic.php?t=7087
TheAHKPad
http://www.autohotke...pic.php?t=25985
---------------------------------------------------------------------------
Release Notes
v0.1 (Preview)
Original release.
v0.2 (Preview)
Changes:
- HiEdit control is now used instead of the standard Edit control for the main form and for the Restore Point viewer. (developed by skwire)
- Word wrap option disabled because of the HiEdit control. May be added back in the future.
- Option to "Wait for script to complete" disabled because the option to turn it off was never implemented. This feature s/b added in a future release.
- Minor updates to Help.
v0.3 (Preview)
Changes:
- Fix: Escape key bug fixed.
- Option to "Wait for script to complete" enabled. Can now run script without waiting for the script to complete.
- Font and font size can now be selected for the Restore Point viewer.
- Line numbers bar for the main editor and the Restore Point viewer are now optional. Toggle with Ctrl+L.
- Font size hotkeys are now available for the Restore Point viewer.
- "Word wrap" option removed because it's not supported by the HiEdit control. On the developer's "To Do" list. (thanks skwire)
- Minor updates to Help.
v0.4 (Preview)
UI changes:
- Added "Stop" feature (menu and hotkey). Running scripts can now be closed on demand. (thanks skwire)
- The Editor and Report Viewer font can now be selected from all available fonts (thanks majkinetor for the CmnDlg library)
- Added "Auto Indent" option for the editor.
- Added option to specify AutoHotkey path.
- Added option to create restore point on Copy from../Drop file.
- Maximum number of restore points increased to 999.
- F10 hotkey (Run script) changed to F9 to emulate several other programs (SmartGUI, PSPad, etc.)
- (Temporarily?) removed Tab and Shift+Tab hotkeys to allow the HiEdit control to handle these requests.
- Minor updates to Help.
Programming changes:
- Restore point file management rewritten to improve reliability and to support future purge options.
- HiEdit control population and file management modified to improve response and reliability.
Installation notes:
- Delete all of the old QuickAHK files and folders before installing the new version.
v0.5 (Preview)
Changes:
- Added "Find", "Find Next", "Goto Line", and "Prepend New" commands (menu and hotkeys).
- Added "Tab Width" and "Real tabs?" options.
- Added hotkeys for Tab and Shift+Tab. These hotkeys emulate the built-in Tab hotkeys for the HiEdit control but with more options and additional intelligence.
- Added confirm dialog when closing QuickAHK and one or more scripts are still running.
- Updated highlighting file for the HiEdit control (thanks skwire)
- Hotkey to "Edit using external editor" changed from F3 to F8 because F3 is used by the "Find Next" command. Sorry. This one couldn't be helped.
- Minor updates to Help.
v0.6 (Preview)
Changes:
- Fix: Date format on the Restore Point Viewer changed to YYYY-MM-DD so that restore points will display in the correct order.
- Fix: A restore point is no longer created if the workspace is blank.
- Updated HiEdit DLL and function library to v3.0.0.4-1. (Thanks majkinetor)
- Script now accepts a file name as a command-line parameter (1st parameter only). If defined, the specified file is copied to the QuickAHK workspace on startup.
- Added option for "Open with QuickAHK..." shell context menu. This option is only available if running the compiled script. Note: The context menu item is added to the ".ahk" extension if it exists.
v1.0
No changes except the version. Same functionality as v0.6.
v2.0.0 Beta
Preface
This is a major release. Don't try to upgrade over an older version. If desired, make a backup copy of the current Restore folder and after the new version has been installed and configured (don't forget to update the "Maximum Restore Points" setting), you can copy the backup copy of the Restore folder over the new version.
Fixes, Changes, and Updates
- Fix: Workspace is no longer saved if there are no changes.
- Hotkey for "Stop running script" changed from Ctrl+Alt+F9 to F10.
- HiEdit DLL and function library updated to v4.0.0.4-4. (Thanks majkinetor). The rare problem that occurred when shifting very large amounts of text (>2MB) no longer occurs with the latest version of the HiEdit DLL.
Enhancements
- The feature to automatically create a restore point on Run, Save, Exit, etc. ("Options" window, "Restore" tab) has been redesigned so that a new restore point is only created if it will be different than the most recent restore point. This enhancement allows the developer to choose one or more of the "Create restore point on..." options without worrying that the Restore folder will overloaded with duplicates. This enhancement does not affect a manual request to create a restore point (menu option or Ctrl+Shift+R) which will always create a new restore point file.
- The syntax highlighting file (KeyWords.hes) has been redefined to use a more subdued color scheme and has been updated to include more key words. The original KeyWords.hes file provided by skwire is also available.
- A font style (Ex: Bold, Italic, etc.) can now be selected for the main editor and the Restore Point Viewer.
- The Find command has been modified to use selected text as the default search text (if anything is selected). Works similar to PSPad.
- The context menu for the HiEdit control replaced with custom menu.
New commands/options/features
- Added optional toolbar. (Originally suggested by skwire. Thanks majkinetor for the Toolbar library) Most commands and some options can be executed/toggled via the toolbar.
- Added "Run Selected" command and hotkey (Ctrl+F9) to run the text that is currently selected. Important: All Run and Restore Point options are still considered when executing this command. However, if the "Create restore point on Run" option is enabled, a restore point is created of the entire workspace, not just the selected text.
- Added "Delete" hotkey to the "Select Restore Point" screen to allow individual restore point files to be deleted on request (requires confirmation). Note: To delete all Restore Point files, use the "Clear now" button in the "Options" screen ("Restore" tab).
- Added case conversion commands and hotkeys. Commands include Uppercase, Lowercase, Capitalize, and Toggle case.
- Added Find Previous (Shift+F3) command.
- Added Replace (Ctrl+H) command.
- Added Revert (Ctrl+Shift+Z) command.
- Added Print (Ctrl+P) command.
- Added Page Setup (Ctrl+Shift+P) command.
- Added Explore Run Workspace (Cltrl+Shift+F9) command.
- Added Clear Run Workspace (Ctrl+Alt+F9) command.
- Added Block Comment (Ctrl+Q) and Block Uncomment (Ctrl+Shift+Q) commands.
- Added Block Comment option to allow for custom block comment characters.
- Added "Confirm request to Exit if script(s) are running" option. Default: enabled.
- Added "Allow Undo after Save" option. Default: enabled.
- Added "Show menu bar" option. Default: enabled.
- Added "Show status bar" option. Default: enabled.
- Added "Escape to Exit" option that if enabled (default) will close QuickAHK when the Escape key is pressed. Note: This option only affects the main QuickAHK window. Internal windows ("Options", "Select Restore Point", and standard dialogs) will still close when the Escape key is used.
- Added "RunPrompt" option. Also known as "Prompt for parameters" option. Default: not enabled. If enabled, user is prompted to enter parameter values which are passed to the script when the script is run.
- Added "RunDebug" option. Also known as "Append debug script" option. Default: not enabled. If enabled, a developer-created debug script is appended to the working script before it is run.
- Added "debug script" field in the Options window to allow the developer to enter a custom script that will be appended to working script when the script is run.
- New Help file.
v2.1
- Fix: Minor syntax corrections to support AutoHotkey_L (ANSI) (thanks majkinetor)
- Redesign: The Options, Select Restore Point, and Script Parameters windows have been redesigned to support larger system font sizes. No functional changes.
- Added a "Copy Recent" menu list that contains files that were recently "Copied from...", "Saved To...", dragged & dropped, or was opened via the "Open with QuickAHK..." context menu.
Installation notes: Development files: A few new source files. Run time: No file or folder changes (that I can think of). Be sure to make a backup copy all QuickAHK files (especially the Restore folder) before installing the new version.
v2.2
- Fix: Main window now displays correctly if window was previously closed while minimized or maximized.
- Update: Minor changes to improve performance.
- Update: Minor changes to the Restore Point Viewer (thanks jabobian). Changes: 1) Window position/size saved (optional), 2) Window remains open after restore (optional)
- New: Added options support changes to the Restore Point Viewer. See the Options window ("Restore" tab) to set/change the new options. Note: Some Restore options may revert to the default settings when the new version is first run. Reset if needed.
Installation notes: Be sure to make a backup copy all QuickAHK files (especially the Restore folder) before installing the new version. If desired, copy the backup copies of the restore point files to the new Restore folder after the new version has been installed and configured.
1) Allow a customisable "run" hotkey. I've added this into the your code.
2) For some reason, the Options dialog does not diplay properly for me. All I see are the three options under the Window tab. However, the actual tab control doesn't display for me at all.
3) Have you given thought to using the HiEdit control? It's a snap to implement thanks to Maj's wrapper and would provide syntax highlighting. If you're not interested, I may retro-fit it if you don't mind.
In addition to the Run menu option, you can run the script by using the Ctrl+R or F10 hotkeys. Of course if you want to add your own, please do.Allow a customisable "run" hotkey. I've added this into the your code.
That is the opposite of excellent. I double-checked the code on the server and it works fine for me. Give this a try: Change the Tab2 control to a old-style Tab control and see if that fixes it. Let me know.For some reason, the Options dialog does not diplay properly for me. All I see are the three options under the Window tab. However, the actual tab control doesn't display for me at all.
I've waddled on adding more than the very basic edit capabilities to this program but the more I thought about it, the more I was convinced that extending the editing capabilities was not the way to go. There are two reasons for this line of thinking:Have you given thought to using the HiEdit control? It's a snap to implement thanks to Maj's wrapper and would provide syntax highlighting. If you're not interested, I may retro-fit it if you don't mind.
[*:1d90w6t3]The program was never designed to be a script editor. Instead, it was designed to write and run the everyday quick-and-dirty small scripts that many develop to test a theory or check how a command works. Personally, I it use to make sure a section of code works correctly (MsgBox commands for example) and to run scripts that I download from the forum.
[*:1d90w6t3]There is no way in heck that I (or anyone for that matter) could write an editor using AutoHotkey (even with the HiEdit control) that could compete with the dozens and dozens of free editors out there. I'm a PSPad'er myself. That's why I created the "External Editor" option. Once you set it up, just hit the F3 key and your favorite editor will open the workspace script so you can do serious editing. When you're done, just save the script and restart the QuickAHK program. The workspace will contain all of the changes.Thank your for feedback. If you have any questions, counterarguments, find any additional bugs, have additional feature requests, etc., please make a noise!
Why not? Speak for yourself... :lol: :wink:[*]There is no way in heck that I (or anyone for that matter) could write an editor using AutoHotkey (even with the HiEdit control) that could compete with the dozens and dozens of free editors out there.
That is the opposite of excellent. I double-checked the code on the server and it works fine for me. Give this a try: Change the Tab2 control to a old-style Tab control and see if that fixes it. Let me know.
Actually, now that I've had a minute to look at it, it's an Anchor() bug that I've come across in my own applications I've coded. The way that I fix it is thus (from your code):
;***************************** ;* * ;* * ;* Options GUI * ;* * ;* * ;***************************** OptionsGUI: [color=red]$AllowPopupResize := 0[/color] [big snip here] ;-- Calculate X/Y and Show it PopupXY($QAHKGUI,$OptionsGUI,$PosX,$PosY) gui Show,x%$PosX% y%$PosY% [color=red]$AllowPopupResize := 1[/color] ;-- Return to sender return ;********************** ;* * ;* Resize * ;* (OptionsGUI) * ;* * ;********************** OptionsGUI_Size: ;-- Minimize? if A_EventInfo=1 return [color=red]If ( $AllowPopupResize = 1 ) {[/color] Anchor("$OptionsGUI_Tab" ,"wh") Anchor("$OptionsGUI_WindowGB" ,"wh") Anchor("$OptionsGUI_EditorGB" ,"w") Anchor("$OptionsGUI_ExtEditorGB" ,"w") Anchor("$OptionsGUI_ExtEditorName" ,"w") Anchor("$OptionsGUI_ExtEditorPath" ,"w") Anchor("$OptionsGUI_BrowseEditorPath","x",true) Anchor("$OptionsGUI_NewScriptGB" ,"wh") Anchor("$OptionsGUI_NewScript" ,"wh") Anchor("$OptionsGUI_RunFolderGB" ,"wh") Anchor("$OptionsGUI_RestoreGB" ,"wh") Anchor("$OptionsGUI_SaveButton" ,"y",true) Anchor("$OptionsGUI_CancelButton" ,"y",true) [color=red]}[/color] return
As for the HiEdit control suggestion, I'm a PSPad user myself so I would like to see it more for the syntax highlighting than, say, any advanced editing capabilities.
but paired with maj's intellisence then you have an uber combo there
WIN or LEARN.
You're right of course. I rarely speak for others and I apologize for doing so here. :oops:Why not? Speak for yourself... :lol: :wink:[*]There is no way in heck that I (or anyone for that matter) could write an editor using AutoHotkey (even with the HiEdit control) that could compete with the dozens and dozens of free editors out there.
I will add this fix to the code. Thanks.Actually, now that I've had a minute to look at it, it's an Anchor() bug that I've come across in my own applications I've coded. The way that I fix it is...
Question: Are you using the custom version of Anchor v4.1 that I've included in release or are you using a newer/different version? P.S. I just sent you a PM on this topic.
As for the HiEdit control suggestion, I'm a PSPad user myself so I would like to see it more for the syntax highlighting than, say, any advanced editing capabilities.
Please forgive the multiple personality disorder that I'm temporarily experiencing, but I'm still arguing with myself on this one.i agree the sytax highlighting is more for a readability than editing but paired with maj's intellisence then you have an uber combo there
On the one hand, using the syntax highlighting feature of HiEdit control to improve readability is an excellent argument for it's use. On the other hand, is this overkill for this mini-app, especially with an external editor just a keystroke (F3) away?
I can't promise anything but I will look into the HiEdit control further. Thanks for your feedback. I appreciate it!
Credit
This version of QuickAHK uses the HiEdit control to take advantage of the Syntax Highlighting feature. All of the code development to include this object was provided by skwire. Thanks for your significant effort!
Credit also goes to majkinetor for providing the HiEdit library of functions. This object would be much harder to use without this great library. Thanks!
Can't wait to see what further developements are made to this.
Quality control for this version provided by skwire. Thanks.
Providing your using standard libraries this is actually a nearly full featured editor
Perhaps a config file to edit commands and such would be nice for the enxt release great work
edit never mind found it
WIN or LEARN.