Jump to content


Photo

OK to run AHK scripts in Notepad++ (NPP or Notepad Plus)?


  • Please log in to reply
9 replies to this topic

#1 dsavant

dsavant
  • Members
  • 480 posts

Posted 05 May 2012 - 10:50 PM

Hello,

Will AHK scripts function properly if created in Notepad++ (NPP)?

I find myself using Notepad constantly but there are several features in NPP to which I would like to have access. Therefore, I am considering switching everything to NPP. However, I want to first make sure there is no conflict with AHK.

Is that a good idea or even an OK idea? Are there any conflicts?

Thanks

#2 dmg

dmg
  • Members
  • 1794 posts

Posted 05 May 2012 - 10:57 PM

Since AutoHotkey scripts are plain text files any plain text editor, including Notepad++ should be able to create them just fine. This excludes word processors and rich text editors like Microsoft Word and WordPad.

I personally prefer Notepad2 as my main editor. Just thought I would mention it. :)

#3 dsavant

dsavant
  • Members
  • 480 posts

Posted 05 May 2012 - 11:22 PM

I personally prefer Notepad2 as my main editor. Just thought I would mention it. :)

Thanks for the response.

Out of curiosity, do you mind commenting re the basis for your Notepad2 preference?

#4 Hamlet

Hamlet
  • Members
  • 207 posts

Posted 05 May 2012 - 11:30 PM

yes, no problem at all.
I changed it from notepad to notepad++.

(But, Both of them are bit slow in some big files such as 100Mbyte or larger.
Found a special editor for large files, But... pity. It deos not support Unicode.)

EDIT: there are some thereads regarding N++ around here. it is not so difficult to find it.

#5 dmg

dmg
  • Members
  • 1794 posts

Posted 06 May 2012 - 12:15 AM

Out of curiosity, do you mind commenting re the basis for your Notepad2 preference?

I started using it because it did not require installation, and then I continued using it with .ahk files because it has line numbers. Neither of these features are unique but I guess I am used to Notepad2 now.

And there is a modified version with syntax highlighting for AutoHotkey:
<!-- m -->http://portableapps.... ... d_portable<!-- m -->

I use the original version, again, because I am used to it. 8)

#6 dsavant

dsavant
  • Members
  • 480 posts

Posted 06 May 2012 - 04:21 PM

Generally to start creating a new AHK script, I open my AHK folder in Windows Explorer, right-click and select New. The resulting menu includes the option for "AutoHotKey Script" which, when clicked, launches a new instance of AHK in a generic Notepad form.

I don't know if that is the best or simplest way to start a new script but regardless, I'm wondering how to designate a non-generic app, be it Notepad2, Notepad++ or some other text editor, as the default. Also, how would I change existing scripts from their current generic formats to an upgraded app?

Oh and by the way, is there a difference between a text editor and a plain text editor?

Thanks again for the feedback.

#7 OldBloke

OldBloke
  • Members
  • 42 posts

Posted 06 May 2012 - 04:50 PM

"text editor" and "plain text editor" are the same thing. Adding the word "plain" makes extra sure people know you mean an editor which doesn't add any formatting.

I set PSPad as my editor for AHK scripts by changing this string in Regedit:

HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Edit\Command
(default)
Changed from: notepad "%1%"
To: "C:\apps\pspad\PSPad.exe" "%1"

You can insert the path to your favorite editor program there instead. Remember to keep the "%1%" at the end.

Note that this key:
HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Open\Command
(default)
Should stay set to: "C:\Program Files (x86)\AutoHotkey\AutoHotkey.exe" "%1" %*
(or wherever your AutoHotkey.exe is installed to)
so the script will be executed if you double click it.

Like you, I make a new script by going to the folder I want to store it in... right-click > New > AutoHotkey Script
I name the new file whatever I want, keeping the .ahk extension, then right-click it > Edit Script

You asked:
"Also, how would I change existing scripts from their current generic formats to an upgraded app?"

You don't have to change the script itself. It's exactly the same script no matter what editor you use. A script you made in notepad (or any other editor) can later be edited in Notepad2 or Notepad++ or Notepad

#8 rtcvb32

rtcvb32
  • Members
  • 542 posts

Posted 06 May 2012 - 06:52 PM

I'd had trouble in Notepad++, but only after trying to activate/install plugins, at which point it stopped doing all the send commands; But unmodified notepad++ works fine.

But that was my experience a while back.

#9 dmg

dmg
  • Members
  • 1794 posts

Posted 06 May 2012 - 07:57 PM

I would strongly advise against trying to edit your registry unless you are already VERY comfortable with the idea. :shock:

There are several ways to conveniently open a file type in a program other than the default (meaning double click) application. I assume if you right click a new .ahk file that there is an Open With menu? You can use that to search for and use Notepad++ and it will be in that menu from then on.

#10 engunneer

engunneer
  • Fellows
  • 9162 posts

Posted 06 May 2012 - 08:28 PM

I'll toss in another vote for PsPad. One of the option is that it will add pspad to the right click menu of all files, so when i want to edit a script, right click - Pspad. the normal run, compile, and edit options are left alone.

Also, look at scite4autohotkey it's a very well put together editor. It all comes down to being in a editor that you like. once you get used to one, the other ones feel weird. I know UltraEdit is a great editor as well.