set OK = baSendKeys( "hello" ) -- (nothing happens)
If nothing happens, you should "examine" the value of your variable 'OK' to see if an error occurred and if so what it is (check the Buddy API docs)
This works if I do it for a field within Director itself but not on the webXtra or any other window (MSWord or Explorer etc). Is the correct use of this command? I also have Dir11.5 but non of the ba commands work!
I don't know why it doesn't work in D11.5 - are you testing the authoring environment or a projector? Do you have the xtra correctly installed? Is there an error message, or does it fail silently - that is: how do you know the commands don't work?
You can get the window handle of the WebXtra sprite. Maybe you should use baActivateWindow() before baSendKeys().
The returned value is 0 which signifies the command was executed correctly. I tried to get the active window but I always get the Director window handle and never the sprite which is odd! As to the xtra installation, the xtra works with other commands except sendKeys which tells me it works but something is peculiar with the way I am using it.
The window handle Buddy obtains ( via baChildWindowList(baStageHandle()) ) seems to be identical with the property at sprite("WebXtra").browserReference - so you could use this in your call to baActivateWindow() and prior to baSendKeys().
That is, something like:
bActivated = baActivateWindow( sprite("WebXtra").browserReference ) intSent = baSendKeys("hello")
bActivateWindow() return 0 which means it isn't successful after using your code. However, I tried the same code to type into another application (Explorer) and it works. So it seems the problem is that even though I am clicking on the webXtra sprite, baSendKeys is not recognizing that as a window, instead it is sending these keys to the Director or the Stage window which explains why it is not working. So the trick is to find the window handle for the xtra which logically should be obtained as you suggested, so I am puzzled.
Many thanks for your help and any other suggestion you may come up with. I will keep trying and keep you posted.
Sorry - I'm all out of suggestions. It was always going to be a hack. Did you ask Mauricio of Tabuleiro whether he has any suggestions?
There might be another solution using a different method.
If you are trying to auto complete a form to send data to the internet - it might be even better to use a PHP script hosted on the web server and use GetNetText to post the information you want to the server. This would possibly be the cleaner way to complete information on a form. I think it would be risky setting the mouse position and then entering data using the keyboard command keys as the user might interrupt the process or change the position of movie on the screen.
Just a thought anyway.
Well it works... but for some reason u must wait about 1 sec before u call this function set OK = baSendKeys( "hello" )
Like I did I used
baPlaceCursor( 94 , 453 ) -- place the cursor over the text field (it works)
baMouseClick( "left" ) -- simulate a click (it works, the text cursor starts blinking)
set OK = baSendKeys( "hello" ) -- (It writes hello)
It aint working in Windows Vista ... strange.... works fine in XP and NT though
I send this in message window in director on windows vista as administrator
put baSendKeys( "hello" )
and the result is --6
according to helpfile:
Returns an error code.
invalid character in string
another SendKeys function is still under way
On windows XP it says
--0 and it writes hello as it should
How can I make it work on Windows Vista?