#PomeraTo.mscr ver.2009.05.05 #################################### #テキストファイル(*.txt)を読み込み、クリップボードへコピーするスクリプト。 #ポメラ(DM10)のテキストファイルをmicroSD経由でWindowsMobile機の #クリップボードへコピーします。その他もろもろ。 # #WILLCOM 03(WS020SH)で動作確認 # #2009/05/05 MackyBlogPocket起動 #2009/05/02 直近のバックアップZIPは残す #2009/05/01 PC対応 #2009/04/30 バックアップ時にLive Mesh起動,圧縮機能追加 #2009/04/20 初版(Evernote起動) # ############################################################### p="" p0="\POMERA" p3="\pomera.zip" p4=systempath("ScriptPath") \ "\Autorun.ini" s0="" s1="1:最新保存分をクリップボードへ" s2="2:ファイルを選択しクリップボードへ" s3="" s4="" s5="*:終了" d="" hit=0 ############################################################### if(systemversion("platform") eq "WinCE") v="mobile" else v="PC" endif if(v eq "mobile") e="\Program Files\Evernote\Evernote3\Evernote.exe" e1="\Program Files\Live Mesh\mobmoe.exe" p1="\リムーバブル ディスク" \ p0 p2="\microSDカード" if(direxists(p1)>0 && direxists(p2)>0) s3="3:バックアップ(リムーバブルディスク→microSDカード)" endif p2=p2 \ p0 wd="MackyBlogPocket" e2="\Program Files\MackyBlogPocket\MackyBlogPocket\MackyBlogPocket.exe" if(fileexists(e2)>0) s4="4:最新保存分をblog投稿" endif e3="\Program Files\KOTETU\EasyDial.exe" else e="" e1="" p1=part(systempath("ScriptPath"),"\",1) \ p0 p2=iniread(p4,"Backup","Path") if(p2 eq "" || direxists(p2)=0) call("bkp") endif if(direxists(p1)>0 && direxists(p2)>0) call("bkf") endif endif if(p2 eq "") message("バックアップ先が指定されませんでした。","PomeraTo") s4="*:バックアップ先の設定" endif w=0 ############################################################### while(1) choice("PomeraTo","PomeraTo for " & v,s1,s2,s3,s4,s5) case(1) call("clip") call("evnc",p \ "\" \ d[hit]) case(2) f=selectfile("PomeraTo",false,"*.txt","選択してください") call("evnc",f) case(3) if(s3 eq "") exit endif b=0 while(b=0) d=dircontents(p2 \ "\*.txt",DC_FILES) m=maxindex(d) if(m>0) s0="3:バックアップ先のtxt削除" else s0="" endif choice("PomeraTo","PomeraTo for " & v,"1:バックアップ(圧縮ナシ)","2:バックアップ(圧縮アリ)",s0,"*:戻る") case(1) call("bku") xcopy(p1 \ "\*.txt",p2,true) call("mesh") case(2) call("bku") if(v eq "mobile") rename(p2 \ p3,p2 \ part(p3,".",1) & "_bak.zip") zipfiles(p1 \ "\*.txt",p2 \ p3) else zipfiles(p1 \ "\*.txt",p2 \ part(p3,".",1) & "_" & formattime("YmdHi",timestamp()) & ".zip") endif call("mesh") case(3) if(s0 ne "") q=question("バックアップ先のtxtファイルを^NL^削除しますか?","PomeraTo","OkCancel") if(q=YES) delete(p2 \ "\*.txt") endif endif case(4) b=1 case(0) b=1 endchoice endwhile case(4) if(v eq "mobile") call("clip") call("blog",p \ "\" \ d[hit]) if(procexists(wd & ".exe")=TRUE)   show(wd) endif else p2="" call("bkp") endif case(5) exit endchoice endwhile exit ############################################################### sub clip p=p1 if(direxists(p1)=0) p=p2 if(direxists(p2)=0) message("POMERAフォルダがありません","PomeraTo") exit endif if(fileexists(p2 \ p3)=YES) unzipall(p2 \ p3,p2) endif endif d=dircontents(p & "\*.txt",DC_FILES) m=maxindex(d) call("fts",p \ d[m]) wk=w hit=m for i=m to 1 step -1 call("fts",p \ d[i]) if(w>wk) wk=w hit=i endif next endsub ############################################################### sub bkf s3="3:バックアップ(→ " & p2 & ")" s4="*:バックアップ先の変更" endsub ############################################################### sub bku q=question("バックアップを開始してよいですか?","PomeraTo","OkCancel") if(q=CANCEL) exit endif if(direxists(p2)=0) mkdir(p2) endif endsub ############################################################### sub bkp b=0 while(b=0) choice("PomeraTo","PomeraTo for " & v & " 初期設定","1:バックアップ先(フォルダ追加)","2:バックアップ先(フォルダ選択)","*:戻る") case(1) q=question("フォルダを追加しますか?","PomeraTo","OkCancel") if(q=YES) t0=selectdirectory("PomeraTo","フォルダの作成先を選択してください") t1=input("フォルダ名を入力してください","PomeraTo",false,false,part(p0,"\",2)) p2=t0 \ t1 if(direxists(p2)=0) mkdir(p2) endif else call("ini0") endif call("ini1") case(2) call("ini0") call("ini1") case(3) b=1 endchoice endwhile endsub ############################################################### sub ini0 p2=selectdirectory("PomeraTo","バックアップ先を選択してください") endsub ############################################################### sub ini1 if(p2 ne "") iniwrite(p4,"Backup","Path",p2) call("bkf") b=1 endif endsub ############################################################### sub fts w=filemodifytime(argv[1]) endsub ############################################################### sub evnc if(fileexists(argv[1])>0) c=readfile(argv[1]) setcliptext(c) if(fileexists(e)>0) q=question("クリップボードにCopyしました。^NL^Evernoteを起動しますか?","PomeraTo","OkCancel") if(q=YES) run(e) endif else message("クリップボードにCopyしました。","PomeraTo") endif endif endsub ############################################################### sub mesh if(fileexists(e1)>0) q=question("バックアップが終了しました。^NL^Live Meshを起動しますか?","PomeraTo","OkCancel") if(q=YES) run(e1) endif else message("バックアップが終了しました。","PomeraTo") endif endsub ############################################################### sub blog if(fileexists(argv[1])>0) l=readline(argv[1]) if(not isempty(l)) b1=l else b1="" endif b2="" l=readline(argv[1]) while(not isempty(l)) b2=b2 & l & "^NL^" l=readline(argv[1]) endwhile setcliptext(b1 & "^NL^"& b2) if(b2 ne "") b2=b2 & "^NL^^NL^(Written by Pomera " & formattime("Y/m/d H:i",timestamp()) & ")" endif if(fileexists(e2)>0) q=question("クリップボードにCopyしました。^NL^" & wd & "を起動しますか?","PomeraTo","OkCancel") if(q=YES) if(fileexists(e3)>0 && connected()=FALSE) run(e3) endif kill(e2) run(e2) waitfor(wd,60) sleep(2000) waitforactive(wd,120) sleep(2000) sendcr waitforactive(wd,15) call("cpp",b2) call("cpp",b1) sendtab sendkeys(wd,"ポメラ") endif else message("クリップボードにCopyしました。","PomeraTo") endif endif endsub ############################################################### sub cpp sendtab setcliptext(argv[1]) sendctrlkey(wd,"v") sleep(2000) endsub ###############################################################