Hi, is there any way one can trigger a certain keypress? Events can be triggered on page elements all right, like hovering, or clicking or double-clicking, etc. But say, I want to trigger the keypress of the return key after some event. Is it possible to do so in jQuery?
Triggering a particular keypress
Page 1 of 16 Replies - 3284 Views - Last Post: 29 March 2011 - 02:01 PM
Replies To: Triggering a particular keypress
#2
Re: Triggering a particular keypress
Posted 29 March 2011 - 01:22 PM
cupidvogel, on 29 March 2011 - 12:28 PM, said:
Hi, is there any way one can trigger a certain keypress? Events can be triggered on page elements all right, like hovering, or clicking or double-clicking, etc. But say, I want to trigger the keypress of the return key after some event. Is it possible to do so in jQuery?
No, you can't simulate that with Javascript.
If you want to update the value of a textarea, or something similar, you can put in a new line character.
Your best bet is to use a desktop application. AutoIt is rather easy to get the hang of.
#3
Re: Triggering a particular keypress
Posted 29 March 2011 - 01:37 PM
Oh no. I needed it badly. Do you think it is possible to do so, by say some hardcore coding?
#4
Re: Triggering a particular keypress
Posted 29 March 2011 - 01:41 PM
Not with Javascript. We could probably help you find a work around if you posted up what you are actually trying to accomplish.
#5
Re: Triggering a particular keypress
Posted 29 March 2011 - 01:50 PM
I want to auto-bookmark a huge number of, say 500 links on a page. I have recently switched browsers, and before that I exported all my bookmarks to a HTML file. Now what I have to do to import them to my new browser (Firefox 4) is to open that page, click each link, bookmark the page that opens, get back to the original page, click the next link, blah blah blah for 500 times. Then it struck me, if I run a script with the page being loaded, where each link is auto-triggered to click (that is possible, of course), in the new page, simulate CTRL+D (shortcut for bookmarking), simulate Backspace to return to the previous page, where the next link is triggered to click automatically, and the process will go on until all the links have been bookmarked automatically after the HTML file is opened in the browser. Looked like a pretty cool idea. But now you tell me that I can't simulate a single keypress, let alone two (for CTRL+D, I thought I would first simulate CTRL, then let D fall into a queue, where the Boolean queue would be set to FALSE to make the two keypresses simultaneous.).
#6
Re: Triggering a particular keypress
Posted 29 March 2011 - 01:58 PM
cupidvogel, on 29 March 2011 - 01:50 PM, said:
I want to auto-bookmark a huge number of, say 500 links on a page. I have recently switched browsers, and before that I exported all my bookmarks to a HTML file. Now what I have to do to import them to my new browser (Firefox 4) is to open that page, click each link, bookmark the page that opens, get back to the original page, click the next link, blah blah blah for 500 times. Then it struck me, if I run a script with the page being loaded, where each link is auto-triggered to click (that is possible, of course), in the new page, simulate CTRL+D (shortcut for bookmarking), simulate Backspace to return to the previous page, where the next link is triggered to click automatically, and the process will go on until all the links have been bookmarked automatically after the HTML file is opened in the browser. Looked like a pretty cool idea. But now you tell me that I can't simulate a single keypress, let alone two (for CTRL+D, I thought I would first simulate CTRL, then let D fall into a queue, where the Boolean queue would be set to FALSE to make the two keypresses simultaneous.). 
Firefox lets you restore/backup your bookmarks. I know the older formats Firefox used HTML, I'm not sure if there was some format, but you should just try going to your bookmarks ( CTRL+SHIFT+B ) -> "Import and Backup" -> "Import HTML"
You can't do this with Javascript, but you could do something like this with desktop applications like I mentioned before.
This post has been edited by BlaineSch: 29 March 2011 - 01:59 PM
#7
Re: Triggering a particular keypress
Posted 29 March 2011 - 02:01 PM
Will do. Ambitious hopes dashed to ground
. Thanks though..
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|