Robbie Posted December 18, 2006 Share Posted December 18, 2006 Hi I am a new user of Autoit and can't describe myself as a techie. I have been asked to help out a deafblind computer user and need to write a script to enable 2 pieces of software to open with one mouse click. THe first is Jaws that is a screen reader for braille users and the second is for an interpreting program to help him comminicate with the outside world. I have managed to work out how to open the 2 programs and that works ok but for the final program I need to add the keystroke Alt Enter and you can see the command I have tried but doesn't work. Please, what am I doing wrong. Looking forward to any help. NOTE This script should be run after the Braillenote is on and set to Terminal Mode ; to ensure that the Bluetooth is active first ; Intialise variables dim $state ; Run the Jaws executable to load..... Run ("C:\Program Files\Freedom Scientific\JAWS\7.10\jfw.exe") ; ... and wait for window to show. WinWait("JAWS") ; Wait for the Jawsindow to minimise, which it will always do. Do $state=WinGetState("JAWS","") until bitand($state,16) ; Now rn WTC in 32 Braille cell mode for Notetakers run ("C:\wtc\wtc.exe b32") ; Wait till window is active WinWaitActive("WTC") Sleep(2000) ; Send the Alt and Enter key press to start Communicator mode send("{ALT}{ENTER}") Regards Rob Link to comment Share on other sites More sharing options...
Valik Posted December 19, 2006 Share Posted December 19, 2006 You posted this in the FAQ. I've split it out to a topic with a deliberately poor title. In the future, pay attention what you are doing. Link to comment Share on other sites More sharing options...
Uten Posted December 19, 2006 Share Posted December 19, 2006 Take a look at Send in the help file. If I reacall right (This is somthing I usually have to lookup.. CTRL = ^ ALT = ! SHIFT = WIN = # So, this should do it in your case: Send("!{ENTER}") Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
herewasplato Posted December 19, 2006 Share Posted December 19, 2006 (edited) Either should work. Give this a try: Run("notepad") WinWait("Untitled - Notepad") WinActivate("Untitled - Notepad") WinWaitActive("Untitled - Notepad") Send("{ALT}F") ;Send("!F") oÝ÷ Ù.(!·§µ©b¶Ù^²W¦«y«¢+Ù¼(M±À ää¤(ÀÌØíÍÑÑô]¥¹ÑMÑÑ ÅÕ½Ðí)]LÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì¤)U¹Ñ¥° ¥Ñ9 ÀÌØíÍÑÑ°ÄØ...but that is not your main problem I see no reason why your code will not work unless AutoIt is "seeing" a match to WinWaitActive("WTC") from a window that you cannot see. A simple test for this might be to crank the sleep up from 2000 to 20000 or use a TrayTip to let you know where the script is. It would be best if you could find some Window Text for this line: WinWaitActive("WTC","") Edited December 19, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
herewasplato Posted December 19, 2006 Share Posted December 19, 2006 (edited) Try this version of your script as a debug:; Intialise variables Dim $state ; Run the Jaws executable to load..... Run("C:\Program Files\Freedom Scientific\JAWS\7.10\jfw.exe") ; ... and wait for window to show. WinWait("JAWS") ; Wait for the Jawsindow to minimize, which it will always do. Do Sleep(99) $state = WinGetState("JAWS", "") Until BitAND($state, 16) ; Now run WTC in 32 Braille cell mode for Notetakers Run("C:\wtc\wtc.exe b32") ; Wait till window is active Do TrayTip("Waiting...", "...for WTC Window", 1) Sleep(100) Until WinWaitActive("WTC", "") For $i = 20 To 1 Step - 1 TrayTip("Sleeping...", $i, 1) Sleep(1000) Next TrayTip("", "", 1) ; Send the Alt and Enter key press to start Communicator mode Send("!{ENTER}")If you see the TrayTip for the WTC window go away before the you see the window that you are expecting to be the WTC window, then you may have a transparent splash screen satisfying the WinWaitActive("WTC", "") line long before you see the visible window. If that is what is happening, then your sleep may not be long enough and the Alt-Enter is just send to the wrong app. Of course, I'm guessing blind here; maybe you see the "WTC" window well before the 2 seconds are up and the Alt-Enter is being sent to the correct window. Edit: Welcome to the forum... Edit: Changed to Send("!{ENTER}") Edited December 19, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
iZafiro Posted December 19, 2006 Share Posted December 19, 2006 (edited) Hi. Yes like what herewasplato said, Sleep() in loops are usually good Also, for the activation of the Communicator mode, Send("!{ENTER}") will press Alt+Enter Send("{ALT}{ENTER}") will press Alt then Enter separately. Try this script ; to ensure that Bluetooth is active first ; Declare globals Dim $state; Run the Jaws executable to load..... Run("C:\Program Files\Freedom Scientific\JAWS\7.10\jfw.exe") ; ... and wait for window to show. WinWait("JAWS") ; Wait for the Jawsindow to minimise, which it will always do. Do Sleep(100) $state = WinGetState("JAWS", "") Until BitAND($state, 16) ; Now run WTC in 32 Braille cell mode for Notetakers Run("C:\wtc\wtc.exe b32") ; Wait till window is active WinWaitActive("WTC") ; Wait a while for program to load Sleep(5000) ; Just make sure that program is active WinActivate("WTC") ; Send the Alt and Enter key press to start Communicator mode Send("!{ENTER}") P.S. What's with the ; to ensure Bluetooth is active first on top? Edit: Yep welcome, Robbie. Oh and if this is supposed to run everytime the deaf and blind computer user's computer starts up, you could put a shortcut to this script in the Startup folder or put a registry key somewhere. (I'm not really good with registry keys but I know there's one where you can put a path to a program and it will run it everytime the computer starts) Edited December 19, 2006 by iZafiro Link to comment Share on other sites More sharing options...
herewasplato Posted December 19, 2006 Share Posted December 19, 2006 ...Send("!{ENTER}") will press Alt+EnterSend("{ALT}{ENTER}") will press Alt then Enter separately...All this time and that never dawned on me. It makes perfect sense that AutoIt's devs would provide for both scenarios. I guess that the notepad demo code was too forgiving as it works either way.@Uten,I should have known better than to doubt you.@Robbie,Hope you get this to work... I probably chased after the wrong rabbit with my code - but I learned something. Now if I can just remember it......................-Most Senile Poster- [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now