 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
rudolf.noe
Joined: 20 Feb 2005 Posts: 4
|
Posted: Sun Feb 20, 2005 9:33 am Post subject: Shift+Right-Click offline translation with jDictionay |
|
|
Hello,
here the alternative to the online translation, I posted previously.
This scripts switches to the window of jDictionary (OpenSource Dictionary: http://jdictionary.sourceforge.net/), which has to be already started, and put the word, which was under the mouse when shift-right-clicked, in the edit mask and automatically starts the search.
You maybe have to adapt the coordinates of the edit mask at the end of the script, since shortcuts were not supported.
Cheers
Rudi
PS Please forgive my bad english
| Code: | ;Translation English<=>German with jDictionary
#SingleInstance force
;Hotkey combination is Shift+RightMouseButton
+RButton::
;Wait for Shift key is released
KeyWait, Shift, T1
;Double Click to select the word under the mouse
MouseClick,L,,,2
;Clear the clipboard and copy to it
Clipboard =
Send ^c
ClipWait 0.5
;jDirectory aktivieren
WinActivate ahk_class info.jdictionary.JDictionaryFrame
WinWaitActive ahk_class info.jdictionary.JDictionaryFrame
;Delete old entry
;Coordinates of the edit mask
MouseClick, L, 368, 198, 2
Send {Del}
SendRaw %Clipboard%
Send {Enter}
return |
|
|
| Back to top |
|
 |
savage
Joined: 02 Jul 2004 Posts: 207
|
Posted: Mon Feb 21, 2005 7:21 pm Post subject: |
|
|
Why don't you just do this?
| Code: |
;Translation English<=>German with jDictionary
#SingleInstance force
;Hotkey combination is Shift+RightMouseButton
+RButton::
;Wait for Shift key is released
KeyWait, Shift, T1
;Double Click to select the word under the mouse
MouseClick,L,,,2
;Clear the clipboard and copy to it
Clipboard =
Send ^c
ClipWait 0.5
;If the program isn't running, run it
IfWinNotExist, ahk_class info.jdictionary.JDictionaryFrame
{
Run, pathtojdictionary
}
;jDirectory aktivieren
WinActivate ahk_class info.jdictionary.JDictionaryFrame
WinWaitActive ahk_class info.jdictionary.JDictionaryFrame
;Delete old entry
;Coordinates of the edit mask
MouseClick, L, 368, 198, 2
Send {Del}
SendRaw %Clipboard%
Send {Enter}
return
|
That way the program runs if it's not already running? |
|
| Back to top |
|
 |
rudolf.noe
Joined: 20 Feb 2005 Posts: 4
|
Posted: Tue Feb 22, 2005 8:58 pm Post subject: |
|
|
Hello savage,
thanks for your reply
Your absolutly right one can do it. I was only a little bit too lazy to do it
Here is the enhanced code. If jDirectory is not already running a short delay is necessary, since java needs a little time to fully build up the interface after the window is already active.
Cheers
Rudi
| Code: |
;Translation English German with jDictionary
#SingleInstance force
;Hotkey combination is Shift+RightMouseButton
+RButton::
;Wait for Shift key is released
KeyWait, Shift, T1
;Double Click to select the word under the mouse
MouseClick,L,,,2
;Clear the clipboard and copy to it
Clipboard =
Send ^c
ClipWait 0.5
;If the program isn't running, run it
jDirectoryIsRunning := true
IfWinNotExist, ahk_class info.jdictionary.JDictionaryFrame
{
jDirectoryIsRunning := false
Run, pathofJDirectory\start.bat, pathofJDirectory
}
;jDirectory aktivieren
WinActivate ahk_class info.jdictionary.JDictionaryFrame
WinWaitActive ahk_class info.jdictionary.JDictionaryFrame
If (!jDirectoryIsRunning)
{
Sleep 2000
}
;Delete old entry
;Coordinates of the edit mask
MouseClick, L, 368, 198, 2
Send {Del}
SendRaw %Clipboard%
Send {Enter}
return
|
|
|
| Back to top |
|
 |
A.Fischer Guest
|
Posted: Thu Feb 24, 2005 8:50 am Post subject: Extension for keeping old Clipboard |
|
|
Hello,
I have extend the script for saving the old clipboard content and restoring it after calling jDict.
| Code: |
;Translation English<=>German with jDictionary
#SingleInstance force
;Hotkey combination is Shift+RightMouseButton
+RButton::
;Wait for Shift key is released
KeyWait, Shift, T1
;Double Click to select the word under the mouse
MouseClick,L,,,2
;Clear the clipboard and copy to it
C_ClipboardPrev = %clipboard% ; Save old clipboard
Clipboard =
Send ^c
ClipWait 0.5
;If the program isn't running, run it
jDirectoryIsRunning := true
IfWinNotExist, ahk_class info.jdictionary.JDictionaryFrame
{
jDirectoryIsRunning := false
Run, pathofJDirectory\start.bat, pathofJDirectory
}
;jDirectory aktivieren
WinActivate ahk_class info.jdictionary.JDictionaryFrame
WinWaitActive ahk_class info.jdictionary.JDictionaryFrame
If (!jDirectoryIsRunning)
{
Sleep 2000
}
;Delete old entry
;Coordinates of the edit mask
MouseClick, L, 368, 198, 2
Send {Del}
C_ClipboardStripped = %clipboard% ; This will trim leading and trailing tabs & spaces.
clipboard = %C_ClipboardPrev% ; Restore the original clipboard for the user.
SendRaw %C_ClipboardStripped%
Send {Enter}
return
|
|
|
| Back to top |
|
 |
rudolf.noe
Joined: 20 Feb 2005 Posts: 4
|
Posted: Thu Feb 24, 2005 10:42 am Post subject: |
|
|
Hello A.Fischer,
thanks, good idea
Cheers Rudi |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|