Last active
April 26, 2021 15:50
-
-
Save JoeGlines/74013a31b498d655f84ce894bb0c0ed1 to your computer and use it in GitHub Desktop.
Rip options from drop down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;******************************************************* | |
; Want a clear path for learning AutoHotkey; Take a look at our AutoHotkey Udemy courses. They're structured in a way to make learning AHK EASY | |
; Right now you can get a coupon code here: https://the-Automator.com/Learn | |
;******************************************************* | |
#SingleInstance, Force | |
#NoEnv | |
OuterHTML= | |
( | |
<SELECT id=filterList name=linkId><OPTION selected value="1">Everything</OPTION><OPTION value="3">Technical documents</OPTION><OPTION value="13">Support</OPTION><OPTION value="5">Applications</OPTION><OPTION value="6">E2E Forums</OPTION><OPTION value="7">Blogs</OPTION><OPTION value="9">Design network</OPTION><OPTION value="11">Training</OPTION><OPTION value="12">Videos</OPTION><OPTION value="10">Developer wiki</OPTION></SELECT> | |
) | |
gui, font, s10 , Verdana ; Set 10-point Verdana. | |
Gui, add, Edit, vOuterHTML cBlue x0 y40 r40 w700, %OuterHTML% | |
Gui, Add, Button, x550 y10 Default, Run | |
Gui, Submit, NoHide | |
Gui, Show,h600 w700, Values | |
return | |
;******************************************************* | |
ButtonRun: | |
Gui, Submit ;,NoHide | |
gosub Get_OuterHTML | |
Gosub Display_Keys_and_Values | |
return | |
GuiEscape: | |
GuiClose: | |
ButtonCancel: | |
ExitApp | |
Gui, Destroy | |
Return | |
Get_OuterHTML: | |
StringReplace, OuterHTML, OuterHTML, ,, All ;removing html spaces | |
OuterHTML:= RegExReplace(OuterHTML,"i).*?<option.*?value=""?(?P<Key>.+?)""?>(?P<Value>.+?)</option>(\s+)?((?=<option)|.*$)", "${Key}`t${Value}`n") ;named | |
return | |
Display_Keys_and_Values: | |
Gui, New | |
Gui, Add, ListView, r40 w430 gMyListView, Key|Value | |
clipboard:="" | |
Loop, parse, OuterHTML, `n,`r | |
{ k := A_LoopField | |
StringSplit, form, k, %A_Tab% | |
LV_Add("",Form1,Form2) | |
clipboard.=Form1 a_tab Form2 "`n" | |
} | |
LV_ModifyCol(1,"50 ") ;Count | |
LV_ModifyCol(2,"350 ") ;Count | |
Gui, Show,, Keys and Values from Form ;display the gui | |
return | |
;******************************************************* | |
MyListView: | |
if A_GuiEvent = DoubleClick | |
{ RowNumber = 0 ; This causes the first loop iteration to start the search at the top of the list. | |
Loop | |
{ RowNumber := LV_GetNext(RowNumber) ; Resume the search at the row after that found by the previous iteration. | |
if not RowNumber ; The above returned zero, so there are no more selected rows. | |
break | |
LV_GetText(Key, RowNumber,1) ;copy first column | |
LV_GetText(Value, RowNumber,2) ;changed to copy second column | |
AllSelect.=Key "`t" trim(Value) "`n" | |
} | |
NewList.=AllSelect . "`n" | |
} | |
MsgBox,,Copied to clipboard, % Clipboard:=NewList | |
newlist:="" | |
Key:="" , Value:="" , AllSelect:="" | |
return | |
Browser_Forward::Reload |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment