Jump to content

Recommended Posts

  • Replies 72
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

:iamstupid:  It appears your tooltip code is smart enough to never go off-screen.

Note to self:  Test before asking questions

I think tooltips are that way by default, then. I knew they wouldn't go offscreen when they appeared when linked to a control, but I thought it might be possible to send one offscreen by specifying specific x, y coordinates, which is what we do. Guess not.
Link to post
Share on other sites

Okay so what features do we want:

0) Bug fixes :whistle:

1) Bold or otherwise emphasize (all caps?) the current parameter [HARD]*

2) Drop down box for AutoItSetOption/ControlCommand [MEDIUM/HARD]

3) Code capitalization, e.g., winwaitnotactive( --> WinWaitNotActive( [EASY]

4) Code completition, e.g., DriveGetF <hotkey> --> DriveGetFileSystem [MEDIUM]

4) Allow multiple text editors and syntax files [MEDIUM/HARD]

*Backspace and other considerations make this hard.

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

Oh, I noticed one thing about the time a tooltip is displayed. It seems to be infinite (or until clicked). I guess that means the delays for it are only valid when it's used differently than what we are using it now (Meaning, when it's linked to a control). Since passing an empty string clears a displaying tooltip, I'm not going to bother with a delay option. It can just be done manually if necessary.

Link to post
Share on other sites

1) Bold or otherwise emphasize (all caps?) the current parameter [HARD]*

- Won't be bold, I can't do that without either making my own pseudo-tooltip control or subclassing the current one which is a lot of work for such a small feature. I say it's either all caps or nothing (Option, maybe, if you do it at all?)

2) Drop down box for AutoItSetOption/ControlCommand [MEDIUM/HARD]

- I have ideas for this involving AU3GUI. I'll take a look at this one.

3) Code capitalization, e.g., winwaitnotactive( --> WinWaitNotActive( [EASY]

- I say yes, but you may consider an option for "Proper Words", "lowercase" and "UPPERCASE".

4) Code completition, e.g., DriveGetF <hotkey> --> DriveGetFileSystem [MEDIUM]

- Hold on this, I have ideas for this that could be tied in with #2

4) Allow multiple text editors and syntax files [MEDIUM/HARD]

- 1..2..3..4...4... whaaa?

Link to post
Share on other sites

I never was good at counting :whistle:

The last suggestion actually incorporates two ideas:

1) Allow one-instance of AutoSense to interact with Notepad, TextPad, and whatever other editor you may also have open. [EASY]

2) Allow multiple syntax databases. If you have an AU3 file open, then AutoIt syntax tooltips will appear. If you have a JS file open, then javascript syntax tooltips will appear. [MEDIUM]

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

4) Code completition, e.g., DriveGetF <hotkey> --> DriveGetFileSystem [MEDIUM]

I have a working listbox loaded with all the functions in the database file. I haven't tied everything together yet, but it looks like it'll be very possible to create a listbox where you can select which function you want to auto-complete and then press a key (Probably tab, like Visual Studio).

This will definitely require the full hotkey stuff. I'll try to get this working tomorrow, if not integrated into CyberSlug's script so we can effectively have twice as many bugs.

CyberSlug, I may have to modify your script pretty heavily to get this in there and working right. edit: If I don't have to completely rewrite it... :whistle:

Edit: It'll also be possible to use the listbox to display only the function names, but use a tooltip to display the extended information (parameters and such) which could be useful for making the auto-completion a clip library style thing, too (If that happens, it would be as an option). The reason the tooltip would be necessary is for the redundant ControlCommand entries which would only show up as just "ControlCommand" in the list box multiple times.

Edited by Valik
Link to post
Share on other sites

Full hotkey support might not be necessary if you highlight the line and copy the text to the clipboard.....

I'm thinking of doing that with the backspace key. NOTE: NOT TESTED CODE:

HotKeySet("{backspace}", "bs")

;...

Func bs()

Send("^+{Home}")

Send("^c")

$x = ClipGet()

Send("^{End}")

HotKeySet("{backspace}")

Send("{backspace}")

HotKeySet("{backspace}", "bs")

EndFunc

Or something like that. G'night

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

CyberSlug, here's an attempt to fix the shift thing. Since tooltips stay until a ) or ESC keypress, try the following changes and let me know what you think. I see no problem in the limited testing I've done so far.

In beginSense(), replace (Both places...)

Send("(")

with

Send("{SHIFTDOWN}9") ;send a left paren

In endSense(), replace

Send(")")

with

Send("{SHIFTUP})") ;send a right paren

and in hideToolTip, replace

Send("{ESC}")

with

Send("{Esc}{SHIFTUP}") ;send

Give these a try and let me know how they go for you.

Link to post
Share on other sites

Also, I think hotkey trapping should be completely disabled when the window doesn't have focus. This should help prevent oddities from occuring in other programs. I didn't get to work on the list-box thing any today, I'm still debating whether I want to use full key trapping or not. I would like to keep it with as little derivation from the official AutoIt as possible, but I'm also wanting functionality...

Link to post
Share on other sites

I'll give the shift key stuff a try; I'm testing the heck out of Send and HotKeySet :whistle:

As far as disabling hotkey trapping, (I think) the current code passes on the keystrokes if the text editor window is focused.

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

Scratch what I said about disabling hotkey trapping. I misread your message. Something like this should work:

while 1

titlebarIndicator(1) ;put "*AutoSense*" in text editor's titlebar
sleep(100)

