Nova Posted September 4, 2004 Share Posted September 4, 2004 Hi I had an idea for a script and I was woundering if anyone could tell me if it possible to do. Here is a very basic idea of what Id need to start ! I want an autoit script to wait for a certain word or words to be written on an open msword document and once that word has been typed to do a preset action corrosponding to that word. Like for example if the word "ring" is typed into the open msword page a sound effect (ring.wav) would be played ? Can anyone explain to me how this could be done ? Link to comment Share on other sites More sharing options...
konan Posted September 5, 2004 Share Posted September 5, 2004 this is a example. in a NotePad windows,when you type "ring", it will send("ok"). If the times of "ring" is over 10 , the script is over. winactivate("Untitled - Notepad") $site=0 $flag=0 $tm=1 do $txt=controlgettext("Untitled - Notepad","","Edit1") $inw=stringinstr($txt,"ring",0,$tm) if $inw>$site then $tm=$tm+1 $site=$inw send("ok") endif if $tm>10 then $flag=1 endif sleep(100) until $flag=1 Link to comment Share on other sites More sharing options...
konan Posted September 5, 2004 Share Posted September 5, 2004 AutoIt cannot read the text in word. Word uses a "custom" control. Lar. <{POST_SNAPBACK}>Yeah,AutoIt can't do with custon control, so you can use NotePad instead it. Link to comment Share on other sites More sharing options...
Nova Posted September 5, 2004 Author Share Posted September 5, 2004 anyideas why this wont work then ? winactivate("Untitled - Notepad") $txt=controlgettext("Untitled - Notepad","","Edit1") $check=stringinstr($txt,"ring",0) If $check=0 Then send("ok") else Run('C:\Program Files\iTunes\iTunes.exe "' & 'C:\My Music\soundeffects\ring.wav"') endif while 1 sleep(10) wend Link to comment Share on other sites More sharing options...
Developers Jos Posted September 5, 2004 Developers Share Posted September 5, 2004 anyideas why this wont work then ? <{POST_SNAPBACK}>Do you want to wait till the text contains "ring" and then Beep ? WinActivate("Untitled - Notepad") While 1 $TXT = ControlGetText("Untitled - Notepad", "", "Edit1") $CHECK = StringInStr($TXT, "ring", 0) If $CHECK = 0 Then ;Send("ok") Else Run('C:\Program Files\iTunes\iTunes.exe "' & 'C:\My Music\soundeffects\ring.wav"') ExitLoop EndIf Sleep(10) Wend SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. 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