Sendkeys -> Strg+C in Firefox zulassen
Ich möchte mit einem VBScript einen in Firefox markierten Text über Sendkeys->Strg+C in die Zwischenablage kopieren. Firefox blockiert das aber. Das Skript funktioniert bei allen andern Programmen. Nur nicht bei Firefox. Ich kann mir nur denken dass Skript-Zugriffe auf die Zwischenablage aus Sicherheitsgründen gesperrt sind. Wie kann ich das erlauben?
Additional System Details
- Shockwave Flash 11.4 r402
- VLC media player Web Plugin 2.0.2
- Adobe PDF Plug-In For Firefox and Netscape "9.5.2"
- Office Live Update v1.5
- DRM Netscape Network Object
- Npdsplay dll
- DRM Store Netscape Plugin
- Office Plugin for Netscape Navigator
- User Agent: Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20100101 Firefox/19.0
Firefox does not natively run VBScript. Is your VBScript running externally to the browser, in the Windows Script Host?
My VBScript is running externally in the Windows Script Host as you said.
When I mark a word in a firefox tab and press Ctrl+C it's copied to the clipboard. When I start the script and sendkeys "presses" the same Ctrl+C combination it's NOT copied to the clipboard. So the only thing I can imagine is some kind of blocking of my script by firefox, but I have no idea why and how firefox would block this as sendkeys just simulates the keystrokes. The programm doesn't know that the keystrokes don't come from the keyboard, right?
I haven't tried that... If you send Ctrl+t does Firefox open a new tab? If so, but "in page" operations do not work as expected, the focus might not be in the page.
Jep, Crtl + T does work. I think you are right. Maybe the focus of the page gets lost when the script starts. Unfortunately I don't know a vbscript command to get the focus of a page or tab back. I only know WshShell.AppActivate "Firefox" which gets the focus on the Firefox-window.
What if you send Ctrl+E to focus the search box and then Tab to move the focus to the document? Oh wait, that might clear the selection. This is a puzzle.
Ahaha, I'm so stupid! I wrote Sendkeys "^C" in my script because the letters on the keyboard are printed upper case! Like you wrote Ctrl+E in your last post. Well, in fact it's Ctrl+c or Ctrl+e, because Ctrl+C means Ctrl+Shift+c. All programs I tested my script on aren't case sensitive but Firefox is! In Firefox there are Ctrl+Shift shortcuts. I changed my script and now it's working!
Thank's a lot for your time and help!