Jump to content

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

Install AHK syntax highlighting and clips for PSPad v2


  • Please log in to reply
84 replies to this topic
toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
Script to install
+ AHK syntax highlighting
+ code clips and auto-completion
for PSPad editor

This is Version 2.0
and will hopefully come with the AHK installer someday

Screenshot of version v2 of the main and options Window
Posted Image Posted Image

Download AHK Sourcecode and templates Version 2

Changes since version 1:
- updated definition files to AHK 1.0.46.00
- removed AOT state of all msgbox windows, but set them as owndialog
- PSPad.INI isn't required to find PSPad path, since PSPad might not have run before.
- removed the option to remove the FuturUse parameter from the clips, since Chris removed them from the syntax files
- by default the compiler password is a 7-digit random number instead of a static "123#321". It is not stored to the ini file. To have a constant password, you'll have to set it each time you install the highlightning again.
- script starts with a very simple gui (defaults will be used, if options are not changed).
- a second gui with options can be opened. This option gui has tabs to structure the data
- up to 4 additinal external programs can be specified with hotkeys
- additional PSPad hotkeys can be individually activated
- added OutputDebug shortcut to def file: Alt+O


;# Useful shortcuts inside PSPad:
;#
;# (installed by this script for AHK:)
;# Crtl+< = add "%" around selected variable (see "PSPad hotkeys" in DEF file)
;# Crtl+Shift+< = add """ around selected variable (see "PSPad hotkeys" in DEF file)
;# Crtl+Shift+h = create hotstring from selected word (see "PSPad hotkeys" in DEF file)
;# Crtl+Shift+d = create hotkey from selected word (see "PSPad hotkeys" in DEF file)
;# Crtl+Shift+x = create subroutine from selected word (see "PSPad hotkeys" in DEF file)
;# Crtl+Shift+f = create function from selected word (see "PSPad hotkeys" in DEF file)
;# F9 = run script
;# Ctrl+F9 = compile script
;# Alt+F9 = start AHK ToolBar
;# Alt+F = search and replace in all files
;# Alt+G = search selected word with goggle
;# Alt+Y = swap with line above
;# Alt+X = swap with line below
;# Alt+V = copy line (create duplicate)
;# Ctrl+B = Split window vertically
;#
;# (common inside PSPad:)
;# Ctrl+Shift = insert clip
;# Ctrl+j = auto-complete word
;# Tab = indent selected lines
;# Shift+Tab = un-indent selected lines
;# Ctrl+Shift+a = comment/un-comment selected lines
;# Alt+(Left/Right/Up/Down) = work with bookmarks (set/remove/previous/next)
;# Ctrl+Shift+B = show a list of all bookmarks
;# Ctrl+Shift+(Up/Down) = select word and find previous/next word
;# Ctrl+Alt+(Left/Right) = left/right justify selected lines
;# Alt+LButton-Selection = column selection (it helps to activate "Scroll past EOL"/"Cursor nach Zeilenende erlauben")
;# RButton-Click on AHK command => choose "Help for Language"/"Sprachspezifische Hilfe" or ...
;# Alt+F1 = jump to command in AHK help file
;# F12 = save as...
;# Ctrl+Shift+S = save all open files
;# Ctrl+M = jump to corresponding bracket
;# Ctrl+Shift+M = select text between corresponding bracket


;# This script contains
;# - GUI with all its functionalities
;# - retrieving and saving of data from/to its own Ini file
;# - makes sure PSPad isn't running
;# - checks all needed files exist
;# - asks which highlighter to replace, if too many exist
;# A second script (in data subfolder) is included and contains all subroutines to
;# - read AHK syntax files
;# - checks if commands, functions and directives are in DEF template
;# - create the DEF and INI file for PSPad
;# - backup current DEF and INI files
;# - install DEF and INI files
;# - backup current PSPad.INI and KeyMap.INI
;# - change settings in PSPad.INI
;# - change shortcuts in KeyMap.INI
;# - installs AHK toolbar with a shortcut for PSPad
;#
;# The syntax highlight colours in PSPad are quite easy to change
;# - Settings => Highlighter settings => AutoHotkey (at the bottom of the list)
;# In the same window on the other tabs the settings for the external programs
;# and the compiler can be edited.
;#
;# OS: Windows XP
;# AHK version: 1.0.44.10 (<!-- m -->http://www.autohotkey.com/download/<!-- m -->)
;# PSPad version: 4.5.2 b2234 (<!-- m -->http://www.pspad.com/en/download.php<!-- m -->)
;# Language: English
;# Date: 2006-09-02


This script started in this old post

Zoomb
  • Guests
  • Last active:
  • Joined: --
Good job toralf!
I really like your script, it's great addon to PSPad.

Is there a way in PSPad to hide lines? (ie: 7-17 hidden)

hps
  • Members
  • 14 posts
  • Last active: Nov 07 2007 06:34 PM
  • Joined: 19 Aug 2005
Hi Toralf,

another really nice script.

It urged me to change from Notepad++ to PSPad.

