AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Script won't repeat

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Joe
Guest





PostPosted: Wed Jul 21, 2004 10:42 pm    Post subject: Script won't repeat Reply with quote

Chris, I love the program--thanks very much for sharing it.

I have an AHK script that I use to copy selected text from a text editor and send it to my interpreter's own Script Window. This AHK script is executed from within the text editor. Its current form is:

^F10::

Send, ^c ; copy the selected text

WinActivate, S-PLUS - Commands ; activate the interpreter
WinWaitActive, S-PLUS - Commands ; wait for it

IfWinExist, Script ; if S-PLUS already has a Script Window open, then close it; this section seems not to do anything
{
Send, !fcn
}

IfWinNotExist, Script ; if S-PLUS does not have a Script Window open, then create one, paste the text, select it, and send it to the interpreter via F10
{
Send, !FN{DOWN 5}{Enter}
Send, !ep
Send, ^a
Send, {F10}
}

If I run this AHK script *without* any S-PLUS Script Windows open, it works just fine. However, if I run this AHK script *with* any S-PLUS Script Windows open, it does not execute. In fact, it doesn't even copy the selected editor text to the clipboard, let alone activate any S-PLUS windows.

Any ideas (besides writing an AHK script to close the interpreter's Script Window on the way back to the editor, which I've already done--but sometimes forget to execute)?

Thanks again for a great tool.

Joe
Back to top
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Thu Jul 22, 2004 2:18 am    Post subject: Reply with quote

To debug the script, open it's main window via the tray icon, which will show you what commands the script most recently executed. It might have something to do with the right window not being active when the keystrokes are sent, or the fact that the title doesn't match due to case sensitive titles, etc. The main window can help you isolate the problem. You can also insert temp. msgbox lines such as "msgbox test1" in places to see what parts are actually being executed.

Also note that in place of this line:
Code:
IfWinNotExist, Script ; if S-PLUS does not have a Script Window open, then create one, paste the text, select it, and send it to the interpreter via F10

you can use this:
Code:
else ; if S-PLUS does not have a Script Window open, then create one, paste the text, select it, and send it to the interpreter via F10
Back to top
View user's profile Send private message Send e-mail
Joe
Guest





PostPosted: Thu Jul 22, 2004 5:06 pm    Post subject: Thanks Reply with quote

Fixed it, Chris--thanks so much for your help.

Btw, sorry for posting my original message in the wrong forum...I knew it was a bug in the user, not a bug in the program. Smile

Joe
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group