0

Here's a real challenge:

I have created a command that types from the CLI in OS X 10.11.

osxtype "hello"

will send the actually keyboard keypresses for h, e, l, l and o. it will type into what ever application is active. I also wrote a command for mouse clicks.

this will also work over ssh. if I use the command form another computer will will type and click on the host computer. Exactly what I need.

I want to have PHP run those commands. my OS X is a host (just on my local network for security reasons) and it's apache user now logs in as the admin rather then _www. I know this is risky under most circumstances but this is more of a workbench project. it not for use over the open internet.

When I use

exec('osxtype "hello"');

nothing happens. PHP shows me I'm using the admin user with 'whom' and there don't seem to be any errors. Where are my automated keypresses and mouse click going?

to be clear, I want to make a small web page that has buttons. when you click the buttons the mouse on the host machine will execute a series of clicks on an adobe flash application.

thanks in advance!

edit: Thanks for the comment.

The cli tools I made manipulate the normal OS X environment. I don't think it's X11 based.

I don't tell PHP what display to use and neither do the commands. When I run them from SSH on a different computer they still work on the host as expected without any clarification on which display. I'm not sure how I would define the display to send the commands to.

I did nothing at anytime to loosen protection on anything. the commands worked the first time i wrote them and they basically just post simple events that correspond with mouse state and key press state.

  • Does your program use X?  When you run it from PHP with exec, are you telling it what DISPLAY to use?  Have you appropriately loosened the protection on that display?  Please do not respond in comments; edit your question to make it clearer. – G-Man Aug 2 '15 at 1:02
  • Don't you need the full path to osxtype in the exec statement? – Kent Aug 2 '15 at 12:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.