If Not WinActive($TEXT_EDITOR) Then
   ToolTip("",0,0) ;kill tooltip if switch windows
   HotKeySet( "(" )
   HotKeySet( ")" )
   HotKeySet( "{ESC}" )
Else
   HotKeySet("(", "beginSense")
   HotKeySet(")", "endSense")
   HotKeySet("{ESC}", "hideToolTip")
EndIf

WEnd

Also, there might be a problem with your Shift suggestion:

On a blank line, hold down on Shift+9 for a few seconds. AutoSense maxes out my processor and becomes unresponsive to other keyypresses. Maybe there is a "bug" in AutoIt's hotkey buffering?

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

It must be. I added in some checking code to prevent sending tons of {SHIFTDOWN}'s and it still cause AutoIt to crash.

Edit: Seems it somehow corrupts the stack. It causes the stack to be completely cleared and this it goes into an infinite loop trying to fix itself, which has now become impossible to do.

Edited by Valik
Link to post
Share on other sites

Here's a new thought (Haven't tried it yet). At any one point in time, you can either be expecting a '(' or a ')'. Getting a ')' without first getting a '(' is pointless, so there is no need for the hotkey on ')' to be set unless '(' has been pressed (Same with 'ESC', since it cancels a pending tooltip). The same holds true with '('. When '(' is pressed and a tooltip is displaying, there is no point monitoring '(' at all anymore since it won't do anything until either ')' or 'ESC' has been pressed.

So program flow would be:

Startup -> Register '(' -> '(' pressed -> Unregister '(' -> register ')' and 'ESC' -> Send 'SHIFTDOWN' -> ')' or 'ESC' pressed -> Send 'SHIFTUP' -> Register '('

With this method, you're only monitoring for one thing at a time. This _should_ eliminate the bug you found.

Link to post
Share on other sites

It must be.  I added in some checking code to prevent sending tons of {SHIFTDOWN}'s and it still cause AutoIt to crash.

Edit: Seems it somehow corrupts the stack.  It causes the stack to be completely cleared and this it goes into an infinite loop trying to fix itself, which has now become impossible to do.

Valik, could you post a bug report (perhaps in this thread). I'd probably mangle the post trying to explain the problem :whistle:

I *think* the problem I've had with parentheses boils down to the Send function clearing the status of the Shift-flag-state:

User holds down left-shift and and presses the 9-key

AutoSense registers the '(' keypress and traps it accordingly

User presses the 9-key again while still holding down left-shift

The keypress registers as a '9' which is ignored by AutoSense

Idea: Inform user to lift up on the Shift key between typing parentheses!

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

Here's a script to test how effectively HotKeySet registers hotkeys.

; Use with your custom AutoIt build

$x = HotKeySet("(","foo")
$y = HotKeySet("9","bar")

If $x = 0 or $y = 0 Then 
   MsgBox(0,"Quitting","Build does not support these hotkeys")
   Exit
EndIf
sleep(0)

Func foo()
   HotKeySet("(")
   Send("p")
   HotKeySet("(","foo") 
EndFunc

Func bar()
   HotKeySet("9")
   Send("n")
   HotKeySet("9","bar") 
EndFunc

My Results:

Holding down left-shift and the 9-key:

pnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn9nnnnnnnnnnnnnnnnnnnnnnnnn

Holding down right-shift and the 9-key:

PNNNNNNN(NNNNNNNNNNNNNN(NNNNNNNNNNNN(NNNNNNNNNNNNN(NNNNNNNNNNN

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

I'll post tomorrow with more info. I'm thinking of marking the bug as "won't fix" if no decent workaround is found.

Before I forget: AutoIt has a constant that defines the maximum number of hotkeys to be 64. You may need to increase this if you trap all hotkeys.

26 lowercase letters

26 uppercase letters

10 digits

6 misc (Esc, backspace, doublequote, singlequote, open paren, close paren)

any others you need to trap? spacebar and up/down/left/right arrow keys?

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

So program flow would be:

Startup -> Register '(' -> '(' pressed -> Unregister '(' -> register ')' and 'ESC' -> Send 'SHIFTDOWN' -> ')' or 'ESC' pressed -> Send 'SHIFTUP' -> Register '('

This helps--and I'll use it :whistle:--but there is still a problem when you type (( at the very beginning or )) at the very end. The result is (9 or )0, respectively.

The problem is that the Send("(") operation inside the HotKey functions causes the shift-state to be cleared. So even though the user is physically still holding down the shift key, the next key press that Windows get is sans shift.

A solution might be found here...

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

Question... why does AutoIt not have a GetKeyState function? It looks like it wouldn't be anything more than a wrapper for the Windows API function of the same name...

Edit: I post that here in relevance to this simply because with that function, its possible to poll the shift state before calling Send to figure out what state Send should be in, then Shift could be polled (Via Adlib, maybe?) to watch for Shift being up, then the script could send {SHIFTUP}. This _might_ stop the stack problem form occuring.

Edited by Valik
Link to post
Share on other sites

This helps--and I'll use it :whistle:--but there is still a problem when you type (( at the very beginning or )) at the very end.  The result is (9 or )0, respectively.

The problem is that the Send("(") operation inside the HotKey functions causes the shift-state to be cleared.  So even though the user is physically still holding down the shift key, the next key press that Windows get is sans shift.

A solution might be found here...

So program flow would be:

Startup -> Register '(' -> '(' pressed -> Unregister '(' -> register ')' and 'ESC' -> Send 'SHIFTDOWN' -> ')' or 'ESC' pressed -> Send 'SHIFTUP' -> Register '('

This should only cause it to happen when you try to type )) which is less likely than ( and anything else with the shift key.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...