0

I am trying to pull multiple values from a webpage by either reorganizing the css of a webpage or a copy to clipboard short cut to send the values straight to clipboard.

<fieldset id="property_info">
    <legend>Property Information</legend>
        <table id="prop_table">
            <tbody>
                <tr>
                    <td><label for="street_num">Street Num</label></td>
                    <td><input name="form[street_num]" id="street_num" class="required" value="1223" type="text"></td>
                    <td><input name="form[address1]" id="address1" class="required" value="CABRILLO PARK" type="text"></td>

for example with out having to highlight the value on the page is there a way I can send the value of "1223" and also the value "CABRILLO PARK" at the same time to my clipboard with autohotkey or anything else? Either that or rearrange the css?

  • What has this got to do with CSS? – mbx-mbx Aug 28 '14 at 13:47
  • @Magrangs the id property info is the class, I was wondering if the css can be arranged to throw all of the input values to clipboard at once? Also I'm not too aware of even if that's possible this is why im asking the question this boggles my simple mind. – Nicholas lane Aug 28 '14 at 13:50
  • Ok... why would you want to do that? Sounds a bit of a weird thing to do! – mbx-mbx Aug 28 '14 at 13:53
  • I have to visit the same style sheet over a hundred times a day and copy 5 values from text inputs so, I am looking for a way to just hit copy to clip board to speed up the process and copy all 5 items at once. @Magrangs – Nicholas lane Aug 28 '14 at 13:57
  • Out of interest, what is done with these values afterwards? You can easily get these values out of the HTML with javascript and do whatever you want with them (within reason). Do they go into another system or something? – mbx-mbx Aug 28 '14 at 13:59
  • @Magrangs I am just pasting the plain text into email. I just have to get certain values out to make the subject line of the emails. – Nicholas lane Aug 28 '14 at 14:07
  • @Magrangs also how would you be able to preform this with javascript? – Nicholas lane Aug 28 '14 at 14:07
  • Well you have the id prop_table you can just do a simple jquery selector on that to select all inputs within it. e.g. http://jsfiddle.net/jtq0v3Lv/3/. Ideally though, this should be automated process which goes through some kind of service to perform the task of sending the emails. – mbx-mbx Aug 28 '14 at 14:23
  • p.s. I updated the fiddle to do something which resembles more what you want to do: http://jsfiddle.net/jtq0v3Lv/4/ – mbx-mbx Aug 28 '14 at 14:30
  • Do you understand what "CSS" and "stylesheet" mean? What do you mean by "arranging" the CSS? You say you "visit the same style sheet"--what style sheet are you referring to? –  Aug 29 '14 at 08:07

2 Answers2

0

Clipboards are tricky things. You're not allowed to do much with them in javascript, and it varies among browsers. See:

How do I copy to the clipboard in JavaScript?

Community
  • 1
  • 1
KIKO Software
  • 10,480
  • 2
  • 13
  • 28
0

For Autohotkey, (semicolon means commented):

!2::   ; !2 means alt 2, change convenient key combination
file_containing_example_html_you_posted:="http://www.autohotkey.com/docs/misc/Clipboard.htm" 
valueofthis:="value="""  ; double quotes means 1 quote, ending quote *is* required
clipboard_me_some_htmls(file_containing_example_html_you_posted,valueofthis,1)
return
clipboard_me_some_htmls(url,stringtofind,whichone)
{
    file:="here.html" ; website cached here to be read from, can be changed to file path, defaults to script directory
    ;UrlDownloadToFile, %url% , %file%
    fileread, htmls , %file%
    aquote:="""" ; two quotes means one quote
    StringGetPos, valuelocation,  htmls, %stringtofind%
    StringGetPos, quotelocation,  htmls, %aquote%,L%whichone%,%valuelocation% ; find immediate next quote
    StringMid, valuesvalue, htmls,% valuelocation+StrLen(stringtofind)+1, % quotelocation-valuelocation-2 ;get string between stringtofind and the next quote
    Clipboard:=valuesvalue ; press ctrl v afterwards and enjoy your saved time
}

Call the function with URL as the website you want to scan, keep stringtofind the same as it is now, and whichone is 1 for the first occurance and 2 for the second. In the example you gave that's 1 to put 1223 in clipboard and 2 to put CABRILLO PARK in clipboard.

gunfulker
  • 648
  • 5
  • 22
  • Note this is in no way a substitute for actually parsing html, if you have to do any **real** parsing in html you can do that in a separate program and run it from autohotkey to make use of the convenient clipboard and url loading functions. – gunfulker Aug 29 '14 at 08:04