That leaves the option of adding a button into the page or defining a keyboard shortcut (with the potential for a conflict if it's not unique). Javascript:function%20fwbr(str)%("") y.document.close() void%200 Īs for doing a userscript, what kind of user interface are you looking for? It's not so convenient to use the "monkey menu" and I am not aware of a way to integrate with the right-click context menu. To install a bookmarklet, copy the code, then right-click your Bookmarks Toolbar and choose New Bookmark, paste the code in Location, and give it a name like ListLinks. This deals with secure and non-secure URLs, anything else leaves an empty cell in the new column.Hmm, I found an old bookmarklet I created 8 years ago. Set value of cell nuCellAddress to nuCellContent -place trimmed URL in cell to rightĪgain select the column containing the hyperlinks before running the script. If cellContent begins with "http:" then set nuCellContent to text 8 thru -1 of cellContent If cellContent begins with "https:" then set nuCellContent to text 9 thru -1 of cellContent Set cellContent to value of eachCell - get the cell value as a string, parse the string to extract the URL Set nuCellContent to "" -non-matching and empty cells are skipped Tell document 1 to tell active sheet to set activeTable to first table whose selection range's class is range - define our working area But give it a try, and post back with screen shots if you have problems.ĪDD: If the hyperlinks are just pasted text, rather than HYPERLINK() formulae, it gets a bit simpler: It will probably throw other errors that I can't envisage. It will almost certainly throw errors if you select cells without hyperlinks, or select multiple columns. Set value of cell nuCellAddress to trimmedHyperlink2 -place trimmed URL in cell to right Set nuCellAddress to nuColumnName & nuCellRow Tell activeTable -find address of cell to right of original cell Set trimmedHyperlink2 to text item 1 of trimmedHyperlink1 - chop off the back, result is the clean URL Set AppleScript's text item delimiters to "\"," - first characters after clean URL Set trimmedHyperlink1 to text item 2 of theFormula - chop off the front chunk Set AppleScript's text item delimiters to "=HYPERLINK(\"" - front chunk Tell application "Numbers" to set theFormula to formula of eachCell - get the formula as a string, parse the string to extract the URL Set nuColumn to (add column after item 1 of theColumn) - create a new column in which to place the URLS Set theColumn to column of selection range Set theCells to cells of selection range - get a list of the selected cells It doesnt matter whether the URL is linked to a label in a cell using the. Tell activeTable - get information from the active table Without using Google Apps Script, you can extract URLs in Google Sheets. Tell document 1 to tell active sheet to set activeTable to first table whose selection range's class is range - define the working area Set AppleScript's text item delimiters to "" - clear existing tids Here's a column of hyperlinks, first formula displayed: I suspect there are slightly less convoluted ways of doing this, but there's currently a bug in the AppleScript implementation of 'selection range' which makes things a bit more cumbersome, and it's late on a Saturday night. If you do this often you can consider putting the script in the script menu.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |