# Shameless Plug

## Recommended Posts

CyberSlug, I forgot to mention one other change I made in the email I sent you earlier. titlebarIndicator returns 1 if the window is active or 0 if it wasn't, but I'm sure you've already noticed that if you've seen the script I attached...

• Replies 72
• Created

#### Top Posters In This Topic

Nice work!

One issue I notice: Try holding down on shift+9 before you've typed anything.... I end up getting lots of previous lines of text selected, and parentheses inserted as odd places. ControlSend might be a little slow to keep up with the keyboard repeat rate.

Other things I'm thinking about: Nested definitions such as StringInStr(StringMid(... only show the info for the outermost function. I have ideas how to improve this and will test. I also have a few more ideas to reduce redundant code--though you've made headway in this already.

I'll post a version that works with the latest AutoIt beta sometime today.

Thanks for all the work you've done, Valik

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
##### Share on other sites

One issue I notice:  Try holding down on shift+9 before you've typed anything....  I end up getting lots of previous lines of text selected, and parentheses inserted as odd places.  ControlSend might be a little slow to keep up with the keyboard repeat rate.

That is directly related to the speed of the PC, then. I tweaked those settings to where that doesn't occur on an Athlon XP 3200+. I know your PC is much slower than that. I'll try to think of a different way now that I know what's causing it (The slower CPU isn't able to process as fast and so AutoIt gets WAY behind on the queue and screws up).

Edit: Try adding a Sleep(2) at the end of beginSense just before EndFunc and let me know if it still does it. This should cause a bunch of (((( to queue up and continue to be appended long after you release the keys, but it shouldn't put it in weird places.

Also, the default coordinates for Caret's are in screen coordinates in the latest unstable. Don't be thrown off and wonder why the script is broke if you forget to change that to client coordinates like I did.

Edited by Valik
##### Share on other sites

And I was the one who got Jon to FIX "Hotkeys were ignored while another hotkey function was running" in 3.0.92

Here's what works for me:

; At top of code

Global $SENSE = 0 ;Iniside main while-wend loop after the sleep(100) statement$SENSE = 0

;BeginSense changes

Func beginSense();responsible for calling tooltip...
If $SENSE = 1 Then Return$SENSE = 1

;....body of beginSense function....

$SENSE = 0 EndFunc Edited by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! ##### Link to post ##### Share on other sites That makes sense. I removed getKeyword because the overhead for the function lookup and stuff was adding overhead that was messing things up. Its a balance between overhead and slowing AutoIt down just enough that it doesn't run too fast. ##### Link to post ##### Share on other sites I've got the list box thing working 70% or so now. I decided not to use full-hotkey support because it would be a pain in the ass to implement. Instead I've opted for a hotkey which will cause the box to appear and set Enter and Tab to confirm the selection. Naturally, typing into the listbox will cause the current selection to move around as you type, so its still pretty good. I may also make an option that transforms it from an auto-complete list to a clip library thing. It is pretty cool, though. Its not integrated into CyberSlug's script (yet). CyberSlug, here's a good challenge... any thoughts on how to implement something that creates the same sort of list for user-defined functions which can even build lists across #include's? ##### Link to post ##### Share on other sites Good. I've been working on the other stuff--lots of tweaks and code changes; you won't recognize it when I'm done any thoughts on how to implement something that creates the same sort of list for user-defined functions which can even build lists across #include's? I'm not sure I understand the question. Do you want dynamically generated function lists. Like if I make function foo(..), then I get a list box the next time I type foo(...) ??? Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! ##### Link to post ##### Share on other sites Something to that effect, yes. Since I'm not using keylogging stuff, it would be more like pressing Alt+a to show a listbox of built-in functions and pressing Alt+b to show a listbox of user functions both declared in the current script and in any #include files. Two obstacles I see: 1) Getting the file name. Some, but not all editors put the file name in the titlebar and sometimes the path and stuff is too long and it gets truncated. This will make figuring out the relative path for #include interesting. 2) How to parse the file loaded in the editor. Selecting all the text and copying moves the caret, so it would probably have to be read from disk so it would be as current as the last save. But, see #1 again. So basically, there are 2 obstacles which prevent the entire idea from even taking off until a way around it is thought up. ##### Link to post ##### Share on other sites Here's a method I use to get the active file in TextPad: Func TP_ActiveFile() Local$t
$t = WinGetText("") ;retrieves open file and toolbar names$t = StringLeft($t, StringInStr($t, @LF));current filename
If StringInStr($t, "*") Then;file was marked as modified,$t = StringTrimRight($t, 3); so remove the astrisk Else ;otherwise,$t = StringTrimRight($t, 1); just remove trailing linefeed EndIf Return$t
EndFunc

And yeah, parsing saved files (FileReadLine) and looking for Func blocks is probably the easiest way.... For the current (unsaved) file, there is always select-all copy.

EDIT: Oops, I didn't see your caret comment. How about ControlGetText or something? OR

$p = WinGetCaretPos$bak = ClipGet()
Send("^a^c")
$text = ClipGet() ClipPUt($bak)
MouseClick ("left", $p[0],$p[1])

Hope that helps.

EDIT:

;--------------------------------------------------------------------
; Alternative TP_ActiveFile() implementation using WinGetTitle....
;--------------------------------------------------------------------
Func TP_ActiveFile()
$title = WinGetTitle("");such as "TextPad - [C:\foo\bar.txt *]"$tmp = StringTrimLeft( $title, StringInStr($title, "[") )
;removed left-hand side stuff, now remove right-hand side stuff
If StringInStr($tmp, "*") Then$tmp = StringTrimRight($tmp, 3);file was marked as modified Else$tmp = StringTrimRight($tmp, 1);just remove trailing bracket EndIf Return$tmp
EndFunc
Edited by CyberSlug
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
##### Share on other sites

Here's a method I use to get the active file in TextPad:

Func TP_ActiveFile()
Local $t$t = WinGetText("")    ;retrieves open file and toolbar names
$t = StringLeft($t, StringInStr($t, @LF));current filename If StringInStr($t, "*") Then  ;file was marked as modified,
$t = StringTrimRight($t, 3);  so remove the astrisk
Else                          ;otherwise,
$t = StringTrimRight($t, 1);  just remove trailing linefeed
EndIf
Return $t EndFunc And yeah, parsing saved files (FileReadLine) and looking for Func blocks is probably the easiest way.... For the current (unsaved) file, there is always this: $bak = ClipGet()
Send("^a^c{Esc}")
$Text = ClipGet() ClipPut($bak)

Hope that helps.

EDIT:

;--------------------------------------------------------------------
; Alternative TP_ActiveFile() implementation using WinGetTitle....
;--------------------------------------------------------------------
Func TP_ActiveFile()
$title = WinGetTitle("");such as "TextPad - [C:\foo\bar.txt *]"$tmp = StringTrimLeft( $title, StringInStr($title, "[") )
;removed left-hand side stuff, now remove right-hand side stuff
If StringInStr($tmp, "*") Then$tmp = StringTrimRight($tmp, 3);file was marked as modified Else$tmp = StringTrimRight($tmp, 1);just remove trailing bracket EndIf Return$tmp
EndFunc
That would work for TextPad and Crimson, but is that generic enough to work for all editors? Do all the popular editors display the current file in the title-bar?

As far as using ^a^c, that's evil in TextPad. It moves the caret to the end of the file which would be annoying.

May throw together something which incoporates "auto-save" so that the script can periodically save the file the user is editing then re-read that file to update itself. This way, the user wouldn't have to save every 2 seconds, but the file could be saved at a high-frequency in the background (WinMenuSelect or ^s...).

I'm starting to get betters ideas now, at least. I'll start messing around with this after I finish the list box for built-in functions and then get it integrated in what you are working on and after I work on a few things for AutoIt itself (Unrelated to this stuff).

##### Share on other sites

I edited my above post

Try WinGetCaretPos() and MouseClick() around the selectAll/Copy routine.

or ControlGetText might work better

Edited by CyberSlug
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
##### Share on other sites

I edited my above post

Try WinGetCaretPos() and MouseClick() around the selectAll/Copy routine.

or ControlGetText might work better

Seems ugly and with the offset stuff of GetCaretPos(), maybe a bit unreliable. ControlGetText probably wouldn't work with some editors. I haven't tried it yet, but it would kind of surprise me if it did work with TextPad. Some of the other contorl functions don't work with it.

Edit: ControlGetText() doesn't work with TextPad.

Edited by Valik
##### Share on other sites

Idea:

With AutoSense, typing "(" causes the previous word to be looked up in the function list. Well, if the word is not found found--and is tested to make sure it's not some arithematic expression--the word could be added to a user-function list. FileReadLine parsing would still be used on saved files.

Otherwise, we could make the user select the word and press a hotkey to manually add it to the list.

Edited by CyberSlug
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
×
• Create New...