2010년 11월 22일 월요일

예제로 보는 RainMeter -9- Stock정보 나타내기



주식정보를 업데이트 하는 사이트에서 값을 받아오는 Skin입니다.  받아오는 사이트는 http://www.quote.com/ 입니다.

 

그다지 크게 어려운 점은 없고, 해외사이트다 보니 표기가 소수점 두째자리가지인데 국내 주식경우 최소 단위가 1원이므로 개별주가에서 소수단위를 Substitute 명령어로 공백으로 치환하는 트릭을 썼습니다.

;  #############################################################################
; #  Portfolio Watch                                                            #
;#  Adapted from Rainy Droplet by GhostMatrix:  Code Name: Yo-yo                 #
;#  http://www.rainmeter.net/forum/viewtopic.php?f=15&t=317                      #
;#  Original idea from dick.fickling                                             #
; #  http://www.rainmeter.net/forum/viewtopic.php?f=5&t=287                     #                                         
;  #############################################################################
[Rainmeter]
Author=PPBorlz, modified by Shiva
AppVersion=0.2
Update=1000
;Metadata added by RainBrowser
;http://rainmeter.net/RainCMS/?q=Rainmeter101_AnatomyOfASkin
[Variables]
Update_Spd=600
Colour=255,255,255,220
UpColour=200,50,50
DownColour=0,128,255
FontName=Bauhaus-Thin
FontHeight=10
YGap=34r
Number1=Dow Jones
Number2=S&P 500
Number3=KOSPI
Number4=
Quote1=http://www.quote.com/us/stocks/quote.action?s=$INDU
Quote2=http://www.quote.com/us/stocks/quote.action?s=$SPX
Quote3=http://www.quote.com/global/stocks/quote.action?s=%24KOSPI-IDX
Quote4=
;*******************************
;# MEASURES
[InfoStock1]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=#Quote1#
;망할놈의 블로거 에디터는 xmp태그도 잘 안 먹는군요. 환장하겠다는...
;웹파저가 참조하는 URL정보는 원본을 확인하시기 바랍니다.
;http://www.customize.org/rainmeter/skins/70454
RegExp="(?siU)http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">(.*)class="time_stamp">(.*)\r\n(.*)\r\n(.*)
(.*)
(.*)

  • (.*)


  • (.*)
    (.*)(.*)(.*)(.*)...(.*)(.*)(.*)(.*)(.*)(.*)(.*)
    (.*)(.*)(.*)(.*)(.*)(.*)(.*)(.*)(.*)(.*)(.*)(.*)(.*)(.*)(.*)
    (.*)(.*)(.*)(.*)(.*)
    (.*)(.*)(.*)(.*)(.*)"
    StringIndex=1
    UpdateRate=#Update_Spd#
    Debug=0
    [MeasureStock_1]
    Measure=Plugin
    Plugin=Plugins\WebParser.dll
    Url=[InfoStock1]
    StringIndex=8
    [MeasureStock_2]
    Measure=Plugin
    Plugin=Plugins\WebParser.dll
    Url=[InfoStock1]
    StringIndex=13
    [MeasureStock_3]
    Measure=Plugin
    Plugin=Plugins\WebParser.dll
    Url=[InfoStock1]
    StringIndex=25
    Substitute="-":""
    [MeasureStock_5]
    Measure=Plugin
    Plugin=Plugins\WebParser.dll
    Url=[InfoStock1]
    StringIndex=24
    Substitute="negative_data":"-1","positive_data":"0"
    [CheckChange1]
    Measure=Calc
    Formula=[MeasureStock_5]
    IfBelowValue=0
    IfBelowAction=!execute [!RainmeterHideMeter LabelStock3Up][!RainmeterHideMeter LabelStock3Plus][!RainMeterShowMeter LabelStock3Down][!RainMeterShowMeter LabelStock3Minus]
    IfEqualValue=0
    IfEqualAction=!execute [!RainmeterHideMeter LabelStock3Down][!RainMeterHideMeter LabelStock3Minus][!RainMeterShowMeter LabelStock3Up][!RainmeterShowMeter LabelStock3Plus]
    DynamicVariables=1
    ;==================================
    .
    .
    (생략)
    [MeasureStock4_1]
    Measure=Plugin
    Plugin=Plugins\WebParser.dll
    Url=[InfoStock4]
    StringIndex=8
    [MeasureStock4_2]
    Measure=Plugin
    Plugin=Plugins\WebParser.dll
    Url=[InfoStock4]
    StringIndex=13
    ;국내주가는 원단위이므로 0.00까지 표현되는 것을 막기 위해 .00문자값을 null로 치환한다
    Substitute=".00":""
    .

    (생략)
    .
    DynamicVariables=1
    ;*************************************
    ;# METERS
    [TitleBackground]
    ;그라디언트배경
    Meter=IMAGE
    X=0
    Y=0
    W=220
    H=20
    SolidColor1=0,0,0,30
    SolidColor2=0,0,0,100
    GradientAngle=180
    HIdden=0

    [Title]
    Meter=String
    Text="TODAY's STOCK"
    X=4
    Y=5
    W=200
    ClipString=0
    StringStyle=BOLD
    FontFace=#FontName#
    FontColor=#Colour#
    FontSize=12
    ;StringEffect=SHADOW
    ;LeftMouseDownAction=
    AntiAlias=1
    [LabelStock1]
    MeasureName=MeasureStock_1
    Meter=STRING
    X=5
    Y=25r
    StringStyle=Bold
    StringAlign=LEFT
    ;StringEffect=Shadow
    FontColor=#Colour#
    FontSize=#FontHeight#
    FontFace=#FontName#
    Text=#Number1#
    LeftMouseDownAction=#Quote1#
    Antialias=1
    [LabelStock2]
    MeasureName=MeasureStock_2
    Meter=STRING
    X=150r
    y=0r
    StringStyle=Bold
    StringAlign=RIGHT
    ;StringEffect=Shadow
    FontColor=#Colour#
    FontSize=#FontHeight#
    FontFace=#FontName#
    NumOfDecimals=0
    AutoScale=1
    Text="%1"
    Antialias=1
    [LabelStockSpace]
    Meter=String
    x=50r
    y=-15r
    StringStyle=NORMAL
    StringAlign=RIGHT
    FontColor=#Colour#
    FontSize=(#FontHeight#-2)
    FontFace=#FontName#
    Text=" "
    [LabelStock3Plus]
    Meter=STRING
    X=-40r
    y=17r
    StringStyle=BOLD
    StringAlign=LEFT
    StringEffect=Shadow
    FontColor=#UpColour#
    FontSize=(#FontHeight#-2)
    FontFace=#FontName#
    Text="+"
    Antialias=1
    Hidden=0
    [LabelStock3Up]
    MeasureName=MeasureStock_3
    Meter=STRING
    X=8r
    y=-14r
    StringStyle=BOLD
    StringAlign=LEFT
    StringEffect=Shadow
    FontColor=#UpColour#
    FontSize=(#FontHeight#-2)
    FontFace=#FontName#
    Text="%1"
    Antialias=1
    Hidden=0
    [LabelStock3Minus]
    Meter=STRING
    X=-8r
    y=8r
    StringStyle=BOLD
    StringAlign=LEFT
    StringEffect=Shadow
    FontColor=#DownColour#
    FontSize=(#FontHeight#-2)
    FontFace=#FontName#
    Text="_"
    Antialias=1
    Hidden=1
    [LabelStock3Down]
    MeasureName=MeasureStock_3
    Meter=STRING
    X=8r
    y=-8r
    StringStyle=BOLD
    StringAlign=LEFT
    StringEffect=Shadow
    FontColor=#DownColour#
    FontSize=(#FontHeight#-2)
    FontFace=#FontName#
    Text="%1"
    Antialias=1
    Hidden=1
    ;----------------------------------

    댓글 없음:

    댓글 쓰기