Jump to content

Any Opera users in the house?


Recommended Posts

I'm trying to use ControlSend to communicate with the Opera web browser when it is not the active window. The following code does bring up the quick preferences:

Opt("WinTitleMatchMode", 2)   
ControlSend("Opera", "", "[CLASS:OperaWindowClass; INSTANCE:5]", "{F12}")

However, some keys do not work with this method. For example, if I change F12 to F11 (full screen mode), nothing happens.

What I am attempting is to get Opera's text to speech working from other applications, so if I can figure out why the above isn't working, I'd be well on my way :)

Basically, I'm using [CLASS:OperaWindowClass; INSTANCE:5] because according to the AutoIt Window Tool, this is the control instance for the actual browser window, which I'll have to send keys to in order to get the voice working.

(Off-topic rant)

Right now, the only reason I am using Opera is for the text-to-speech. However, they broke it in v9.5 and it hasn't worked right since, even in the v10 betas. Since they seem more content with bitching and whining to the EU about how nobody wants to use their sh*tty browser because of IE, instead of actually FIXING it, I wish very much to go back to Firefox. However, I use Opera's text-to-speech feature all the time (even though I have to CTRL+F12 or switch tabs on every web page I go to in order to 'reset' it) and Firefox doesn't have a good equivalent (Click+Speak just doesn't do it for me), so I am pretty much stuck with Opera and it's half-working voice implementation until I can find a workaround.

(end rant)

Link to comment
Share on other sites

I don't understand, why you need to send keys? To get selected text and pass it to external app?

And you don't need the «[CLASS:OperaWindowClass; INSTANCE:5]» part at all, just send directly (and btw, Opera window should be active to recieve some key strokes):

WinActivate("[CLASS:OpWindow;REGEXPTITLE:.* - Opera.*]")
ControlSend("[CLASS:OpWindow;REGEXPTITLE:.* - Opera.*]", "", "", "{F11}")

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

I don't understand, why you need to send keys? To get selected text and pass it to external app?

There is a command in Opera, Speak, "%c", which tells its text-to-speech engine to read whatever text is in the clipboard. Anyway, in v9.27 (which I'll probably have to revert back to because I haven't been able to get this to work in 9.5x), I had this command mapped to the 'c' key. So if I had Opera open and pressed the c key, it would 'read' to me from the clipboard.

So the idea is to send Opera the c key while it is minimized in the system tray, thereby allowing me to use it with other applications, without having to make it active, and then having to minimize it when done. Only problem is normal (non-function keys) don't seem to register with controlsend. F12 does, but not F11. I'm trying to figure out why some keys register and some don't.

Note: I checked out the Opera udf... don't think there is anything tha would be useful for this purpose though.

Edited by WorknMan
Link to comment
Share on other sites

Hm, so you are using Opera only for text speach feature? I am sure there is many other programs that can do it (read from cliboard and speak it out :) ), i think we can do it even with AutoIt...

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

P.S

Also look at this tutorial, maybe it will help to solve the problem on 9.5x.

And it's working for my on latest Opera 10 beta.

P.P.S

I checked out the Opera udf... don't think there is anything tha would be useful for this purpose though.

No, you are right, there isn't. Edited by MrCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Hm, so you are using Opera only for text speach feature? I am sure there is many other programs that can do it (read from cliboard and speak it out :) ), i think we can do it even with AutoIt...

Yeah, but I particularly like Opera's text to speech, and I'm not aware of any other apps that use it. There are a lot of other text-to-speech engines that sound more human, but they all tend to sound like a person was reading while sitting on one of those vibrating beds that you used to see in cheap motels :) Opera's is more 'smooth'... I don't know how else to describe it?

P.S

Also look at this tutorial, maybe it will help to solve the problem on 9.5x.

And it's working for my on latest Opera 10 beta.

What specifically is working for you? The voice works in v9.5/v10, but it'll usally stop working when you go to a different web page, so you have to keep 'refreshing' it. Of course, I think there are only about 5 of us who use this feature, so it's doubtful that Opera is ever going to fix it proper.

Link to comment
Share on other sites

There are a lot of other text-to-speech engines that sound more human, but they all tend to sound like a person was reading while sitting on one of those vibrating beds that you used to see in cheap motels

I believe that the voices in Opera voice library can be used with other apps (the whole engine is reachable from «Opera\profile\voice» directory, i think you can pointing to this engine other apps).

The voice works in v9.5/v10, but it'll usally stop working when you go to a different web page

Well, then i don't understand how you switch the pages when you use it only for speach to text feature? :)

In the bottom line - What is exactly are you trying to do? As i see it, you simply need to trigger the feature in Opera, right? So what is the problem, i just remapped the «V» key («Speak Selection») to do «Speak, "%c"», and hided the Opera window («Ctrl + H»)... so now only i need to do is this:

ClipPut("Hello from Opera Browser!")
ControlSend("[CLASS:OpWindow;REGEXPTITLE:.* - Opera$]", "", "", "v")

As a result, i hear the sentence from clipboard, and Opera still hidden :) .

Edited by MrCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

  • 2 weeks later...

In the bottom line - What is exactly are you trying to do? As i see it, you simply need to trigger the feature in Opera, right? So what is the problem, i just remapped the «V» key («Speak Selection») to do «Speak, "%c"», and hided the Opera window («Ctrl + H»)... so now only i need to do is this:

Yes, that's it! However, something I did not consider is once it starts reading, how to use AutoIt to send a mouse click to the Opera window to shut it up :) Do you know how I can use ControlClick in another script to do this?

ControlClick("[CLASS:OpWindow;REGEXPTITLE:.* - Opera$]", "", "", "primary")

Does not work ;) If I could get this working, then I could map these two scripts ('start reading' and 'stop reading') to global hotkeys, and I'm all set!

Oh, one other thing.... if you go to this URL (I picked it at random):

http://en.wikipedia.org/wiki/Pacman

Copy the first part of the article and send it to Opera like you described, and you will see that unlike 'speak selection', 'speak %c' chokes on non-ASCII characters ;) I tried to have AutoIt strip out the non-Ascii characters, like so:

$clipboard_text = _ClipBoard_GetData($CF_TEXT)

But that causes AutoIt to crash. I see a reference to this issue in this thread, but I'm not sure what the resolution is? Right now, I cn work around this by writing the clipboard data to a text file and then reading it back out, but that is kind of a ugly hack :)

Link to comment
Share on other sites

  • 2 weeks later...

Yes, that's it! However, something I did not consider is once it starts reading, how to use AutoIt to send a mouse click to the Opera window to shut it up >_< Do you know how I can use ControlClick in another script to do this?

ControlClick("[CLASS:OpWindow;REGEXPTITLE:.* - Opera$]", "", "", "primary")

Note: Just figured this one out - posting it here, in case anybody cares:

ControlClick("[CLASS:OpWindow;REGEXPTITLE:.* - Opera$]", "", "[CLASS:OperaWindowClass; INSTANCE:5]", "primary")

Note: You have to have a web page open (even a blank html file will do), as it appears that Opera ignores the 'Stop computer speech if I click my mouse button' option if there's not a web page open. Reason #4830543 why I hate this browser.

Link to comment
Share on other sites

Have you considered trying Ultra Hal Text-to-Speech Reader (freeware). It reads from the clipboard and can easily be automated using AutoIt. All you have to do is find some good TTS (Text To Speech) voices to install on your machine, and write a bit of code if you wish to automate it.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...