代码之家  ›  专栏  ›  技术社区  ›  Tangiest

自动将网页上的价格转换为其他货币

  •  1
  • Tangiest  · 技术社区  · 16 年前

    我感兴趣的可能方法,自动转换价格时,一个网页是从给定的货币加载到指定的货币。理想情况下,这种转换还将利用当前汇率给出有效的价格。

    例如,在我的具体案例中,我想将此表中给出的以欧元()表示的价格进行换算 web site 兑换英镑()。

    我正在考虑使用GreaseMonkey脚本进行此转换,但是有人能建议其他方法吗?

    谢谢,马吉坎迪。

    3 回复  |  直到 16 年前
        1
  •  1
  •   wilsonpage    15 年前

    http://thecurrencygraph.com

    它使用地理位置脚本来检测用户的国家,并通过该国家检测他们的本币。然后用最新的汇率将你的价格转换成他们的货币

    希望这有帮助!

    W

        2
  •  1
  •   SouthStExit    16 年前

    自从我涉足 AutoHotkey httpQuery library

    #Include httpQuery.ahk
    
    InputBox, n, EUR to GBP, Enter the number., , 150, 120
    if (ErrorLevel || !n)
        return
    url :=  "http://www.xe.com/ucc/convert.cgi?Amount=" n "&From=EUR&To=GBP&image.x=55&image.y=8"
    html := URLDownloadToVar(url)
    Gui, Add, Edit, w125, % RegExMatch(html,"[\d\.]+(?= GBP)",m) ? m "£" : "The value could not be retrieved."
    Gui, Show, AutoSize Center, GBP
    VarSetCapacity(html,0)
    Return
    
    GuiClose: 
    GuiEscape: 
    Gui, Destroy
    return
    
    URLDownloadToVar(url){ 
        if !RegExMatch(url,"^http://") 
            url :=  "http://" url 
        httpQuery(html,url) 
        VarSetCapacity(html, -1) 
        Return html 
    }
    

    显然,有更彻底(和复杂)的方法来解决这个问题,但这至少解决它与最小的努力。

        3
  •  0
  •   Tangiest    16 年前

    简单快捷的方法是使用Firefox插件。有许多货币转换器作为附加组件提供,但我最终使用 Exch ,因为它最适合我的需要。