Problem with launching programs from current directory
Moderators: Hacker, petermad, Stefan2, white
- Balderstrom
- Power Member
- Posts: 2148
- Joined: 2005-10-11, 10:10 UTC
- Balderstrom
- Power Member
- Posts: 2148
- Joined: 2005-10-11, 10:10 UTC
- Balderstrom
- Power Member
- Posts: 2148
- Joined: 2005-10-11, 10:10 UTC
I'm not changing Ctrl+Enter, TC is copying whatever is under the cursor to the commandline.
All my snippet does is let Ctrl+Enter do whatever TC thinks it should, and if the focus is on the Left or Right Panel when you press Ctrl+Enter, then focus on the Command-Line next.
As far as your script goes, you are hotkey'ing Enter - Which can also be used on ContextMenu's or the BreadCrumb Bar, or the AddressBar or the QuickSearch field among possibly other places. It's not "safe" for people to use. As well there is no "rtrim()" function in AHK.
When you offer up scripts to the public they shouldn't have so many bad side-effects, which I already mentioned in my previous post.
With your script you can't even do an inplace-rename on a file if any text exists in TC's Command-Line.
All my snippet does is let Ctrl+Enter do whatever TC thinks it should, and if the focus is on the Left or Right Panel when you press Ctrl+Enter, then focus on the Command-Line next.
As far as your script goes, you are hotkey'ing Enter - Which can also be used on ContextMenu's or the BreadCrumb Bar, or the AddressBar or the QuickSearch field among possibly other places. It's not "safe" for people to use. As well there is no "rtrim()" function in AHK.
When you offer up scripts to the public they shouldn't have so many bad side-effects, which I already mentioned in my previous post.
With your script you can't even do an inplace-rename on a file if any text exists in TC's Command-Line.
You are right - Rtrim is only available in the Lexikos build.
I couldnt find any "bad" side-effect. I wrote the script for me - not for all possible users out there. You can take it as good/bad example, make your own (hopefully working), use it etc. And maybe you should get yours working before complaining?
I couldnt find any "bad" side-effect. I wrote the script for me - not for all possible users out there. You can take it as good/bad example, make your own (hopefully working), use it etc. And maybe you should get yours working before complaining?
- Balderstrom
- Power Member
- Posts: 2148
- Joined: 2005-10-11, 10:10 UTC
Final Rewrite, Much cleaner to just trigger on Ctrl+Enter.
Code: Select all
#SingleInstance force
#NoEnv
SetBatchLines, -1
#ifwinactive, ahk_class TTOTAL_CMD
{
^$Enter::
if(!TC_TControlActive(aControl))
{
Send, ^{Enter}
return
}
ControlGet, cID, HWND,, Edit1, ahk_class TTOTAL_CMD
ControlGetText, sCMDLine,, ahk_id %cID%
Send, ^{Enter}
sCMDLine:=RegExReplace(sCMDLine, "^[ ]+", "")
if( sCMDLine )
return
ControlGetText, sCMDLine,, ahk_id %cID%
RegExMatch(sCMDLine, "i)^([ ]+)?(.*\.exe[ ]?)$", sTmp)
if( !sTmp2 )
return
ControlSetText,, % ".\" sTmp2, ahk_id %cID%
ControlClick,, ahk_id %cID%
return
return
}
TC_TControlActive( byRef activeControl, cName="" )
{
if( !WinActive("ahk_class TTOTAL_CMD") )
return !(ErrorLevel:=4)
ControlGetFocus, aControl, A
if( !cName && cName:="TMyListBox" )
cName .= ( TC_TControlExist("TMyListBox3") ? "[23]" : "[12]" )
if( RegExMatch( aControl, cName ) )
ControlGet, activeControl, HWND,, %aControl%
return ( ErrorLevel ? 0 : activeControl )
}
TC_TControlExist( controlName )
{
ControlGet, cID, HWND,, %controlName%, A
return (cID ? cID : !(ErrorLevel:=1))
}