PHP To Simulate a "Click" or a "Keystroke&quo

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
ForceGamerDotCom
Forum Newbie
Posts: 5
Joined: Fri Aug 13, 2004 12:36 am

PHP To Simulate a "Click" or a "Keystroke&quo

Post by ForceGamerDotCom »

Okay this one is a doozy.

I need to somehow make PHP simulate a Click on a certain coordinate of the screen, and I also need PHP to simulate a keystroke, such as sending F11 to a system. I need to incorporate PHP into my C++ core program... It is for a bot for a game.

Any help at all would be much appreciated.
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Sounds like a client-side application your developing.

PHP is server-side.
ForceGamerDotCom
Forum Newbie
Posts: 5
Joined: Fri Aug 13, 2004 12:36 am

Post by ForceGamerDotCom »

Isn't Javascript server-side? PHP is mainly goigng to be a data holder for the C++ to use. I may just use the PHP to hold coordinates and use C++ to simulate the clicks...

Basically I am trying to make a PHP version of JS SpiderMonkey.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

javascript is client side..

php spits out its parsed data and will do nothing until the page has been refreshed.
User avatar
arcanechaos
Forum Newbie
Posts: 4
Joined: Sat Aug 14, 2004 3:27 am
Location: Long Beach, CA

Post by arcanechaos »

php doesnt run on the persons machine, it executes before you get the page displayed on your screen. javascript runs on any javascript enabled browser, and executes after the page has been loaded. two different types of usage. sounds like you need php to get the info, javascript to use the info, and c/c++ to do the rest.
LiquidPro
Forum Commoner
Posts: 37
Joined: Wed Aug 04, 2004 6:33 pm
Location: Akron, OH

Post by LiquidPro »

however what you could do is you could use an image map on your coordinate system, that would link to a PHP page that would execute the query to store the click... then refresh the current page.

as for the F11, no clue how you're going to do that... the only thing i could think of would be to use a javascript keyhook to catch the F11 keystroke, then have it execute a certain PHP page and refresh the current page or whatever you want to do.

goodluck, sounds like a tough situation...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

this isn't for a website, people.. it's for an application that scripts another application.. basically.
ForceGamerDotCom
Forum Newbie
Posts: 5
Joined: Fri Aug 13, 2004 12:36 am

Post by ForceGamerDotCom »

I figured it out -- I have to write a C++ interpreter for PHP, simple as that. My PHP only holds arrays that contain values for coordinates, and names of different things that need to be used. Also like 50 or so defines... As for keystrokes I am not sure how I am going to do that yet.
User avatar
protokol
Forum Contributor
Posts: 353
Joined: Fri Jun 21, 2002 7:00 pm
Location: Cleveland, OH
Contact:

Post by protokol »

Just out of curiosity, if you're using C++, then what do you need PHP for?
d_d
Forum Commoner
Posts: 33
Joined: Wed Jul 07, 2004 4:56 pm
Location: UK

Post by d_d »

I'm wondering that as well. Since it's a bot for a game I am assuming it's for windows. If so there are plenty of languages other than c/c++ capable of doing a mouseclick and sending a keystroke. Whatever features of php you require must be doable in one of them with less effort than writing an interpreter.
Also if you are going to write an interpreter for php in c++ then you are going to have to implement the functionality of php that you require in c++ to interpret it. Why not just cut out a lot of work and do it all in c++ to start with? Unless some form of scripting is needed.
Post Reply