The only thing I do not like in PSPad, is the completly different behavior of the"Find" function. But I wil get used to.

Keep on hotkeying

Hans Peter

Oli00
  • Members
  • 25 posts
  • Last active: Apr 26 2007 01:57 PM
  • Joined: 22 May 2006
Hi toralf,

do you have a clue why this error occurs everytime I want to install your add-on...

(%Ltrim
Error: This Line doesn't contain a recognized action

Regards

Oli

Chris
  • Administrators
  • 10727 posts
  • Last active: Sep 14 2014 06:10 PM
  • Joined: 02 Mar 2004
Your version of AutoHotkey is probably too old. You can upgrade at <!-- m -->http://www.autohotkey.com/download/<!-- m -->

Oli00
  • Members
  • 25 posts
  • Last active: Apr 26 2007 01:57 PM
  • Joined: 22 May 2006
Thanks, that was exactly my problem!

Regards

Oli

Terrapin
  • Members
  • 107 posts
  • Last active: Feb 06 2007 03:38 PM
  • Joined: 15 Aug 2005
Toralf, I appreciate your work on this a great deal. I use PSPad lately, and now I just have to learn the new features you implemented. :)

I have a question: I accidentally hit ctrl-<?> (don't know what key) trying to ctrl-f, in PSPad. It turned off syntax highlighting. I can open a file and turn it on with the toolbar icon, but cannot figure out how to make it on by default. Would you know?

Also, I admire your coding style a lot. Mine is very unkempt. I wish I could train myself better. :oops: :(

I was checking out how you made the status bar help. I am always interested in making programs user-friendly. I tried to figure out wm_mouseHover, however, your method works much easier. But I have a suggestion.

The statusbar text flickers on my computer, due to being written repeatedly whether it is new information or not. I tried this, just inside the notification function:

static LastHoveredControl
.
.
.
If (A_GuiControl = LastHoveredControl)
   return
Else
   LastHoveredControl := A_GuiControl
.
.
      ..... the rest of your function for wm_mousemove

I apologize, I do not have it in front of me to refer to. But it was line 350 or so, I believe.

Also, I cannot see that the timer routine for checking if the mouse is in the gui or not, does anything? I understand that this is probably not your final release.

Thank You,

Bob

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
Dear Terrapin,

Thanks for your post.

I have a question: I accidentally hit ctrl-<?> (don't know what key) trying to ctrl-f, in PSPad. It turned off syntax highlighting. I can open a file and turn it on with the toolbar icon, but cannot figure out how to make it on by default. Would you know?

Sorry, I don't

The statusbar text flickers on my computer, due to being written repeatedly whether it is new information or not.

Thanks for the suggestion. I will implement it, even though it may take some time before released.

Also, I cannot see that the timer routine for checking if the mouse is in the gui or not, does anything?

It does set back the statusbar back to nothing. That's it.

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
Version 0.9 is updated to the syntax of AHK version 1.0.44.09

and

The statusbar text flickers on my computer, due to being written repeatedly whether it is new information or not.

should be fixed now.

AiKscroll
  • Members
  • 179 posts
  • Last active: Feb 25 2007 03:10 AM
  • Joined: 06 Jun 2005
Nice script toralf. I'm switching from textpad to pspad simply because of the work you've done.

Also, consider changing the default Run script hotkey to F5 since its a MS standard, at least in the visual studios.

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005

consider changing the default Run script hotkey to F5 since its a MS standard, at least in the visual studios.

That is up to you, that's why there is a hotkey control in the gui so you can set it up yourself easily.

I set it to F9 by default, since that is the default in PSPad.

AiKscroll
  • Members
  • 179 posts
  • Last active: Feb 25 2007 03:10 AM
  • Joined: 06 Jun 2005
@Terrapin

View > Syntax

Rajat
  • Members
  • 1904 posts
  • Last active: Aug 18 2014 02:25 AM
  • Joined: 28 Mar 2004
Chris,
Please consider including this in ahk installation instead of the current PSPad installation file.

toralf,
why is the Tidy installation disabled?

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005

why is the Tidy installation disabled?

Because that feature never made it. :|
There was an idea to stip the code. But because it is no real use it was skiped. The button is just there. Maybe other functions could be included, e.g. the subroutine browser by evl or other features, e.g. AHK AutoSyntaxTidy. It is all open.

Chris
  • Administrators
  • 10727 posts
  • Last active: Sep 14 2014 06:10 PM
  • Joined: 02 Mar 2004

Please consider including this in ahk installation instead of the current PSPad installation file.

I'll include it when Toralf says it's ready. Maybe that will be the 1.0 release.

By the way, it would be great to have one or two recommended editors for AutoHotkey. PSPad is an obvious choice, and perhaps the other can be PhiLho's work with SciTE. What would be ideal is to have some kind of direct download link on the site that contains a simple installer that sets everything up for AutoHotkey (similar to the installer at the top of this topic but also includes PSPad, if licensing permits it). Alternatively (or in addition), a special version of the AHK installer could be made available that includes PSPad and/or a SciTE editor.

Any help in these areas would be appreciated.