randomfox (randomfox) wrote,
randomfox
randomfox

K-Meleon/Lua: Generate a Geobloggers geotag from a Topozone URL

Right-click on a Topozone link and select the geotag item in the popup menu to generate a Geobloggers geotag for pasting into "Add a tag" at Flickr.

The status bar will display the result of the macro.

function GeoTag(hwnd)
    id(hwnd, "ID_COPY_LINK_LOCATION")
    local link = getclipboard()
    local s, replcount = string.gsub(link, ".-(%d+%.%d+).-(%-%d+%.%d+).*", "geotagged geo:lat=%1 geo:lon=%2", 1)
    if replcount > 0 then
	setclipboard(s)
	SetStatusBarText("Clipboard set to: " .. s)
    else
	SetStatusBarText("Can't generate geotag for this link")
    end
end


In menus.cfg:

Link{
.
.
.
%ifplugin luamacros
luamacros(GeoTag, GeoTag from Link)
%endif
.
.
.
}
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments