[Editor] CodeQuickTester - Write and run code without saving to a temporary file

Post your working scripts, libraries and tools for AHK v1.1 and older
geek
Posts: 1051
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re: CodeQuickTester - Write and run code without touching the file system

15 Aug 2017, 18:45

CodeQuickTester version 2.4 has been released

Please see the original post for a link to the release and revision history pages.

Upcoming features
  • Quick AHK version switcher
  • Command line parameters
  • Toggle run key between application-only and global
User avatar
derz00
Posts: 497
Joined: 02 Feb 2016, 17:54
Location: Middle of the round cube
Contact:

Re: CodeQuickTester - Write and run code without touching the file system

15 Aug 2017, 21:24

Great. I was waiting for this release! :D How would you best recommend updating my copy if I've made some custom tweaks? Or is there not a good way to do that? Maybe I'm just too lazy...
try it and see
...
geek
Posts: 1051
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re: CodeQuickTester - Write and run code without touching the file system

15 Aug 2017, 21:47

Use a diff tool (I recommend Meld, though kdiff3 is also popular) to compare differences between your version and the new version, then modify accordingly. Another option would be to write your own script that extends the CodeQuickTester class, then make your changes there. This would (in theory) make updating easier for future releases, but would require you to do a bunch of work first :lol:
User avatar
derz00
Posts: 497
Joined: 02 Feb 2016, 17:54
Location: Middle of the round cube
Contact:

Re: CodeQuickTester - Write and run code without touching the file system

16 Aug 2017, 09:06

Thanks for the recommendation, I like it. Side benefit, is to see clearly each change you made. This will help me learn AHK programming, although most of it is still high above my head... :)
try it and see
...
geek
Posts: 1051
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re: CodeQuickTester - Write and run code without touching the file system

16 Aug 2017, 09:13

If you'd like to see diffs of the changes without installing a diff tool, a diff is included with every change listed on the Revision History (GitHub commit page) linked at the bottom of the original post. (Although it doesn't show at which points releases were made)

For example, I made some adjustments to the highlighter which you can see here: https://github.com/G33kDude/CodeQuickTe ... be5669951e
User avatar
derz00
Posts: 497
Joined: 02 Feb 2016, 17:54
Location: Middle of the round cube
Contact:

Re: CodeQuickTester - Write and run code without touching the file system

16 Aug 2017, 11:12

Yes, I've looked through those commits. That has advantages in that it shows the whole history. Using the diff tool, you can see them right in the file, which you combine when you release a version.

P.S. the number of posts this thread has accumulated shows the value of this tool.
try it and see
...
User avatar
derz00
Posts: 497
Joined: 02 Feb 2016, 17:54
Location: Middle of the round cube
Contact:

Re: CodeQuickTester - Write and run code without touching the file system

17 Aug 2017, 13:36

Looking forward to upcoming features.

Not sure if it would be difficult, but could you set .ahk to be the default extension in the Save dialog?

Just a note about the "New" button to open a new instance of CQT: If the Script path has spaces, your version doesn't work.

Code: Select all

New() ; TODO: Make this work for MultiTester mode
{
	; Run, %A_AhkPath% %A_ScriptFullPath% ; throws error if path contains spaces.
	Run, "%A_AhkPath%" "%A_ScriptFullPath%"
}
Edit: Submitted my first ever GitHub pull request. Did I do it right? ;)

Edit 2: What's the difference between Publish and Save? I see the code is different, but can't figure out what it's doing exactly?
try it and see
...
geek
Posts: 1051
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re: CodeQuickTester - Write and run code without touching the file system

17 Aug 2017, 14:47

Publish runs the code through the AHK2EXE compiler, but it skips the part where it puts it into an exe file. Effectively it just strips comments, leading whitespace, empty lines, and pulls in includes. Really all it was meant to do is pull in includes, but I haven't gotten around to that yet. I'll have to pull some trickery if I want to make it work without writing to a file (I want it to go to the clipboard ultimately), since you have to run AHK.exe in "include library" listing mode (/iLib flag or something like that) on a given file to detect implicit includes.

Some notes on your code, GitHub pull requests, and git in general:
  • Check the diff before committing. This varies depending on the git client you're using. I'm not sure if GitHub web lets you see the diff before you save. You have some stray whitespace where it shouldn't be, which shows up in the diff. It's not a big deal,
    but I'd rather not have inconsistent indentation.
  • A commit is supposed to be a single logical change. You're changing two things in one commit.
  • The code for adding a file extension will need to be smart enough to see when there's already a file extension, or you will end up saving with names like Script.ahk.ahk.
  • A pull request should only include one feature/bug fix. Your pull request includes two, a feature and a bug fix. By only including one of these in a pull request, the repository administrator (in this case me) can deny one change while allowing the other. For example, your Run fix is pretty good, so I'd want to include that, but (due to reasons in the previous notes) I'd want to omit the extension change.
