Jump to content



Photo

NotePad++ with AutoIt User CallTips ...


  • Please log in to reply
21 replies to this topic

#1 jaberwocky6669

jaberwocky6669

    Dull light.

  • Active Members
  • PipPipPipPipPipPip
  • 2,076 posts

Posted 21 October 2009 - 09:08 AM

As much as I enjoy using Scite, I do like the functionality provided by Notepad++. Unfortunately, np++ does not provide calltips for AutoIt. So I hacked together a script to turn AU3.api into autoit.xml.

Requires: AutoItObject.au3

 
You can download the exe too: Notepad++ with AutoIt User Calltips http://www.mediafire.com/?jaavgngq7io6xmd (MediaFire -- 510 downloads).

 
To use this:
1. download Notepad++ (check)
2. download AutoItV3 with Scite (check)
3. download this script to any directory (to-do)
4. run the script (to-do)
5. enjoy np++! (ggggggggggggggggggggggggggggoooooooooooooooaaaaaaaaaaaaaaaaaaaaallllllllllllllllllllllllllllllllllL!!!!!!)

 
AutoIt         
#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Au3Check_Stop_OnWarning=y #AutoIt3Wrapper_Au3Check_Parameters=-w 1 -w 2 -w 3 -w 4 -w 6 -d #AutoIt3Wrapper_Run_Tidy=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include "AutoItObject.au3" #include <Array.au3> #include <File.au3> #include <Misc.au3> #include <IE.au3> _Singleton(@ScriptName) _IEErrorHandlerRegister() _AutoItObject_Startup() Global $calltip = CallTip() HotKeySet("{ESC}", "_exit") OnAutoItExitRegister("term") $calltip.AU3APItoArray() If @error Then Exit $calltip.DeleteNonFunctions() $calltip.ReplaceXMLKeyWords() $calltip.GetFunctionNames() $calltip.GetFunctionParams() $calltip.GetFunctionDescr() $calltip.OutputXMLDocument() If @error Then Exit Func _exit() Exit EndFunc ;==>_exit Func term() $calltip = '' EndFunc ;==>term #Region UserCallTips Generator Func CallTip() Local $this = _AutoItObject_Create() Local Const $FileInPath = @ProgramFilesDir & "\AutoIt3\SciTE\api\au3.api" Local Const $FileOutPath = @ProgramFilesDir & "\Notepad++\plugins\APIs\autoit.xml" _AutoItObject_AddDestructor($this, "CallTip_Dtor") _AutoItObject_AddProperty($this, "FileInPath", $ELSCOPE_PRIVATE, $FileInPath) _AutoItObject_AddProperty($this, "FileOutPath", $ELSCOPE_PRIVATE, $FileOutPath) _AutoItObject_AddProperty($this, "AU3", $ELSCOPE_PRIVATE, '') _AutoItObject_AddProperty($this, "Descrs", $ELSCOPE_PRIVATE, '') _AutoItObject_AddProperty($this, "Names", $ELSCOPE_PRIVATE, '') _AutoItObject_AddProperty($this, "Params", $ELSCOPE_PRIVATE, '') _AutoItObject_AddMethod($this, "AU3APItoArray", "CallTip_AU3APItoArray") _AutoItObject_AddMethod($this, "DeleteNonFunctions", "CallTip_DeleteNonFunctions") _AutoItObject_AddMethod($this, "GetFunctionDescr", "CallTip_GetFunctionDescr") _AutoItObject_AddMethod($this, "GetFunctionNames", "CallTip_GetFunctionNames") _AutoItObject_AddMethod($this, "GetFunctionParams", "CallTip_GetFunctionParams") _AutoItObject_AddMethod($this, "OutputXMLDocument", "CallTip_OutputXMLDocument") _AutoItObject_AddMethod($this, "ReplaceXMLKeyWords", "CallTip_ReplaceXMLKeyWords") _AutoItObject_AddMethod($this, "FileWriteTab", "CallTip_FileWriteTab", True) _AutoItObject_AddMethod($this, "Write", "CallTip_Write", True) Return $this EndFunc ;==>CallTip Func CallTip_Dtor($this) _AutoItObject_Shutdown() _IEErrorHandlerDeRegister() EndFunc ;==>CallTip_Dtor ; ======================================================================================================================================== Func CallTip_AU3APItoArray($this) Switch FileExists($this.FileInPath) ; check for existence of 'au3.api' Case 1 $this.Write("'au3.api' exists and is within it's proper directory.") Case 0 Local Const $msgBoxTemp = MsgBox(4, "Alert:", "'au3.api' does not seem to be within it's default directory." & @LF & "Would you like to specify the current 'au3.api' directory?") Switch $msgBoxTemp Case 6 ; yes Local Const $result = FileOpenDialog("Browse to 'au3.api'", @DesktopDir, "API (*.api;)", 1 + 2) Switch $result Case '' Return SetError(2, 0, 1) Case Else $this.FileInPath = $result EndSwitch Case 7 ; no Return SetError(1, 0, 1) EndSwitch EndSwitch Local $au3 _FileReadToArray($this.FileInPath, $au3) $this.AU3 = $au3 EndFunc ;==>CallTip_AU3APItoArray ; ======================================================================================================================================== Func CallTip_DeleteNonFunctions($this) Local $au3 = $this.AU3 Local Const $upBound = UBound($au3) - 1 For $i = $upBound To 0 Step -1 If Not StringInStr($au3[$i], "(") Then ; yeah, it's a hack, deal with it _ArrayDelete($au3, $i) EndIf Next $this.AU3 = $au3 EndFunc ;==>CallTip_DeleteNonFunctions ; ======================================================================================================================================== Func CallTip_ReplaceXMLKeyWords($this) ; Replace reserved XML keywords with character entity references Local Const $find[6] = ["&", """", "<", ">", ", [,", "'"] Local Const $replace[6] = ['&', '"', '<', '>', ' [,', '''] Local Const $chars = UBound($find) - 1 Local $au3 = $this.AU3 Local Const $upBound = UBound($au3) - 1 For $i = 0 To $upBound For $j = 0 To $chars $au3[$i] = StringReplace($au3[$i], $find[$j], $replace[$j]) Next Next $this.AU3 = $au3 EndFunc ;==>CallTip_ReplaceXMLKeyWords ; ======================================================================================================================================== Func CallTip_GetFunctionNames($this) Local Const $au3 = $this.AU3 Local Const $upBound = UBound($au3) - 1 Local $names[$upBound + 1] For $i = 0 To $upBound ; extract the name of the function ; EX: "Abs ( expression ) Calculates the absolute value of a number." $names[$i] = StringTrimRight($au3[$i], StringLen($au3[$i]) - ((StringInStr($au3[$i], ' ') - 1))) ; ==> "Abs" Next $this.Names = $names EndFunc ;==>CallTip_GetFunctionNames ; ======================================================================================================================================== Func CallTip_GetFunctionDescr($this) Local Const $au3 = $this.AU3 Local Const $upBound = UBound($au3) - 1 Local $descr[$upBound + 1] For $i = 0 To $upBound ; extract the function description ; EX: "Abs ( expression ) Calculates the absolute value of a number." $descr[$i] = StringTrimLeft($au3[$i], (StringInStr($au3[$i], ')') + 1)) ; ==> "Calculates the absolute value of a number." Next $this.Descrs = $descr EndFunc ;==>CallTip_GetFunctionDescr ; ======================================================================================================================================== Func CallTip_GetFunctionParams($this) Local Const $au3 = $this.AU3 Local Const $upBound = UBound($au3) - 1 Local $params[$upBound + 1] Local $tmp For $i = 0 To $upBound ; extract the function parameters ; EX: "Abs ( expression ) Calculates the absolute value of a number." $tmp = StringTrimRight($au3[$i], StringLen($au3[$i]) - StringInStr($au3[$i], ')') + 1) $params[$i] = StringTrimLeft($tmp, StringInStr($tmp, '(') + 1) ; ==> "expression" Next $this.Params = $params EndFunc ;==>CallTip_GetFunctionParams ; ======================================================================================================================================== Func CallTip_OutputXMLDocument($this) Switch FileOpen($this.FileOutPath, 2) Case -1 $this.Write("There was an error opening:" & @CRLF & $this.FileOutPath) Return SetError(-1, 0, 1) Case Else $this.Write($this.FileOutPath & ": was opened successfully." & @CRLF) Local Const $name = $this.Names Local Const $param = $this.Params Local Const $descr = $this.Descrs Local Const $upper = UBound($name) - 1 Local $tmp ; header $this.FileWriteTab(0, "<?xml version='1.0' encoding='UTF-8' ?>") $this.FileWriteTab(0, "<NotepadPlus>") $this.FileWriteTab(1, "<AutoComplete language='AutoIt'>") $this.FileWriteTab(2, "<Environment ignoreCase='yes' startFunc='(' stopFunc=')' paramSeparator=',' terminal='' />") ; body For $i = 0 To $upper If $name[$i] = '' Then ContinueLoop Else $this.FileWriteTab(2, "<KeyWord name='" & $name[$i] & "' func='yes' >") $tmp = StringSplit($param[$i], ',') ; load the function parameters individually into an array Select Case $tmp[0] >= 1 ; more than one parameter $this.FileWriteTab(3, "<Overload retVal='' descr='" & $descr[$i] & "' >") For $j = 1 To $tmp[0] $this.FileWriteTab(4, "<Param name='" & StringStripWS(StringReplace($tmp[$j], ",", ""), 1 + 2) & "' />") Next $this.FileWriteTab(3, "</Overload>") Case Else ; only one parameter $this.FileWriteTab(3, "<Overload retVal='' descr='" & $descr[$i] & "' />") EndSelect $this.FileWriteTab(2, "</KeyWord>") EndIf Next ; footer $this.FileWriteTab(1, "</AutoComplete>") $this.FileWriteTab(0, "</NotepadPlus>") FileClose(1) EndSwitch EndFunc ;==>CallTip_OutputXMLDocument ; ======================================================================================================================================== Func CallTip_FileWriteTab($this, Const $tabs, Const $data) ; 'FileWrite' with tabs Local $tabString = '' Local Const $upBound = $tabs - 1 If $tabs > 1 Then For $i = 0 To $upBound $tabString &= @TAB Next ElseIf $tabs = 1 Then $tabString = @TAB EndIf FileWrite(1, $tabString & $data & @CRLF) EndFunc ;==>CallTip_FileWriteTab ; ======================================================================================================================================== Func CallTip_Write($this, Const $Message) MsgBox(0, "Calltips XML Generator", $Message, 10) EndFunc ;==>CallTip_Write #EndRegion UserCallTips Generator

Edited by jaberwocky6669, 30 January 2011 - 04:12 AM.






#2 toxicdav3

toxicdav3

    Seeker

  • Active Members
  • 23 posts

Posted 30 October 2009 - 12:41 AM

Thanks so much, just what I needed :)

#3 Kaster

Kaster

    Seeker

  • Active Members
  • 5 posts

Posted 06 November 2009 - 07:14 PM

Wow, man. It's awesome. I've just wanted do the same, and just as you couldn't imagine why native np++ haven't got it itself.
Thanks.

Edited by Kaster, 06 November 2009 - 07:28 PM.

Signature

#4 Dolemite50

Dolemite50

    Prodigy

  • Active Members
  • PipPipPip
  • 157 posts

Posted 29 November 2009 - 12:22 PM

Nicely done!

I use an "Open WIth NP++" command all the time so it's handy to have a few extra gizmos like this. Did you get Au3 cTags working?

btw, you don't happen to know how to choose which toolbar commands are available do you? I can change the icons, not the commands.

Thanks mang, this worked great!

#5 James

James

    jbrooksuk

  • MVPs
  • 9,468 posts

Posted 29 January 2010 - 11:44 AM

Shame the colours aren't the same as SciTE.

Edit: Also, there is over 20 AutoItSetOption auto complete functions. This is still buggy but a good start!

