Jump to content

Windows OS Users: Selecting Text in Edit/Specify Calculation Windows


This topic is 2919 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

How many times a day do you double-click to select text in a "Specify Calculation" window, and it selects the space at the end of the text? And then if you double-click a field it consumes the selected space character, and the next time you double-click the ")" or the ";" gets selected and consumed.

 

I find myself fumbling over entering function parameters all the time, on the Windows platform, so I finally broke down and created an AutoHotKey script that helps me select the parameter without selecting parentheses, spaces and semicolons.

 

Typical Double-click gives me this selection:

post-112416-0-17758400-1417201545_thumb. or this post-112416-0-48469100-1417202764_thumb.

 

AutoHotKey Control-key+Single-click gives me this selection:

post-112416-0-13314500-1417201817_thumb. or this post-112416-0-38080500-1417202777_thumb.

 

AutoHotKey Script:

 

 

;;;; Written by Jim Dee
;;;; For use with FileMaker's variously named Calculation Windows
;;;; Control + Left Mouse Button click on a parameter in the calculation window and your
;;;; selection will be reselected without the trailing Parentheses, Spaces and Semicolons
;;;; 
#If WinActive("Edit Expression") or WinActive("Specify Calculation") or WinActive("Edit Custom Function")
~^lbutton::
{
 keywait, Ctrl
 CB_Old := Clipboard
 Send, ^{Left}
 Send, +^{Right}
 Send, ^c
 clipwait
; sleep 2000
 CB := Clipboard
 Length := StrLen(CB)
 Send, ^{Left}
 Count := 1

 loop %length% {
  nC := SubStr(CB, Count, 1)
  if (nC = "(") {
   Send, {Right}
  } else if (nC = ";") {
   Break
  } else if (nC = " ") {
   Break
  } else if (nC = ")") {
   Break
  } else {
   Send, +{Right}
  }
  Count := Count + 1
 }
 Clipboard = %CB_Old%
; msgbox %length% %CB%-
}
return

#IfWinActive
Return

 

 

AutoHotKey Website:

 

http://www.autohotkey.com/

 

I hope someone else can make use of this too.

 

Jim Dee

Link to comment
Share on other sites

That sounds cool, Jim, I'll try it. I use AHK just for text expansion and it's great. Sometimes I'll get a little fancy with stuff like:

 

::ie::IsEmpty( ){Left}{Left}

 

... or inserting the date within a text string but that's about it.

 

Working with Windows has caused me to get compulsive about surrounding text strings with spaces, just so I can easily select them later.

Link to comment
Share on other sites

  • Newbies

Tom,

 

I hadn't used AutoHotKey for FileMaker (used it for lots of other things) until very recently so I'm definitely going to expand my use for things like this in FM. I'm going to change a couple things about your key and use it too. I usually use the *, which will cause the keys to fire immediately after they are entered, however I also use two spaces after the key "ie  " so that it takes two keys to fire the result. This way it won't accidentally fire when I type a word like Christie or Smoothie with a space after it.

 

#If WinActive("Edit Expression") or WinActive("Specify Calculation") or WinActive("Edit Custom Function")
 

:*:ie  ::IsEmpty(  ){Left}{Left}

:*:gf  ::GetField (  ){Left}{Left}

...

 

#IfWinActive
Return

 

I really wanted to change the double-click in the calculation windows but I couldn't figure out a way to do it without messing up the double-click for the fields and functions lists. Also, the Control-key+Single-click takes some getting used to since the script doesn't fire until the Control-key is released.

 

If anyone has some ideas to make it better, please let me know.

 

Thank you,

Jim

Link to comment
Share on other sites

  • Newbies

Also, below is for formatting Case, Let and If statements... You'll need to type "case", "let" or "if" followed by two spaces to trigger.

 

:*:Case  ::
{
 Send, Case ({enter}
 Send,  ^{Tab}test1 `; result1 `;{enter}
 Send,  ^{Tab}test2 `; result2 `;{enter}
 Send,  ^{Tab}test3 `; result3 `;{enter}
 Send,  ^{Tab}test4 `; result4 `;{enter}
 Send,  ^{Tab}defaultResult{enter}
 Send, ){enter}
}
return

 

:*:let  ::
{
 Send, Let ({enter}
 Send,  ^{Tab}[{enter}
 Send,   ^{Tab}^{Tab}var1 = expression1 `;{enter}
 Send,   ^{Tab}^{Tab}var2 = expression2{enter}
 Send,  ^{Tab}] `;{enter}
 Send,  ^{Tab}calculation{enter}
 Send, ){enter}
}
return

 

:*:if  ::
{
 Send, If ( test `;{enter}
 Send,  ^{Tab}resultOne `;{enter}
 Send,  ^{Tab}resultTwo{enter}
 Send, ){enter}
}
return

Link to comment
Share on other sites

Nice. Here's my little collection of AHK for FileMaker. The last one doesn't work, the part after "text" is omitted when it expands. Do you happen to know the correct syntax?

 

; FILEMAKER
::getkey::Get(ActiveModifierKeys)
::getrow::Get(ActivePortalRowNumber)
::getcd::Get(CurrentDate)
::getct::Get(CurrentTime)
::getfc::Get(FoundCount)
::getle::Get(LastError)
::getlm::Get(LastMessageChoice)
::getln::Get(LayoutName)
::getrn::Get(RecordNumber)
::getsp::Get(ScriptParameter)
::getsr::Get(ScriptResult)
::getwh::Get(WindowHeight)
::getwl::Get(WindowLeft)
::getwm::Get(WindowMode)
::getwn::Get(WindowName)
::getwt::Get(WindowTop)
::getww::Get(WindowWidth)
::fmm::FileMaker
::ie::IsEmpty( ){Left}{Left}
::su::Substitute( text ; [ "" ; "" ]; [ "" ; "" ]; [ "" ; "" ] )

Link to comment
Share on other sites

Thanks for that. Not working quite right for me, though -- I've tried all kinds of escaping combos and it expands the way I want, except it appends this extra bit at the end:

""""]""""]""""])

It's weird. I found the docs, and I see that you only need to escape semicolons that are preceded by a space. And pairs of quotes normally resolve to a single quote. But even if I "normalize" the command so it has no escapes at all, like so:

::su::Substitute( text; [ "aaa"; "bbb" ]; [ "ccc"; "ddd" ] )

The result is:

Substitute( text; [ "aaa"; "bbb" ]; [ "ccc"; "ddd" ] ) """"]""""])
Link to comment
Share on other sites

  • Newbies

What version of AUTOHOTKEY are you using?

 

I currently have version v1.1.13.00.

 

Is that still that last line in your AHK file?

 

I added the key defined exactly as it is above - :*:su  ::Substitute( text `; [ `"`" `; `"`" ]; [ `"`" `; `"`" ]; [ `"`" `; `"`" ] ) - and it works perfectly.

Link to comment
Share on other sites

I figured it out -- it's the auto-complete settings of Notepad++, which is how I was testing. Argh!

 

Works just fine in FileMaker.

 

Thanks again!

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.