AutoHotkey Community

It is currently May 27th, 2012, 6:53 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 15 posts ] 
Author Message
 Post subject: SendTo
PostPosted: September 23rd, 2011, 11:20 am 
Offline

Joined: September 7th, 2004, 9:20 pm
Posts: 275
Location: France
Hello,
I don't know if it is a realistic idea, but I think it is probably at least a good one (if this can be done) !
The goal is to provide a default target application to subsequent Send commands.
The syntax would be : SendTo [WinTitle, WinText, ExcludeTitle, ExcludeText]
These parameters have the same meanings as in the windows/control commands, like WinGet or ControlGet.
When a title is given, the subsequents Send/SendRaw/SendInput/SendPlay/SendEvent commands sends the keys to the window given in SendTo, regardless of the destination control (this is the point i'm not certain it can be done) : the keys will be directed (?) to the first control which can accept keys entry (as it isn't necessary, with a send command, to specify to which control the text must be sent, I think that my proposition can be OK but I'm not shure). A SendTo command without any parameter cancel the previous default target application defined by the SendTo command
So we should have :
Code:
SendTo ahk_class Notepad
SendInput The text to send.`n
Send Another text to send
SendTo

That means that the target window for the SendInput and Send command would be, in this example, the Windows Notepad, until the SendTo command without parameter.
I don't think it would make double usage with ControlSend, as the goal is not to send the keys to a specific control in a window, but to the first one that accept text input, IMO.
The benefit, IMO, would be to be able to send keys to a default window, regardless of its state (active or not, visible or not, etc...)
May be is it a good idea ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 23rd, 2011, 12:29 pm 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
http://d.ahk4.me/~ControlSend :?:

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: SendTo
PostPosted: September 23rd, 2011, 12:49 pm 
Offline

Joined: September 7th, 2004, 9:20 pm
Posts: 275
Location: France
Nemroth wrote:
I don't think it would make double usage with ControlSend, as the goal is not to send the keys to a specific control in a window, but to the first one that accept text input, IMO.
May be it makes double usage, but i'm far to be shure it's the case.
Firstly, the goal is to make the subsequent send commands to send the keys by default to a specific app, not to a sepcific control of this app. So I think it is different from ControlSend
Secondly, at the opposite of the ControlSend command, you don't have to know to which control in the window you have to send the keys (so you don't have to know it's classname or name).
But may be I'm wrong ?
PS: IMO, SendTo can be eiher a command or a directive (#SendTo)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 23rd, 2011, 1:39 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
ControlSend can send just to a window, though, you can leave the control blank.

I like the idea of the command, but SendTo reminds me too much of the Right click menu option of explorer Send To...

Perhaps SendTarget or SendDefault? It is sort of like Gui, Default. You /can/ wire a Gui number on every line, or you can use Gui Default to set a target.

+1/2

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 23rd, 2011, 2:48 pm 
Offline

Joined: September 7th, 2004, 9:20 pm
Posts: 275
Location: France
engunneer wrote:
ControlSend can send just to a window, though, you can leave the control blank.
I didn't know. Thanks for the info.
You are right when you say that the idea is to provide a default app as target of all the subsquent Send commands, for example :
Code:
SendTo ahk_class Notepad
Loop
{
  if a_index > 20
    break
  if a_index <= 20
  {
    SendInput Line %a_index% to send.`n
    continue
  }
}
Send And this is the final line
SendTo
It can be a command or a directive, and it's name can be, as engunneer said, SendTarget or SendDefault, no problem for me.
engunneer wrote:
It is sort of like Gui, Default. You /can/ wire a Gui number on every line, or you can use Gui Default to set a target.
I'm OK


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 23rd, 2011, 2:57 pm 
Offline

Joined: October 13th, 2009, 10:09 pm
Posts: 1389
I don't like this idea, but this is probably because I don't like all these defaults at all. I would suggest to get rid of all of them :P

If you need a specific default in a script you can write a short function that wraps the command :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 23rd, 2011, 3:12 pm 
Offline

Joined: September 7th, 2004, 9:20 pm
Posts: 275
Location: France
I think that what is good with this type of "default" commands is that they can make the life easier for some Autohotkey users, who like to use this type of facility, but that the ones who don't like them, as fragman, can work without.


Last edited by Nemroth on September 23rd, 2011, 9:55 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 23rd, 2011, 4:19 pm 
Offline

Joined: October 13th, 2009, 10:09 pm
Posts: 1389
Nemroth wrote:
I think that what is good with this type of "default" commands is that they can make the life easier for some Autohotkey users, who like to this type of facility, but that the ones who don't like them, as fragman, can work without.


Except for things like ListViews where they're required :(


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 23rd, 2011, 10:19 pm 
I like the idea to set a default window for the send commands. Regarding naming, what about WinSetSend :idea:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 23rd, 2011, 10:41 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
SendSetWin might be better. WinSet* implies that it sets something about the window

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 23rd, 2011, 10:54 pm 
Or SendDefaultApp, may be ?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 24th, 2011, 5:03 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
None of the traditional Send modes (event, input and play) support targeting a particular window, so setting which window to send to implies that the ControlSend method must be used. In that case, you can just set the Last Found Window and use ControlSend without specifying WinTitle.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 24th, 2011, 5:53 am 
Offline

Joined: September 7th, 2004, 9:20 pm
Posts: 275
Location: France
Thanks for your answer, Lexicos.
I learned some things, thanks.
May be the idea is stupid, but would it be possible so to have this command, regardless of its name, doing something like that :
Code:
If the window actually active is different from the one in the (saying) SendTo command
{
   memorize it
   make the one in the SendTo command become the Last Found Window (without necessary activing it)
}
For each subsequent Send type command
{
   replace it (implicitly) by a ControlSend command using the Last Found Window
} Until the next SendTo command without parameter is encountered
Once the next SendTo command without parameter is encountered, restore the window that was memorized as Last Found Window, if different.
Do you think it's realistic and ... desirable?
Thanks for your answer.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 24th, 2011, 6:08 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
No.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 24th, 2011, 7:33 am 
Offline

Joined: September 7th, 2004, 9:20 pm
Posts: 275
Location: France
For me, it's a pity, but you're the one who do the job. Respect. Thanks for your time. Topic ended.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group