Edited by JamesBrooks, 29 January 2010 - 11:50 AM.


#6 blitzkrg

blitzkrg

    Polymath

  • Active Members
  • PipPipPipPip
  • 232 posts

Posted 29 January 2010 - 07:50 PM

Thanks for this!!

#7 jaberwocky6669

jaberwocky6669

    Dull light.

  • Active Members
  • PipPipPipPipPipPip
  • 2,076 posts

Posted 29 January 2010 - 11:25 PM

Shame the colours aren't the same as SciTE.

Edit: Also, there is over 20 AutoItSetOption auto complete functions. This is still buggy but a good start!


The autoitsetoption autocomplete works the same in NP++ as it does in Scite at least it does for me on my end. Maybe my Scite install is corrupt?

#8 James

James

    jbrooksuk

  • MVPs
  • 9,468 posts

Posted 30 January 2010 - 04:44 PM

The autoitsetoption autocomplete works the same in NP++ as it does in Scite at least it does for me on my end. Maybe my Scite install is corrupt?

No it doesn't.

Your script writes the XML data for every single AutoItSetOption functions.

#9 jaberwocky6669

jaberwocky6669

    Dull light.

  • Active Members
  • PipPipPipPipPipPip
  • 2,076 posts

Posted 30 January 2010 - 07:04 PM

No it doesn't.

Your script writes the XML data for every single AutoItSetOption functions.


ookk, I never noticed the up and down arrows in the SciTE tooltip!

#10 Fantastic

Fantastic

    Seeker

  • Active Members
  • 46 posts

Posted 30 April 2010 - 10:02 PM

I get an error from the posted code.
(169,49) : ERROR: syntax error (illegal character)     Local $replace[8] = ["&", """, " < ", " > ", " '     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

Change this :
Local $replace[8] = ["&", """, " < ", " > ", " '", " [,", "&#A;", "&#D;"] ; and replace them with these

to this ( ["&", ' " ', " < ", " > ", " '", " [,", "&#A;", "&#D;"]) :
Local $replace[8] = ["&", '"', " < ", " > ", " '", " [,", "&#A;", "&#D;"] ; and replace them with these

Do the calltips work ? I can't get it working.

#11 jaberwocky6669

jaberwocky6669

    Dull light.

  • Active Members
  • PipPipPipPipPipPip
  • 2,076 posts

Posted 30 April 2010 - 11:12 PM

Do the calltips work ? I can't get it working.


Just download the exe, sorry...

#12 AZJIO

AZJIO

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 996 posts

Posted 30 June 2010 - 12:53 AM

Notepad (in_root_AutoIt3).7z - autoit.xml, batch.xml, themes, shortcuts.xml, etc.

$this.FileInPath = FileOpenDialog("Browse to 'autoit.api'", @DesktopDir, "EXE (*.exe;)", 1 + 2)
change
$this.FileInPath = FileOpenDialog("Browse to 'autoit.api'", @WorkingDir & "", "autoit.api, au3.api (*.api)", 1 + 2) If @error Then Exit

Just download the exe, sorry...

exe and au3 = error
$replace[$j] = error, if _FileReadToArray('C:\AutoIt3\SciTE\api\au3.api', $au3) ; test
;Local Const $replace[UBound($find)] = ["&amp;", "&quot;", "&lt;", "&gt;", " [,", "&apos;"] ; and replace them with these

Edited by AZJIO, 28 October 2010 - 07:24 PM.


#13 jaberwocky6669

jaberwocky6669

    Dull light.

  • Active Members
  • PipPipPipPipPipPip
  • 2,076 posts

Posted 30 June 2010 - 03:07 AM

WHY DO I OVERLOOK THE DUMBEST, SMALLEST BUGS?!?!?!?!?!?!?!

Edited by jaberwocky6669, 30 June 2010 - 03:23 AM.


#14 Raik

Raik

    Adventurer

  • Active Members
  • PipPip
  • 117 posts

Posted 28 October 2010 - 12:52 PM

archive-Notepad++.7z (56кб) - autoit.xml, batch.xml, themes, shortcuts.xml

link dead.
who can upload this again?
AutoIt-Syntaxsheme for Proton & Phase5Firefox Addons by me (resizable Textarea 0.1d) (docked JS-Console 0.1.1)

#15 jaberwocky6669

jaberwocky6669

    Dull light.

  • Active Members
  • PipPipPipPipPipPip
  • 2,076 posts

Posted 28 October 2010 - 04:41 PM

Alternatively you could just copy my source into an au3 file and then run it. You would need to grab AutoItObject also.

Edited by jaberwocky6669, 28 October 2010 - 04:43 PM.


#16 AZJIO

AZJIO

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 996 posts

Posted 28 October 2010 - 07:22 PM

Raik

Notepad (in_root_AutoIt3).7z - autoit.xml, batch.xml, themes, shortcuts.xml, etc (Update, 82kb)  

Edited by AZJIO, 28 October 2010 - 07:35 PM.


#17 jaberwocky6669

jaberwocky6669

    Dull light.

  • Active Members
  • PipPipPipPipPipPip
  • 2,076 posts

Posted 29 October 2010 - 03:40 AM

Not that it really matters but how does your zip relate to my script? Did you use my script to generate the autoit.xml? The autoit.xml that is included in your zip is different than the autoit.xml that my script generates.

#18 burnell

burnell

    Wayfarer

  • Active Members
  • Pip
  • 50 posts

Posted 27 January 2011 - 01:18 PM

Raik

Notepad (in_root_AutoIt3).7z - autoit.xml, batch.xml, themes, shortcuts.xml, etc (Update, 82kb)  

in notepad++ missing also and won`t highligt for example:
@osarch and some #AutoIt3Wrapper keys, are the changes in these files?

package is down. can someone upload this again, please?

So I would be glad about it! Thank you.

Edited by burnell, 27 January 2011 - 01:20 PM.


#19 AZJIO

AZJIO

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 996 posts

Posted 28 January 2011 - 02:16 AM

burnell

Notepad++(in_root_AutoIt3).7z


#20 burnell

burnell

    Wayfarer

  • Active Members
  • Pip
  • 50 posts

Posted 28 January 2011 - 11:59 AM

thank you, really good work man. :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users