Jump to content

Run Keystrokes in Minimized Window


Recommended Posts

Okay... well... I've done several searches and I can't get it to work. It just wont run my code.

Sooo, could someone give me the exact code I would use so that I can learn off of this?

It's a very simple code:

while 1=1

Send("{Left}")
Send("{Left}")
Send("{S}")
Send("{Right}")
Send("{Right}")

wend

This works in FFVIII. Back and fourth, S to attack. It works but I need to have it work while the the window is minimized. For reference, the window name is "FF8".

As said before, I'm sorry, I just don't understand what I'm doing wrong.

Edited by GoronSlayer99
Link to comment
Share on other sites

Try this:

While 1
ControlSend("FF8", "", "", "{LEFT}")
ControlSend("FF8", "", "", "{LEFT}")
ControlSend("FF8", "", "", "{S}");if this doesn't work change to "{s}"
ControlSend("FF8", "", "", "{RIGHT}")
ControlSend("FF8", "", "", "{RIGHT}")
WEnd

Or...

Opt("SendKeyDelay", 100)

While 1
ControlSend("FF8", "", "", "{LEFT} & {LEFT} & {S} & {RIGHT} & {RIGHT}");same as above (with s)
WEnd
SciTE - much better than notepad. ; ]
Link to comment
Share on other sites

  • Moderators

ControlSend("FF8", "", "", "{LEFT} & {LEFT} & {S} & {RIGHT} & {RIGHT}");same as above (with s)

That doesn't look right at all.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

ControlSend("FF8", "", "", "{LEFT 2}" &  "{S}" & "{RIGHT 2}")

Was missing quotes in the right spot, try that now.

Edit: HA!... too quick Alex!!

Edited by ronsrules

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Thanks but I'm having a bit of a problem. I have a program I use to run my disc. In that program, it shares the same window name. When I click one of the "tabs" at the top of the screen it appears as if the script is running. I can tell it's pressing "S" becuase my computer beeps and the window goes inactive. However, once I run my game, it just sits there as if it's not doing anything, whether the window in active or not.

B)

I did try both of your methods btw...

EDIT: Wow, I should press refresh every now and then...lemme try it now :o

Edited by GoronSlayer99
Link to comment
Share on other sites

Huh? Why?

It sends left, left, s, right, right with 100ms wait after key send.

I use same "combo" with my WoW and it works. B)

Because this:

ControlSend("FF8", "", "", "{LEFT} & {LEFT} & {S} & {RIGHT} & {RIGHT}")

will send left arrow, space, Shift+7, space, left arrow, space, Shift+7, space, S, space, Shift+7, space, right arrow, space, Shift+7, space, right arrow.

The & symbols need to be outside the string for concatenation to take place. You meant this:

ControlSend('FF8', '', '', '{LEFT}' & '{LEFT}' & '{S}' & '{RIGHT}' & '{RIGHT}')

which is equivalent to this:

ControlSend('FF8', '', '', '{LEFT}{LEFT}{S}{RIGHT}{RIGHT}')

which is equivalent to this:

ControlSend('FF8', '', '', '{LEFT 2}s{RIGHT 2}')
Link to comment
Share on other sites

Thanks but I'm having a bit of a problem. I have a program I use to run my disc. In that program, it shares the same window name.

I would suggest identifying the game window via some window text (if any) and/or by class name (which will be reported by AutoIt Window Info). Then you can do this:

Opt('WinTitleMatchMode', 4)
While 1
    ControlSend('ClassName=(whatever)', '', '', (etc.))
WEnd
Edited by LxP
Link to comment
Share on other sites

Well I still can't get it to work. The emulator (No, the game is not downloaded, I'm running my own disc from my D drive) works. Ill select "File" or the "run" tab and it will move one tabs over, or make a beep noise indeicating the "S" being pressed, but once I get into the game, the protaganist sits doing nothing.

It's getting late and I'll keep trying tomorrow.

-Thanks

GS

Link to comment
Share on other sites

  • Moderators

Try posting your whole code for better results, this is like a dog chasing its tail at the moment. I'm sure someone will give the correct response if they can see what they need to do.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Try posting your whole code for better results, this is like a dog chasing its tail at the moment. I'm sure someone will give the correct response if they can see what they need to do.

Mmmm... Okay, welll basically I've tried all of the codes that you all have posted.

If you mean my original code, it is stated in my first post.

My code that I last tried, which was also unsuccessful is...

While 1

Sleep(500)
ControlSend('FF8', '', '', '{LEFT}')
Sleep(500)
ControlSend('FF8', '', '', '{LEFT}')
Sleep(500)
ControlSend('FF8', '', '', '{S}')
Sleep(500)
ControlSend('FF8', '', '', '{RIGHT}')
Sleep(500)
ControlSend('FF8', '', '', '{RIGHT}')

WEnd

Yep...

Edit: Okay, this is probably the emulator. Maybe it's kinda using the gamescreen as a foreground? Cuz I can press a key to resort to the emu's main screen... Lemme try something else.

Edited by GoronSlayer99
Link to comment
Share on other sites

  • Moderators

Ok

1. Do you have SciTE Editor?

2. Send() will not work on minimized windows.

3. Use AutoInfo Tool to find the window title (it will be in SciTE under tools).

4. Provide us with the Windows title that SciTE list (can copy and paste it... paste the class too right under title)

5. We will show you how to use ControlSend()

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Ok

1. Do you have SciTE Editor?

2. Send() will not work on minimized windows.

3. Use AutoInfo Tool to find the window title (it will be in SciTE under tools).

4. Provide us with the Windows title that SciTE list (can copy and paste it... paste the class too right under title)

5. We will show you how to use ControlSend()

Okay...here we go...

1.No...well, now I do.

2. B)

3.ePSXe - Enhanced PSX emulator

(I could post that right? Before i just said "FF8" and substituted that with "ePSXe - Enhanced PSX emulator")

No Control ID...It's blank...

5. :o

Edited by GoronSlayer99
Link to comment
Share on other sites

  • Moderators

And the Class?

It will look something like this in the AutoInfo tool:

>>>>>>>>>>>> Window Details <<<<<<<<<<<<<

Title: Run Keystrokes in Minimized Window - AutoIt Forums - Microsoft Internet Explorer

Class: IEFrame

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...