Jump to content

Ctrl press in all windows


Ar3s
 Share

Recommended Posts

Hi all. I have a big Problem. I'm writing a script for pressing Ctrl+2 and some other commands.

I'm using this commands:

$Buff1=WinGetHandle("Windowname")

sleep 500

ControlSend($Buff1,"","Edit1","^2")

It does the right command. But when I'm surfing in www it press Ctrl in my browser. Now my QUestion, how can I get is press Ctrl only in this one Window?

Greetz Ar3s

Link to comment
Share on other sites

Hi all. I have a big Problem. I'm writing a script for pressing Ctrl+2 and some other commands.

I'm using this commands:

$Buff1=WinGetHandle("Windowname")

sleep 500

ControlSend($Buff1,"","Edit1","^2")

It does the right command. But when I'm surfing in www it press Ctrl in my browser. Now my QUestion, how can I get is press Ctrl only in this one Window?

Greetz Ar3s

Make sure $Buff1 only matches the window you want to send keystrokes to. If it is a browser window and you want to know when you have navigated away from the page, then look into the _IE* functions in the help file.

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

no. It's a special Programm working like a gameclient. sry. but I can't tell the programm cause it's in production too. perhaps in 2 or 3 month I can tell u :P

the windowname is like:

$Buff1=WinGetHandle("xxxxx [xxx]")

I hope u can help now better.

and thx for ur fast answer

Link to comment
Share on other sites

no. It's a special Programm working like a gameclient. sry. but I can't tell the programm cause it's in production too. perhaps in 2 or 3 month I can tell u :unsure:

the windowname is like:

$Buff1=WinGetHandle("xxxxx [xxx]")

I hope u can help now better.

and thx for ur fast answer

Once you get the correct window handle, there is no way you could use that handle in ControlSend() and have it go to the wrong window. Since you haven't posted any code, and I don't really know what the question is, I don't see how to help you.

What does "surfing in www" mean? This app is running in a web browser window, or has an embedded web browser, ...or what?

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

"surfing in www" :P

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Link to comment
Share on other sites

ok. I've read very much in this forum now and it seems that it is legal to talk about Macro(bots). :P

So now I can tell u more about my Problem. I wrote a Macro for my favorite game Silkroad. This makro helps me to buff my other chars.

The Client- / Windowname is SRO_Client [Charname]

And this is my code:

While 1

AutoItSetOption("WinTitleMatchMode", 2)

$Buff1=WinGetHandle("Charname")

If @error Then

MsgBox(4096, "Fehler", "Der Client is nicht mehr aktiv!!! Der Buffer wird geschlossen")

Exit

Else

AutoItSetOption ("SendKeyDelay" ,80)

AutoItSetOption ("SendKeyDownDelay" ,80)

Sleep (2000)

ControlSend($Buff1,"","Edit1","{F4}")

ControlSend($Buff1,"","Edit1","{F4}")

Sleep (2000)

ControlSend($Buff1,"","Edit1","^2")

Sleep (1000)

ControlSend($Buff1,"","Edit1","^2")

Sleep (1500)

ControlSend($Buff1,"","Edit1","2")

ControlSend($Buff1,"","Edit1","2")

ControlSend($Buff1,"","Edit1","2")

Sleep (1500)

ControlSend($Buff1,"","Edit1","3")

ControlSend($Buff1,"","Edit1","3")

ControlSend($Buff1,"","Edit1","3")

Sleep (1500)

ControlSend($Buff1,"","Edit1","4")

ControlSend($Buff1,"","Edit1","4")

ControlSend($Buff1,"","Edit1","4")

Sleep (1500)

ControlSend($Buff1,"","Edit1","5")

ControlSend($Buff1,"","Edit1","5")

ControlSend($Buff1,"","Edit1","5")

Sleep (3000)

ControlSend($Buff1,"","Edit1","^3")

Sleep (1000)

ControlSend($Buff1,"","Edit1","^3")

Sleep (1500)

ControlSend($Buff1,"","Edit1","2")

ControlSend($Buff1,"","Edit1","2")

ControlSend($Buff1,"","Edit1","2")

Sleep (1500)

ControlSend($Buff1,"","Edit1","3")

ControlSend($Buff1,"","Edit1","3")

ControlSend($Buff1,"","Edit1","3")

Sleep (1500)

ControlSend($Buff1,"","Edit1","4")

ControlSend($Buff1,"","Edit1","4")

ControlSend($Buff1,"","Edit1","4")

Sleep (1500)

ControlSend($Buff1,"","Edit1","5")

ControlSend($Buff1,"","Edit1","5")

ControlSend($Buff1,"","Edit1","5")

Sleep (3000)

ControlSend($Buff1,"","Edit1","^4")

Sleep (1000)

ControlSend($Buff1,"","Edit1","^4")

Sleep (1500)

ControlSend($Buff1,"","Edit1","1")

ControlSend($Buff1,"","Edit1","1")

ControlSend($Buff1,"","Edit1","1")

Sleep (3000)

ControlSend($Buff1,"","Edit1","^5")

Sleep (1000)

ControlSend($Buff1,"","Edit1","^5")

Sleep (1500)

ControlSend($Buff1,"","Edit1","1")

ControlSend($Buff1,"","Edit1","1")

ControlSend($Buff1,"","Edit1","1")

Sleep (3000)

ControlSend($Buff1,"","Edit1","^6")

Sleep (1000)

ControlSend($Buff1,"","Edit1","^6")

Sleep (1500)

ControlSend($Buff1,"","Edit1","1")

ControlSend($Buff1,"","Edit1","1")

ControlSend($Buff1,"","Edit1","1")

Sleep (3000)

ControlSend($Buff1,"","Edit1","^7")

Sleep (1000)

ControlSend($Buff1,"","Edit1","^7")

Sleep (1500)

ControlSend($Buff1,"","Edit1","6")

ControlSend($Buff1,"","Edit1","6")

ControlSend($Buff1,"","Edit1","6")

Sleep (3000)

ControlSend($Buff1,"","Edit1","^8")

Sleep (1000)

ControlSend($Buff1,"","Edit1","^8")

Sleep (1500)

ControlSend($Buff1,"","Edit1","6")

ControlSend($Buff1,"","Edit1","6")

ControlSend($Buff1,"","Edit1","6")

Sleep (3000)

EndIf

WEnd

In the Bolt-Lines are my Problems. Every Time it press Ctrl (^2 - ^8) it press Ctrl in all active windows. For excample when I'm surfing in Internet with Firefox it already press Ctrl and I zoom in or out. And now I need to get the Script to press Ctrl only in this one Window named SRO_Client [Charname].

Now I hope u understand my Problems. I hope u can help me.

Thx and big Greetz

Link to comment
Share on other sites

please help me. I need a fast help. It's for my job.

So now I can tell u more about my Problem. I

wrote a Macro for my favorite game Silkroad. This makro helps me to buff my other chars.

Riiiiiiiiiight...

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

:unsure: yeah sry. But my threats got closed in other Forums. So I first didn't want to write about Makro for Games :D

But pls help.

I've go news for you, threats get closed here too. :D

Game bots are discussed on this forum, so the obfuscation of your purpose was not required. I am not much of a gamer myself and want nothing to do with those topics, but there are others who could probably help. If you had been honest up front about your topic you would have likely already gotten their attention and help.

So I guess a free bump is all I can offer...

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...