Author Topic: autohotkey support  (Read 4286 times)

Offline urlwolf

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
autohotkey support
« on: May 04, 2009, 07:53:04 PM »
Anyone else interested in having autohotkey support?

Offline Arthur

  • Registered User
  • Hero Member
  • *
  • Posts: 653
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • My Blog
Re: autohotkey support
« Reply #1 on: May 04, 2009, 07:57:24 PM »
Would you elaborate a bit more please urlwolf?

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2206
  • Karma: +37/-3
    • HippoEDIT
Re: autohotkey support
« Reply #2 on: May 04, 2009, 11:33:37 PM »
Quote
Anyone else interested in having autohotkey support?
Yes.
And, I think, Stefan should add his word as autohotkey user ;)

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
Re: autohotkey support
« Reply #3 on: May 05, 2009, 09:26:41 PM »
Oh, yeah, AutoHotkey!   
I have set up HE to code in AHK but have done not many the last months :-(

But i will share here my work for others who maybe will finish it, or use it as start for there own setup.

Note that this was an first quick step only and the provided XMLs (see attachments) are far away from being complete!
And i always mixed up 'keywords', 'Constants' and 'functions' in the styles, and there must be still old basic keywords?

Also the Code Templates are still from basic.
Still to do is adding BLOCKS, SCOPES and LABLES or like this. Read more here > Adding new Language Syntax


------------------------------------------------------------------------

How to add an new syntax for AutoHotkey

1.)  I have an copy  of  "e:\a\HippoEDIT\data\syntax\vb_spec.xml"  (i think)
and save it as "e:\a\HippoEDIT\data\syntax\Autohotkey_spec.xml"

("E:\a\..."   is my folder for my portable tools )

--------------------------------------

2.)  Then i edit the parameters in file  "Autohotkey_spec.xml"
like
<SYNTAX id="ahk" name="AutoHotkey Script"
<Words>0-9A-Za-z#_</Words>
<FilePattern mask="*.ahk"/>
Read more here > Adding new Language Syntax

----------

I add an STYLE to use AHK's comment sign ';'
      <Style id="comment" override="true" name="Comment" text="1" bold="0" italic="1" underline="0" clr="Comments" bkclr="#FFFFFFFF">
        <Blocks>
          <Block open=";" close="\n"/>
        </Blocks>
>Read more here<

--------------------------------------

3.)  Then i use the list from  "c:\Programme\AutoHotkey\Extras\Editors\EmEditor\ahk.esy"
; EmEditor Syntax File (www.emeditor.com)
; for AutoHotKey (www.autohotkey.com)
; by Wolfgang Reszel (Tekl)


to add AutoHotkey keywords.
<Keyword text="#IfWinExist"/>
<Keyword text="#IfWinNotActive"/>
<Keyword text="#IfWinNotExist"/>

An little help to add keywords you can find >here<



------------------------------------------------------------------------


Copy the attached Autohotkey*.xml's to your  HE syntax folder

     \HippoEDIT\data\syntax\autohotkey_spec.xml
     \HippoEDIT\data\syntax\Autohotkey_user.xml


Restart HippoEDIT !



Tip: I had open now an (even empty) *.ahk file  to have quick access to the right menu items.


------------------------------------------------------------------------

4.)  add the AHK HELP FILE  to search for an word under cursor

I have this file  "e:\a\HippoEDIT\Help\AutoHotkey.chm"
(You can use "C:\Program Files\AutoHotkey\AutoHotkey.chm" if you want, but this is NOT portable)


I did this:
"Help > Syntax Help > Manage Help(AutoHotkey)"

URL Properties:
Name:         AutoHotkey Help
URL:            help\AutoHotkey.chm
Arguments: %CurrentWord%
Shortcut:     Alt+F2
[X]  open in external Browser

------------------------------------------------------------------------

5.)   Execute current Script with AutoHotkey.exe


5a) Execute Script (portable mode)

I have this file "e:\a\HippoEDIT\tools\AutoHotkey.exe"

I did this:
"Tools > Mange Tools (AutoHotkey)
Title:              Run AHK script
Command:     tools\AutoHotkey.exe
Arguments:    %Document%
Shortcut:        F5
Save before:  Current Document

------------------------------------------------------------------------

5b)  Execute Script (AHK is installed)

I had this file  "C:\Program Files\AutoHotkey\AutoHotkey.exe"

I did this:
"Tools > Mange Tools (AutoHotkey)
Title:              Run AHK script
Command:     %Document%
Arguments:   
Shortcut:        F5
Save before:  Current Document

------------------------------------------------------------------------

6.)  Add an Code Template

6a) Surround word with %'s

I did this:
"Tools > Syntax Settings(AutoHotkey) > Code templates > Add..."

key:            SurroundWord  ---or what you like
Description:  SurroundWord  ---or what you like
Shortcut:    Ctrl+Alt+K         ---or what you like
Code:
%%%CurrentWord%%%

------------------------------------------------------------------------

I hope this helps in some way?

------------------------------------------------------------------------

To use AHK for modifying text

add AHK as tool like
Command:     tools\AutoHotkey.exe
Arguments:    myScript.ahk  %Document%

Inside "myScript.ahk" you have to catch as parameter  the expanded  "%Document%" parameter from HE,
have AHK code to read and modify the input, and write output back to the same file. 
HE should prompt you with something like "File modifyed extern. Reload?"

------------------------------------------------------------------------
« Last Edit: May 05, 2009, 09:48:32 PM by Stefan »