Jump to content

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

IntelliSense III


  • Please log in to reply
77 replies to this topic
Jimmy2Times
  • Members
  • 65 posts
  • Last active: Jul 15 2014 07:56 PM
  • Joined: 07 Apr 2004

I've added a feature that i think completes the script. After you see the syntax help, if you need details on that cmd then press Ctrl+F1 to show ahk help on that cmd. Sort of like context-sensitive help but this works even when you're writing any of the parameters of the cmd and doesn't require your cursor to be in the cmd word.

by the way i use this code in my 24/7 script in a timer that's always running:

;launches/closes IntelliSense
WinGetActiveTitle, ATitle
IfInString, ATitle, TextPad - [
        IfWinNotExist, IntelliSense.ahk - AutoHotkey
                Run, E:\batch\IntelliSense.ahk

IfWinNotExist, TextPad - [
        IfWinExist, IntelliSense.ahk - AutoHotkey
                WinClose, IntelliSense.ahk - AutoHotkey

so now i don't need to remember to run the script every time i get to coding. requires 'SetTitleMatchMode, 2'.

I hope Chris didn't start to work on 'embellishing' the script for posting in the showcase... otherwise i have just made his work difficult.


Hmm... my 24/7 script can't detect IfWinNotExist, IntelliSense.ahk - AutoHotkey unless the main script window of IntelliSense.ahk is open...is there a directive I need to use so it sees minimized to tray script window title?

Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
forgot to mention that this also is reqd:
DetectHiddenWindows, On

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


-deXter-
  • Members
  • 45 posts
  • Last active: Dec 23 2013 11:26 PM
  • Joined: 28 Nov 2004
Pretty cool Rajat!

Btw, could you also add current-parameter highlighting (bolding)?

I mean, so that it looks like this: (as in VB)

Posted Image

It would be really helpful while typing out complex commands.

Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
firstly tooltips in ahk currently don't support that, and secondly, this script can't be modified to do that too, so it'd require nearly completely different script.

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


keyboardfreak
  • Members
  • 217 posts
  • Last active: Sep 27 2010 07:21 PM
  • Joined: 09 Oct 2004
I gave this script a try and it's excellent. My only gripe with it is that when I press Ctrl+F1 to look up the command's documentation the keyboard focus is on the keyword list in the help window (win2k). I'd like to put the keyboard focus on to the text pane (on the right), so that I can scroll the documentation text immediately with the keyboard.

It could either be done by sending a mouse click to the window, but it can be tricky to find out where the click should be made or it could be done with a keypress. I tried searching for a key for putting the focus onto the text pane from the keyword list, but couldn't find any. Does anyone know such a shortcut?

Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
Try adding this as the last line of Ctrl+F1 section (before return)
ControlFocus, Internet Explorer_Server1

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


keyboardfreak
  • Members
  • 217 posts
  • Last active: Sep 27 2010 07:21 PM
  • Joined: 09 Oct 2004

Try adding this as the last line of Ctrl+F1 section (before return)

ControlFocus, Internet Explorer_Server1

Thanks, I've just found the relevant shortcut key: F6

Pallie
  • Members
  • 56 posts
  • Last active: Feb 23 2005 11:53 PM
  • Joined: 05 Jul 2004
Instead of building the array of commands using
Cmd%a_index% = %CurrCmd%
which gives an array like this
Cmd106[5 of 63]: Sleep
Cmd107[9 of 63]: RegDelete
Cmd108[7 of 63]: RegRead
Cmd109[8 of 63]: RegWrite
Cmd11[11 of 63]: FileRecycle
Cmd110[8 of 63]: SoundGet
you could do it the other way round to build an index
Cmd%CurrCmd% = %a_index%
That way you will end up with the array looking like this
CmdDriveSpaceFree[1 of 63]: 5
CmdEnvSet[2 of 63]: 62
CmdEnvUpdate[1 of 63]: 3
CmdExit[2 of 63]: 99
CmdExitApp[3 of 63]: 100
CmdFileAppend[1 of 63]: 6
CmdFileCopy[1 of 63]: 7
CmdFileCreateDir[1 of 63]: 8
CmdFileCreateShortcut[1 of 63]: 9
That way, instad of having to loop round the array each time to see if the work entered is a command, you just need to check the value of
Cmd%Word%
if it is blank then it is not a command, otherwise it gives you the index to the Full Command

As long as commands don't use any characters which are invalid in variable names (which I don't think they do).

Mike

Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
yeah that'd be nice too!

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


Qbi
  • Members
  • 12 posts
  • Last active: Feb 03 2006 11:00 AM
  • Joined: 17 Feb 2005
Hello Rajat,

I like IS very much and placed it to my ahk.ini file.

What I was missing was a way to get help on commands that were not previously typed in but are somewhere else in the script.

So I made a little extension to IS which works as follows:

If there is some text selected in the editor window, then IS searches the help file for the selected text. If there is no text selected, IS behaves like the "original" one and searches for the last typed and recognized command.

So it is possible not only to search for commands but also to automatically search the help file for other keywords (e.g. built in variables such as A_IsCompiled).

Here's the piece of script code I wrote:

--< I only included a few of the surrounding lines so you know where the piece of code has to be inserted>--

...

IfWinNotExist, AutoHotkey Help
{
	IfNotExist, %ahk_help_file%
	{
		MsgBox, Could not find the help file: %ahk_help_file%.
		return
	}
	Run, %ahk_help_file%
	WinWait, AutoHotkey Help
}


;
; Added by Qbi:
; -------------
; If there is some text selected in the editor, search for this text in the
; help file instead of the last typed command.
;

; Save content of clipboard and empty clipboard.
backupClipboard = %clipboard%
clipboard =

; Copy selected text to the clipboard.
Send ^c
ClipWait, 1

; Calculate length of selected text (0 if no text was selected).
StringLen, clipLength, clipboard

; If there's a text in the clipboard that is no longer than 30 chars
; use it to search the help file. Otherwise search for the last typed command.
If ( clipLength > 0 AND clipLength <= 30 )
	I_ThisCmd := clipboard

; restore clipboard content
clipboard = %backupClipboard%

;
; End of Qbi's addendum
; ---------------------
;


if I_ThisCmd =  ; Instead, use what was most recently typed.
	I_ThisCmd := I_Word

...

--< I only included a few of the surrounding lines so you know where the piece of code has to be inserted>--


Please give it a try and tell me if you like it :wink:

cuQ

Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
that's a nice piece of code and suggestion! let's make the procedure optional in the script's config section and add it to the main script. optional because:

1. some ppl (including me) use TextPad and my TextPad install script already makes ^2 a hotkey to get help on the word the curson is in. maybe some others use something similar for other editors.

2. ppl might have non-text data on clipboard and may want it not to get lost if they ask for help on a certain cmd.

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


SanskritFritz
  • Members
  • 280 posts
  • Last active: Jan 09 2013 02:15 PM
  • Joined: 17 Feb 2005

let's make the procedure optional

Agree, turned off by default! No script should mess with the clipboard.
Is there another word for synonym?

jonny
  • Members
  • 2951 posts
  • Last active: Feb 24 2008 04:22 AM
  • Joined: 13 Nov 2004
Even though s3 and gclip completely solve the problem... :D

Qbi
  • Members
  • 12 posts
  • Last active: Feb 03 2006 11:00 AM
  • Joined: 17 Feb 2005
Errrr, sorry, but what are s3 and gclip???

jonny
  • Members
  • 2951 posts
  • Last active: Feb 24 2008 04:22 AM
  • Joined: 13 Nov 2004
s3 is a command line utility that offers a lot more control over the clipboard. The relevant feature here is the ability to put any file on the clipboard (using its path)

[link]

Gclip is a unix port that puts stdin on the clipboard. This mean you can pipe the output of any command to it. (e.g.: "Run, more test.txt | gclip" puts the contents of test.txt on the clipboard)

It's in the Unix ports package linked to below, as well as it's cousin, pclip, which prints the clipboard to stdout.

[link]