9
« on: May 24, 2009, 12:07 AM »
I took out some stuff I thought wasn't needed, maybe I took out something important by mistake Try this:
;right mouse double click---------autohotkey to launch simple filename (cursor should be on line )
~RButton::
If (A_PriorHotKey = A_ThisHotKey and A_TimeSincePriorHotkey < 500)
{
; msgbox double right clicked
winactivate
;Sleep 500 ; wait for right-click menu, fine tune for your PC
send {esc}{Home}{Home}+{End}
;sleep 100
send ^c ;selects the entire line and copies it
ClipWait, .40 ; wait for the script to catch up.
winactivate
sleep 100
send {home}
linestring = %clipboard%
sleep 500
;msgbox linestring is %linestring%
;find the position of the character "[", call it leftmark
bit1 = [
StringGetPos, leftmark, linestring, %bit1%
leftmark := leftmark + 2
;msgbox leftmark is %leftmark%
;find the position of the character "]", call it rightmark
bit2 = ]
StringGetPos, rightmark, linestring, %bit2%
rightmark := rightmark + 1
;msgbox rightmark is %rightmark%
;stringlength= %rightmark%-%leftmark%
stringlength := rightmark - leftmark
;msgbox stringlength is %stringlength%
thefilename := SubStr(linestring, leftmark , stringlength)
;msgbox thefilename is %thefilename%
IfExist, %thefilename%
{
run %thefilename%
}
IfNotExist, %thefilename%
{
MsgBox, 260,, the File "%thefilename%" does not exist. Create the file?
IfMsgBox Yes
{
FileAppend, %thefilename%, %thefilename%
SplashTextOn, 320, 100, file created
Sleep, 400
SplashTextOff
run %thefilename%
}
else
Exit
}
}
Return
that's exactly what I have that works. It has all the messagebox things I used trying to get it to work originally, but they're remarked out. FYI sometimes I get a clipboard error thing the first time where it thinks the filename is empty. In that case just cancel and it usually works the next time and after that. Maybe a real programmer might be able to come along and really tune it up. (that'd be nice) Anyway, I hope this works for you.