I've closed your request for now, but if you'd like to modify your extension code to keep user entered extensions (whether it's .ahk, .txt, .json or something else, checking for one with SplitPath should work) and only add .ahk when the user didn't enter an extension, then resubmit your changes (separately), I'll accept them.
User avatar
derz00
Posts: 497
Joined: 02 Feb 2016, 17:54
Location: Middle of the round cube
Contact:

Re: CodeQuickTester - Write and run code without touching the file system

17 Aug 2017, 15:13

You're a great teacher. I'm a thick-skulled student. So thank you for taking the time to explain this. In my spare moments I'll try again, and try to do a better job. This thread is an odd place to learn GitHub and general programming tips. :facepalm:

About my extension change, I thought: "this is so simple. Is there more to this that I don't realize?" Sure enough. Thanks for the advice. I should have thought a couple more times before submitting that pull request, for now I don't have quite the time to do it properly. But let's see what I can do... (Not that I need to, you might say. But it's fun, you might know what I mean :D)

This thread is an odd place to learn GitHub and general programming tips.
try it and see
...
geek
Posts: 1051
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re: CodeQuickTester - Write and run code without touching the file system

18 Aug 2017, 11:10

CodeQuickTester v2.5-beta1 has been released

Please see the original post for a link to the release and revision history pages.

Changes
  • Switched to RichCode.ahk library
  • Added quick AHK version switcher, command line parameters
  • Added toggle to switch run hotkeys between application-only and global
  • Added better unsaved changes detection
CAH9t
Posts: 29
Joined: 15 Jul 2017, 11:12
Location: Land

Re: CodeQuickTester - Write and run code without touching the file system

20 Aug 2017, 04:05

Thank you very much, GeekDude. I see some great additions and fixes.
User avatar
kczx3
Posts: 1640
Joined: 06 Oct 2015, 21:39

Re: CodeQuickTester - Write and run code without touching the file system

23 Aug 2017, 14:29

This is awesome!!!

///// IGNORE THIS \\\\\\\
What is the difference between Save and Publish?

You might update the Install menu item to show the word "Uninstall" if it is already installed.
geek
Posts: 1051
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re: CodeQuickTester - Write and run code without touching the file system

23 Aug 2017, 14:38

Publish runs the code through AHK2EXE, but skips the actual exe-making step. Effectively, it strips all the whitespace, comments, empty lines, etc and pulls in all the includes. I intend to make the stripping part optional, and give some input boxes for author info, versioning, etc to be added to the top of the script. This may be better suited to a stand-alone tool.

Any idea if something like this already exists? I know AHK Studio has some stuff, but it doesn't always work exactly right. I haven't really checked otherwise.

Edit: Think this should be renamed to something else (like export)? Once the config window is set up it will be kinda obvious what it does. Suggestions are welcome.
User avatar
derz00
Posts: 497
Joined: 02 Feb 2016, 17:54
Location: Middle of the round cube
Contact:

Re: CodeQuickTester - Write and run code without touching the file system

11 Sep 2017, 20:34

Hi GeekDude


How do you best pass text as a parameter to CQT? I.e. The clipboard. You can pass a file path as a parameter, a ahk: link, etc. But what about selecting text and opening it in the tester? Any tips?

Thank you :wave:
try it and see
...
geek
Posts: 1051
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re: CodeQuickTester - Write and run code without touching the file system

04 Jan 2018, 13:01

CodeQuickTester v2.5 has been released

Please see the original post for a link to the release and revision history pages.

Changes
  • Opening new instances when AHK or CQT has spaces in its path now works (Thanks derz00!)
  • Pastebin integration has been updated to use HTTPS (Thanks derz00!)
  • Working Directory now follows the most recently opened file
  • Publish now uses current Ahk2Exe routines for pulling includes
  • Colors are now defined by name rather than index
  • Minor improvements to the code highlighter
Additions
  • Dialog for configuring publish settings
  • Publish Settings to keep or remove indentation, comments, and empty lines
  • Separate menu options for installing service handler and setting default editor
  • Open from clipboard
  • Script option to change the Working Directory
User avatar
Relayer
Posts: 160
Joined: 30 Sep 2013, 13:09
Location: Delaware, USA

Re: CodeQuickTester - Write and run code without touching the file system

04 Jan 2018, 13:49

I like it. May I suggest an ini to save settings like screen position and gui size. Always having it open in a small form factor is not optimal. There are probably a bunch more things that would be convenient to save from session to session.

Relayer
User avatar
Xtra
Posts: 2744
Joined: 02 Oct 2015, 12:15

Re: CodeQuickTester - Write and run code without touching the file system

04 Jan 2018, 14:54

The .ini settings could even be saved/read inside a comment section in the script.

Code: Select all

/*
[section]
setting=1
*/

IniRead, mySetting, %A_ScriptFullPath%, section, setting, 0
geek
Posts: 1051
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re: CodeQuickTester - Write and run code without touching the file system

04 Jan 2018, 15:03

There are two main rules to the development of CodeQuickTester:

1) Everything should fit in one file
2) CodeQuickTester should be able to be run inside CodeQuickTester

For the first rule, having a separate ini file would break it. For the second rule, having IniRead try to read A_ScriptFullPath wouldn't work.

CodeQuickTester does have a settings area at the top that can be easily modified, powered by a simple array. I can add some entries to change the default position and size if there's interest.
geek
Posts: 1051
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re: CodeQuickTester - Write and run code without touching the file system

18 Mar 2018, 09:49

CodeQuickTester v2.6 has been released

Please see the original post for a link to the release and revision history pages.

Changes
  • Stopped publish from always stripping comment-only lines
  • Made "Open Help File" open to the selected keyword
Additions
  • Find and replace dialog
  • Syntax tips in the status bar for the selected keyword
  • Right-click menu for the editor

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: furqan and 80 guests