Folding in S4AHK

The popular SciTE-based AutoHotkey Script Editor
User avatar
tjdickinson
Posts: 19
Joined: 07 May 2017, 12:43
Contact:

Folding in S4AHK

12 May 2017, 13:42

I'm wondering how to initiate/customize folding for SciTE4AutoHotkey. I have a long script with many hotkeys, and it becomes quite tedious to scroll through all of them looking for the key I want, or the section in which to add another key. For example:

Code: Select all

; 1. File
	^+s::								; hotkey for save project as (formerly targeted save all)
		Send {F10}fj					; targets the menu item
		Return
	^!s::								; reassigned hotkey for save all (formerly ctrl+shift+s)
		Send {F10}fv					; targets the menu item
		Return
	!u::								; hotkey for used by
		Send +{F10}y					; targets the context menu item
		Return
	^y::								; reassigned hotkey for repeat (formerly ctrl+r; formerly targeted redo)
		MouseGetPos, xpos, ypos			; identifies the mouse starting position
		Send {click 562, 50}			; clicks the button
		MouseMove, %xpos%, %ypos%, 0	; returns the mouse immediately to the starting position
		Return

; 2. Validate and Export
	!p::								; hotkey for validate font
		Send {F10}tv					; targets the menu item
		Return
	^!i::								; hotkey for install font
		Send {F10}tn					; targets the menu item
		Return
	^e::								; hotkey for export settings (formerly targeted paste special)
		Send {F10}fe					; targets the menu item
		Return
	^!e::								; hotkey for export all
		Send {F10}fa					; targets the context menu item
		Return
Those are just two of the 25 sections of the script, and some sections have 10‑15 hotkeys. Ideally, I would want to be able to add folding at each section (ex. "; 1. File"), and for each hotkey, so that when the folds are closed, it would look more like:

Code: Select all

; 1. File
	^+s::								; hotkey for save project as (formerly targeted save all)
	^!s::								; reassigned hotkey for save all (formerly ctrl+shift+s)
	!u::								; hotkey for used by
	^y::								; reassigned hotkey for repeat (formerly ctrl+r; formerly targeted redo)

; 2. Validate and Export
	!p::								; hotkey for validate font
	^!i::								; hotkey for install font
	^e::								; hotkey for export settings (formerly targeted paste special)
	^!e::								; hotkey for export all
Any ideas?

Thanks in advance for your help!
Thank you!
TD
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Folding in S4AHK

12 May 2017, 20:10

Try this: (note the curly braces must immediately follow the semicolons)

Code: Select all

; 1. File
	^+s::								;{ hotkey for save project as (formerly targeted save all)
		Send {F10}fj					;  targets the menu item
		Return							;}
	^!s::								;{ reassigned hotkey for save all (formerly ctrl+shift+s)
		Send {F10}fv					;  targets the menu item
		Return							;}
	!u::								;{ hotkey for used by
		Send +{F10}y					;  targets the context menu item
		Return ;}
	^y::								;{ reassigned hotkey for repeat (formerly ctrl+r; formerly targeted redo)
		MouseGetPos, xpos, ypos			;  identifies the mouse starting position
		Send {click 562, 50}			;  clicks the button
		MouseMove, %xpos%, %ypos%, 0	;  returns the mouse immediately to the starting position
		Return							;}

; 2. Validate and Export
	!p::								;{ hotkey for validate font
		Send {F10}tv					;  targets the menu item
		Return							;}
	^!i::								;{ hotkey for install font
		Send {F10}tn					;  targets the menu item
		Return							;}
	^e::								;{ hotkey for export settings (formerly targeted paste special)
		Send {F10}fe					;  targets the menu item
		Return							;}
	^!e::								;{ hotkey for export all
		Send {F10}fa					;  targets the context menu item
		Return							;}
I hope that helps.
Maybe I have some weird setting in SciTE4AHK, but I don't think so.
User avatar
tjdickinson
Posts: 19
Joined: 07 May 2017, 12:43
Contact:

Re: Folding in S4AHK

13 May 2017, 11:52

Brilliant! It works perfectly! Thank you!
Thank you!
TD
User avatar
DrReflex
Posts: 42
Joined: 25 May 2015, 02:57
Location: Greer, SC

Re: Folding in S4AHK

03 Feb 2023, 03:07

Here is an alernative. It has a few advantages:
1. Fewer keystrokes since there is no need to add the comment after Return.
2. The intellisence will now highlight the brackets. Could help debugging a dropped bracket.
3. The indenting after return is now automatic. "Return"<Enter>"}"<Enter>"...the next hotkey begins here"

Code: Select all

; 1. File
	^+s:: {								; hotkey for save project as (formerly targeted save all)
		Send {F10}fj					; targets the menu item
		Return	
	}
	^!s:: {								; reassigned hotkey for save all (formerly ctrl+shift+s)
		Send {F10}fv					; targets the menu item
		Return	
	}
	!u:: {								; hotkey for used by
		Send +{F10}y					; targets the context menu item
		Return 
	}
	^y:: {								; reassigned hotkey for repeat (formerly ctrl+r; formerly targeted redo)
		MouseGetPos, xpos, ypos			; identifies the mouse starting position
		Send {click 562, 50}			; clicks the button
		MouseMove, %xpos%, %ypos%, 0	; returns the mouse immediately to the starting position
		Return	
	}		

 ; 2. Validate and Export
	!p:: {								; hotkey for validate font
		Send {F10}tv					; targets the menu item
		Return		
	}		
	^!i:: {								; hotkey for install font
		Send {F10}tn					; targets the menu item
		Return
	}
	^e:: {								; hotkey for export settings (formerly targeted paste special)
		Send {F10}fe					; targets the menu item
		Return	
	}		
	^!e:: {								; hotkey for export all
		Send {F10}fa					; targets the context menu item
		Return	
	}
SCITE FOLD SHORTCUTS:
  • Toggle ALL folds <Ctrl><Shift><LClick> on fold column
  • Expand or contract current fold point <Ctrl><Keypad*>[/i}

Return to “SciTE4AutoHotkey”

Who is online

Users browsing this forum: No registered users and 18 guests