Jump to content
Sign in to follow this  
CyberSlug

*autosense*

Recommended Posts

How do you want AutoSense to interface with your Text Editor.

JdeB sent me an installer script that causes AutoSense to automatically launch with your text editor when you right-click, and choose Edit on an AU3 file.

Personally, I use a user-defined toolbar button to toggle AutoSense--but I need to turn it on and off to test it.....

Suggestions?


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 this post


Link to post
Share on other sites

Hi CyberSlug, cool Script. :whistle:

One remark concerning localized OS versions:

When using Notepad, I have to adapt the value in the global variables section

($TEXT_EDITOR = "Notepad").

Note that in foreign Windows versions also the name of Notepad might have been changed (e.g. in the german version it's called "Editor").

That gets important a few lines below because there' a further check for the editor which uses the english term:

If $TEXT_EDITOR = "Notepad" Then ....

To get your script running, both values above have to be adapted. Maybe it would be a good idea to point that out somewhere in the code.

Share this post


Link to post
Share on other sites

To add to that comment, not only Notepad has it's title at the end of the window, I use metapad, which does the same thing, so I had to tweak it where it's setting the title match mode else it never works.

Share this post


Link to post
Share on other sites

Thanks for the info on localization on abut Metapad.

- Has anyone had problems with the "Shift" state? Sometimes the default settings can cause a problem where your typing suddenly is in all caps.... Normally not a major problem--but I had a defined a Shift+Ctrl+C shortcut elsewhere that executed Send("^c"). This shift-state bug caused the send statement to be interpreted as shift+ctrl+c so the shortcut ended up calling itself (not good)!

However, the "fix" to the shift-state bug would require you to lift up on the Shift key every time you type a lot of parentheses in a row....


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 this post


Link to post
Share on other sites

version 0.2.2 Posted

-Should fix some bugs.

-Also changes the default auto-complete shortcut key from Pause to Ctrl+j. See the top of the script for details.

-I also included a version modified by JdeB. I haven't time to integrate his changes, but you can take a look.

EDIT: Re-uploaded. Fixed stupid bug that JdeB pointed out and fixed a metapad-compatibility bug.

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 this post


Link to post
Share on other sites

I am using a home grown text editor and it works till I try to enter the word selected from the combox.

The error is:

Line 276

$t[0]= $c[0] + $w[0] + $e[0] + $X_ADJUST

$t[0] = $c[0] + $w[0] + $e^ ERROR

Error: Subscript used with non-Array variable

Let me know if you need more info.

-RyanRJP Computinghttp://rjpcomputing.com/

Share this post


Link to post
Share on other sites

RJP Computing, please substitute this code for the getCoords() function:

Func getCoords()
   Local $c = WinGetCaretPos()
   Local $w = WinGetPos("")
   
   $dbg = ""
   ClipPut("") ;clear clipboard

   Local $f = ControlGetFocus("","")
   $dbg = "err=" & @error & " focus=" & $f & @CRLF
   ClipPut($dbg)

   Local $e = ControlGetPos("", "", $f)
   $dbg = $dbg & "getPos err=" & @error
   ClipPut( $dbg)

   Local $t[2]                               ;tooltip's coords
   $t[0] = $c[0] + $w[0] + $e[0] + $X_ADJUST
   $t[1] = $c[1] + $w[1] + $e[1] + $Y_ADJUST
   Return $t
EndFunc

After it presumably crashes, please paste your clipboard contents.

It must be that one of the ControlGet__ functions is failing (and I assumed they would always work).

Please also post AutoIt version number and Operating System.


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 this post


Link to post
Share on other sites

Okay, I downloaded RJP Lite :whistle: And I think I see the problem.

(Though I had to disable Norton Personal Firewall else the download manager warning came up.)

Will post fix soon.

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 this post


Link to post
Share on other sites

RJP Computing, I'm afraid I cannot fix the bug. You will need to change RJPad Lite:

The problem is that RJPad Lite does not give focus to its text region/caret if the window loses focus and is re-activated. My autocomplete textbox get focus when it appears. After pressing Enter, your text region is expected to have focus. I've tested 14 other text editors and this is how they all behave. I cannot even get AutoIt's ControlFocus(...) function to work with RJPad Lite :whistle:, so you will need to make some change on your end.

Hope that helps

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 this post


Link to post
Share on other sites

I noticed that if I set it up for notepad... It works fine if I start writing on the first line... If I press enter to the middle of the page then start coding I get nothing...

Lar.

:evil: I cannot replicate the problem you describe.

Make sure that both the left-paren and ctrl+j hotkeys fail; also press Esc a few times.

Using default script settings? What OS and CPU speed? Tried other text editors? I'm at a loss B):angry::whistle:


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 this post


Link to post
Share on other sites

Larry, if you haven't already, try changing this:

$REPOSITION = "{Right}" ;default RightArrowKey

to this:

$REPOSITION = "^{RIGHT}"

Notepad is a stupid editor and requires the control modifier to jump back to the end of the highlighted text.

Edit: I see CyberSlug has already hard-code that in for Notepad, so never mind...

Edited by Valik

Share this post


Link to post
Share on other sites

Larry--don't use Notepad and try a slower computer :evil:

Or try these global variable settings:

$BLOCK_BEGIN = 1

$SHIFT_FIX = 2

Reasons not to use notepad:

AutoSense relies on being able to copy the previous word to the clipboard in order to look it up. In nearly any other text editor, if you type one(two(threeand then press Ctrl+ShiftLeft, 'three' would be highlighted. Notepad highlights the whole thing. To reposition the cursor in most text editors you hit the Right arrow key. In Notepad, you must hit Ctrl+Left (which I hardcoded somewhere).

There could be a problem with the keybuffer/stack/whatever becoming corrupted through the use of Send statments and BlockInput. I have problems with the Shift state sometimes sticking which might possibly be fixed by the above variable settings. However, it appears there is a problem with the Ctrl key. If the Ctrl state gets corrupted, you would very likely get F(ileOpen instead of FileOpen.

I wish I could be more help--but it's hard to dianose a problem I'm not experiencing. Code modifications/submissions are welcome, but I'll warn you that a lot of the AutoSense functions are crammed with non-modular code in order to improve efficiency for preventing potential bugs caused by typing too fast....

:whistle::angry:B)


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 this post


Link to post
Share on other sites

Immediate Results: Working good in TextPad, 4.7.2 B)

Detailed history:

1. Downloaded AutoSense, looked inside Zip and read the readme.txt file.

2. I generally keep all my executables in their own folder under "Program Files\Application\SubFolder\". And I usually keep my data files under a different folder: \Data\Application\SubFolder\.

So I moved the two "txt" files and the one "exe" file into Drive:\Program Files\AutoIt\AutoSense\ folder.

And I moved the "au3" file into Drive:\Data\AutoIt\AutoSense\ folder.

3. I modified AutoSense.au3 values of $SPEC_FILE and $AU3GUI.

Opened AutoSense.au3 in TextPad 4.7.2.

Used TextPAd Tool to run AutoSense, saw change in Title Bar.

Made new document, saved as TestSense.au3 to get proper syntax.

Started to enter some commands, AutoSense appears to be working OK. (Noticed that InitialCaps overwrites my functions when I did in lower case ..... not a problem for me, just an observation).

Ran Tool again, Title bar changed, and AutoSense stopped working.

Ran Tool again, Title bar includes AutoSense again, and AutoSense working again.

4. As a new AutoIt user, I am really impressed and happy to have such a great tool to learn with. Obviously I will have to do a lot to thoroughly test this out, but not a problem. :whistle:

5. One suggestion about installation needed in the readme.txt and/or at beginning of AutoSense.au3, maybe line 16? I would like to suggest that you explicitly state the assumption that the two other files are defaulted to be in the same folder as the au3 file. It took me a few minutes to understand where these files, including the au3 file, were supposed to be installed to. I know that the ".\name" used for the variables I changed represent the current directory/folder, but I was not sure what the current folder should be. Is there an expected/suggested default? In any case, I appreciate that you provided the flexibility for me to do my own housekeeping ... Thanks for that. :angry:

6. I tried CTL-J for AutoComplete but that did not work. I guess there is a Hot Key I need to define in TextPad? Did not see instructions or specs for that, will have to look closer.

Stay tuned for more feedback over the next few weeks as I make time to experiment with AutoIt. Great timing for me! Thanks again......

Edited by BobHansen

Hope this was helpful.............good luck, Bob

Share this post


Link to post
Share on other sites

Valik, I hard-coded some Notepad stuff in the initialization section:

If $TEXT_EDITOR = "Notepad" Then
   $REPOSITION = "^{Right}"    ; Notepad neeeds Ctrl-Right to move cursor...
   $LPAREN = "( "              ; Notepad needs a space delimiter...
Else
   $LPAREN = "("
EndIf

So changing the $REPOSITION variable won't help....

P.S. Valik if you are interested/have time in adapting AutoSense in to your much-better organiazed autocomplete framework that you had sent me, feel free to do so.


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 this post


Link to post
Share on other sites

Valik, I hard-coded some Notepad stuff in the initialization section:

If $TEXT_EDITOR = "Notepad" Then
   $REPOSITION = "^{Right}"    ; Notepad neeeds Ctrl-Right to move cursor...
   $LPAREN = "( "              ; Notepad needs a space delimiter...
Else
   $LPAREN = "("
EndIf

So  changing the $REPOSITION variable won't help....

P.S.  Valik if you are interested/have time in adapting AutoSense in to your much-better organiazed autocomplete framework that you had sent me, feel free to do so.

I'll give it a look tomorrow. The potential problem that I see is the framework makes lots of function calls to add some abstraction (And modularity) in, but, like you said, your version is "crammed with non-modular code in order to improve efficiency for preventing potential bugs caused by typing too fast...."

There's also the fact that you've got about 3 times as much code as the last time I messed with it :whistle: .

Share this post


Link to post
Share on other sites

JdeB sent me a modification that makes AutoSense installation automatic. It' in the 0.2.2 version download but the mod is based on slightly older code that may have some bugs. Read the docs for details.

BobHansen:

InitialCaps overwrites my functions when I did in lower case ..... not a problem for me, just an observation).

Ran Tool again, Title bar changed, and AutoSense stopped working.

Ran Tool again, Title bar includes AutoSense again, and AutoSense working again.

Both are features by design. (It sounds better to say "propertly terminates" instead of stops working. You never want more than one instance running at any one time. Read about the HotKeySet function in the official AutoIt docs when AutoIt 3.0.100 is released....)

Use $CAPITALIZE = 0 if you don't want any capitalization correction.

If Ctrl+J already has a binding in TextPad, maybe it won't work. Change this line as needed: (Read about Send in the AutoIt 3.0.100 help file for hotkey notation).

$AUTO_COMP = "^j" ; default is Ctrl-j, "^j"

Hope that helps, and thanks for trying out my program :whistle: I'll probably submit this one to TextPad soon.

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 this post


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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...