Find the answer to your Linux question:
Results 1 to 9 of 9
When I attempt to extract some web pages there are far too many jscript functions and html encodiings. Hence, I can manually search the page, perform select all (^A), copy ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User
    Join Date
    Mar 2008
    Posts
    287

    Sending shortcuts


    When I attempt to extract some web pages there are far too many jscript functions and html encodiings. Hence, I can manually search the page, perform select all (^A), copy (^C) it, open a prepared file (^O), but cannot figure how to paste it (&V).
    I want to do this from a bash script. I know how to do the search. Now how do I send these shortcuts (especially ctrl-C) to Firefox. Once I have the page copied to the clipboard, I think I can figure out how to open a file and save the clipboard to a file using bash script on the Linux side.
    Question, how do I send shortcuts to Firefox? Is this done with the hex equivalent of the keystrokes?

  2. #2
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    773
    You certainly bump your head for nothing. As I understood your milestone object, you would be perfectly fine with wget.

  3. #3
    Linux User
    Join Date
    Mar 2008
    Posts
    287

    Sending shortcuts

    I don't thinks so. I have already pulled it down with wget but what it returns has javascript function calls apparently and the text I seek is apparently printed from one or more of those function. Hence, copying the text with shortcuts does work for me manually but what I currently do not have is a way to cause the browser to copy the text into a file. I need that done from a Bash (shell) script.
    It might be possible to send the commands from one terminal to the terminal where the browser is running, if I knew how to do that. My recollection is, there is a need to know the terminal ID and display numbers.

  4. #4
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    773
    I would not rely on a browser like firefox for correct functionality. Basically you just need a html processor that also executes the jscript stuff. Maybe lynx can do what you need.

  5. #5
    Linux Newbie previso's Avatar
    Join Date
    Jan 2010
    Location
    SC
    Posts
    116
    The more I read this, the clearer your question becomes. You want to grab hyperlinks from the web page and open them in Firefox?

    How is this?: Code Examples -> Grab links from a page

    Or this?: Grab a web page and report all links - Tcl example

  6. #6
    Linux User
    Join Date
    Mar 2008
    Posts
    287

    Sending shortcuts

    Need to use Firefox as Lynx does not provide the data of interest.
    Do not need hyperlinks. I know how to get those anyway.
    What I want is the "text" provided to the user by the browser's presentation on the screen.
    The way I see to get this is by sending shortcuts recognized by the browser to the browser.
    These would be "select all" (Ctrl+A) followed by "copy" (Ctrl+C). This would put the text on the clipboard where I could use "paste" in the script to place it in a file prepared for receiving same.
    I do not know how to address the virtual terminals of a workstation nor how to send a command from one workspace to another workspace (which I am presuming to be virtual terminals).
    Last edited by clickit; 09-01-2010 at 04:49 AM.

  7. #7
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    773
    Read how keyloggers work. You may be able to hook a key producer into your application. Basically you would there have an application that works kind of a HAL to the software such that you can take influence on that layer. Maybe you can do it with gdb: Debugging with gdb - Command Line Editing

  8. #8
    Linux User
    Join Date
    Mar 2008
    Posts
    287

    Sending shortcuts

    Keylogger will read the key pressed alright and use of the debugger would assist in getting a code for the keys pressed. I would need either the scan code or key code which I don't recall of the top.
    That still begs the question of how to direct the code to the workspace/virtual terminal containing the browser output. Do you know how to do that?

  9. #9
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    773
    You completely misread my post. You can use the debugger to produce key events for the debugged application. It should demonstrate you how this specific kind (debugger) of HAL (hardware abstraction layer) looks. gdb can produce and send key commands to the debugged application because for the application the "computers hardware" is the debugger. So this is what a HAL is. Have you followed the link I posted before? There is written how gdb can be triggered to produce the key events. And at this point you either try to get gdb doing what you want from it or find / write another HAL application that enables you to send key events to your application.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •