CodeQuickTester - Write and run code without touching the file system

Post your working scripts, libraries and tools
GeekDude
Posts: 738
Joined: 02 Oct 2013, 22:13

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: 211
Joined: 02 Feb 2016, 17:54

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...
either stumped or stunned
GeekDude
Posts: 738
Joined: 02 Oct 2013, 22:13

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: 211
Joined: 02 Feb 2016, 17:54

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... :)
either stumped or stunned
GeekDude
Posts: 738
Joined: 02 Oct 2013, 22:13

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: 211
Joined: 02 Feb 2016, 17:54

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.
either stumped or stunned
User avatar
derz00
Posts: 211
Joined: 02 Feb 2016, 17:54

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] [Download] GeSHi © Codebox Plus

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?
either stumped or stunned
GeekDude
Posts: 738
Joined: 02 Oct 2013, 22:13

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: 211
Joined: 02 Feb 2016, 17:54

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.
either stumped or stunned
GeekDude
Posts: 738
Joined: 02 Oct 2013, 22:13

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: 28
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: 396
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.
GeekDude
Posts: 738
Joined: 02 Oct 2013, 22:13

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: 211
Joined: 02 Feb 2016, 17:54

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:
either stumped or stunned

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 23 guests