Home > ポイント関連スクリプト
ポイント関連スクリプト Archive
楽天のポイント獲得履歴が仕様変更になったのでRspsumを修正しました
- 2012-02-04 (Sat)
- ポイント関連スクリプト
再び楽天のポイント獲得履歴の仕様が改悪変更されたので
楽天のポイント獲得履歴を集計するツール
Rspsum.uwsを修正しました。
もう2年も前のやつなんで、なんでこういう書方してるのか自分でもさっぱりわからなくて結構手間取りましたがなんとかw
あと、CSVでの保存もできるようにしときました。
- Comments: 1
- TrackBack (Close):
楽天のポイント獲得履歴を集計するツール
- 2010-07-09 (Fri)
- ポイント関連スクリプト
某氏が楽天のポイント獲得履歴を集計するツールがあると便利
とかいうので作ってみた。
※2010/9/14仕様変更があったので一部変更
※2011/1/14年度を跨いだ処理に問題があったのを修正したのと集計年度も選択できるようにした
※2012/2/4仕様変更があったので一部変更及び機能追加
・CSVでの保存もできるようにした
機能的には指定月度を各サービス事に集計し
ラッキーくじ当選など同一の物が複数あるものも集計する。
まぁ説明するより使ってみた方がわかり安いと思う。
ユーザー定義の部分にIDとパスを設定し起動し集計する月を選択するだけ。
注意:あんまり前の月を調査すると1ページ目から全部チェックするので時間がかかります。精々数ヶ月前までが無難かと。
Rspsum.uws(右クリックからダウンロード)
//--ユーザー定義 id="***" pass="***" csv_file_dir=GET_CUR_DIR //CSV保存先のディレクトリ指定(例はカレントディレクトリ) //csv_file_dir="" //CSV作成しない場合は空欄で //--初期設定 HASHTBL list HASHTBL content Public OkBtn dim total_k,total_l,total_c,yy,mm IE = CreateOLEObj("InternetExplorer.Application") IE.Visible = true dt=Gettime() y=G_TIME_YY4 m=G_TIME_MM //--集計月取得 IE.Navigate("about:blank") BusyWait(IE) doc=IE.document yy="<OPTION value="+y+" selected>"+y+"</OPTION>" yy=yy+"<OPTION value="+y+">"+(y-1)+"</OPTION>" for i=1 to 12 ifb i=m mm=mm+"<OPTION value="+i+" selected>"+i+"</OPTION>" else mm=mm+"<OPTION value="+i+">"+i+"</OPTION>" endif next HTML=HTML_s HTML=Chgmoj(HTML,"$_y_$",yy) HTML=Chgmoj(HTML,"$_m_$",mm) doc.write(HTML) OleEvent(doc.body.all["OkBtn"], "HTMLInputTextElementEvents2", "OnClick", "clk_OkBtn") Repeat Sleep(0.1) Until OkBtn=1 mon=IEgetdata(IE,"mon") year=IEgetdata(IE,"year") mon=VAL(mon) year=VAL(year) ifb !(csv_file_dir="") if copy(csv_file_dir,length(csv_file_dir))="\" then csv_file_dir=copy(csv_file_dir,1,length(csv_file_dir)-1) csv_file=csv_file_dir+"\"+year+"年"+mon+"月度ポイント獲得集計.csv" endif //--データ集計 IE.Navigate("https://www.rakuten.co.jp/myrakuten/login.html") sleep(1) BusyWait(IE) for i=0 to doc.all.tags("input").length-1 ifb pos(" 次へ ",doc.all.tags("input").item(i).value)>0 doc.all.tags("input").u.value=ID doc.all.tags("input").p.value=PASS clickIE(IE," 次へ ",1) sleep(1) IE.Navigate("https://point.rakuten.co.jp/history/") BusyWait(IE) break endif next next_page=1 While next_page>0 table=doc.getElementsByTagName("table") for i=0 to table.length-1 ifb table.item(i).rows(1).cells(0).innerText="利用日<#cr>獲得日" o_table=table.item(i) break endif next for i=3 to o_table.rows.length-1 o_row=o_table.rows(i) t_mon=val(Betweenstr(o_row.cells(0).innerText,"<#CR>","/")) //Msgbox(t_mon) t_year=val(copy(o_row.cells(0).innerText,0,4)) //Msgbox(t_year) ifb t_mon=mon key=o_row.cells(1).innerText //Msgbox(key) if !(list[key,HASH_EXISTS]) then list[key]="" for ii=2 to 5 text=o_row.cells(ii).innerText text=Chgmoj(text,"["+Betweenstr(text,"[","]")+"]","") text=Chgmoj(text,"(全て)","") list[key]=list[key]+text+"|" next list[key]=list[key]+"@" endif ifb t_year+copy("0"+t_mon,length("0"+t_mon)-2)<year+copy("0"+mon,length("0"+mon)-2) next_page=0 break endif next ifb next_page>0 if !(clickIE(IE,"次の30件 >",0)) then next_page=0 endif wend //--データテーブル作成 table_s="<table cellSpacing=0 cellPadding=0 border=1><tbody>";table_e="</tbody></table>" td="<td>";etd="</td>";tr="<tr>";etr="</tr>" htm=table_s+"<tr bgcolor=<#DBL>#66FFCC<#DBL>>"+td+"サービス"+etd+"<td width=300>"+"内容"+etd+td+"獲得ポイント"+etd+td+"利用ポイント"+etd+td+"データー数"+etd+etr for n = 0 to Length(list)-1 sum_k=0;sum_l=0;sum_c=0;num=0 str=list[n, HASH_VAL] Repeat item=Token("@",str) key=Token("|",item) if !(content[key,HASH_EXISTS]) then content[key]="" content[key]=content[key]+item+"@" Until str="" for nn = 0 to Length(content)-1 str2=content[nn, HASH_VAL] k_point=0;l_point=0;c_point=0 Repeat data=Token("@",str2) func=Token("|",data) p=Token("|",data) p=val(Chgmoj(p,"つぶやく","")) ifb p>0 k_point=k_point+p elseif p<0 l_point=l_point+p endif c_point=c_point+1 Until str2="" sum_k=sum_k+k_point sum_l=sum_l+l_point sum_c=sum_c+c_point num=num+1 ifb num=1 and nn=Length(content)-1 htm=htm+"<tr bgcolor=<#DBL>#FFFFCC<#DBL>>" else htm=htm+tr endif htm=htm+td+list[n, HASH_KEY]+etd htm=htm+td+content[nn, HASH_KEY]+etd htm=htm+td+k_point+etd+td+l_point+etd+td+c_point+etd+etr next ifb num>1 htm=htm+"<tr bgcolor=<#DBL>#FFFFCC<#DBL>>"+td+list[n, HASH_KEY]+etd htm=htm+td+"合計"+etd htm=htm+td+sum_k+etd+td+sum_l+etd+td+sum_c+etd+etr endif content=HASH_REMOVEALL total_k=total_k+sum_k total_l=total_l+sum_l total_c=total_c+sum_c next htm=htm+"<tr bgcolor=<#DBL>#FFCCFF<#DBL>>"+td+"総計"+etd htm=htm+td+" "+etd htm=htm+td+total_k+etd+td+total_l+etd+td+total_c+etd+etr htm=htm+table_e htm=head+"<p>"+mon+"月度集計結果</p>"+htm+"</body></html>" IE.Navigate("about:blank") BusyWait(IE) doc=IE.document doc.write(htm) ifb !(csv_file="") table_to_csv(doc.getElementsByTagName("table").item(0),csv_file) endif //------ Procedure BusyWait(ie) Sleep(0.5) // Wait Const TIME_OUT = 90 tm = Gettime() repeat Sleep(0.2) ifb Gettime() - tm > TIME_OUT MsgBox("Time Out:BusyWait") ExitExit endif until (! ie.busy) and (ie.readyState=4) Sleep(0.5) Fend //------ Function clickIE(IE,c_str,c_type) Result=false doc=IE.document Select c_type case 0 //link for i=0 to doc.links.length-1 ifb pos(c_str,doc.links(i).innerText)>0 doc.links(i).click() Result=true Break endif next BusyWait(IE) case 1 //btn for i=0 to doc.all.tags("input").length-1 ifb pos(c_str,doc.all.tags("input").item(i).value)>0 doc.all.tags("input").item(i).click() Result=true Break endif next BusyWait(IE) Selend Fend TextBlock HTML_s <form> <font color="#FF0000" size="2">集計年度を選択してください</font><BR> <SELECT name="year"> $_y_$ </SELECT> <font size="2"> 年 </font> <font color="#FF0000" size="2">集計月を選択してください</font><BR> <SELECT name="mon"> $_m_$ </SELECT> <font size="2"> 月 </font> <input type="button" value=" OK " name="OkBtn"> </form> EndTextBlock TextBlock head <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="ja"> <head> <meta name="robots" content="nofollow" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <style TYPE="text/css"> <!-- * { margin: 10px; padding: 2px; font-size:12px; font-family: ms ui gothic,arial,helvetica; color: #444; } body{ background-color:#fffff1; } --> </style> </head> <body> EndTextBlock //-- Procedure clk_OkBtn() OkBtn=1 Fend //-- Procedure table_to_csv(table,file) fid=Fopen(file,F_READ or F_WRITE) for i=0 to table.rows.length-1 for ii=0 to table.rows(i).cells.length-1 Fput(fid,table.rows(i).cells(ii).innerText,i+1,ii+1) next next Fclose(fid) fend
楽天の携帯メルマガ定期解除スクリプト
- 2010-05-05 (Wed)
- ポイント関連スクリプト
楽天の携帯メルマガがPCからでも一括配信解除が可能になったのでUWSCで自動解除するやつ作った。
これをUWSCのスケジュールかWinのタスクで設定してやればよし。 ちなみにこのスクリプトで解除するのはショップの分だけです。
このスクリプトをちょこっと改編すればPC版もつくれるのでお試しを ログイン認証画面の次の画面でPCはこちらでみたいなボタンがあるので それをクリックしてやればよし。
それとIEのクリックはどれも同じようなやつなのでclickIEという関数をこしらえた。こういうのを作って置けばスクリプト書く手間も省ける。 画像クリックとかjavascript系のリンクとかもcaseを増やしていけば拡張できる(今回はまだ書いてない)
6/14追記:ログインフォームが変ったみたいなので若干修正した
CONST ID = "***" //楽天のID CONST PASS = "***" //楽天のパスワード CONST E_MAIL="***" //携帯メールアドレス IE = CreateOLEObj("InternetExplorer.Application") IE.Visible = true IE.Navigate("http://emagazine.rakuten.co.jp/ns?act=chg_data") BusyWait(IE) doc=IE.document doc.getElementsByName("email").item(0).value = E_MAIL clickIE(IE,"送信",1) clickIE(IE,"こちらから配信停止できます。",0) ifb pos("ログイン",IE.LocationName)>0 doc.all.tags("input").u.value=ID doc.all.tags("input").p.value=PASS clickIE(IE,"ログイン",1) endif clickIE(IE,"すべてのショップメルマガを配信停止する",0) clickIE(IE,"配信停止する",1) IE.quit //------ Procedure BusyWait(ie) Sleep(0.5) // Wait Const TIME_OUT = 90 tm = Gettime() repeat Sleep(0.2) ifb Gettime() - tm > TIME_OUT MsgBox("Time Out:BusyWait") ExitExit endif until (! ie.busy) and (ie.readyState=4) Sleep(0.5) Fend //------ Procedure clickIE(IE,c_str,c_type) doc=IE.document Select c_type case 0 //link for i=0 to doc.links.length-1 ifb pos(c_str,doc.links(i).innerText)>0 doc.links(i).click() Break endif next BusyWait(IE) case 1 //btn for i=0 to doc.all.tags("input").length-1 ifb pos(c_str,doc.all.tags("input").item(i).value)>0 doc.all.tags("input").item(i).click() Break endif next BusyWait(IE) Selend Fend
Home > ポイント関連スクリプト
- Search
- Meta
- Links
- Feeds
- PR
- PR