#http://www.ac-promenade.net/text/windowsmobile/ #Scripted by AC-Promenade http://www.ac-promenade.net/ #SHARPカメラ・サポートHB #ShCamera_Sp_HB.mscr #"カメラ"のサイズ等各設定を登録し事前選択起動できるMortScript。 #設定により撮影後、自動で任意の画像ビューア等も起動できます。 #●使用方法概要 #・予め本mscrにプリセット設定を記述しておきます。(詳細は後述) #・本mscrを実行すると、前回設定とプリセットリストを表示します。 #・プリセットリストは数字キーでの選択にも対応しています。 #・選択決定すると、そのプリセット設定状態でカメラが起動します。 #・本mscrに引数"Set=番号"を渡せば直接起動することもできます。※ #・今の所[es]Silencerが無くても、シャッターを無音化できます。 #・必要ならば、設定によって[es]Silencer等を起動指定できます。 #・設定によって撮影終了後にビューア等を起動することもできます。 #●動作確認デバイス #HYBRID W-ZERO3 #その他機種は動かないと思います。 #●必要環境 #・MortScript4.1以上(それ以下でも動くかも)、mscrの関連付け。 # http://www.sto-helit.de/ (PCサイト) #●補足事項 #※引数は、[\Program Files\MortScript\MortScript.exe]に対して #["\Program Files\MortScript\ShCamera_Sp.mscr" Set=番号]を #引数として渡すことに注意してください。(特に""の有無等。) #番号の部分には呼び出すプリセット番号の数字を記述して下さい。 #本mscrのショートカットに、アイコンを利用したい場合は、 #ショートカットファイルのリンク先に、直接続けて #?\Windows\ShCamera.exe,-128と追記して下さい。 #(インストールパスが異なる場合は、記述を修正して下さい。) #アンインストールの際は、本mscrを削除するだけで大丈夫です。 #レジストリの追加、別ファイルの作成等は行っていません。 #本mscrによって生じる不利益に当方は関与しません。 #設定変数値を除く内容に改ざんがない限り、再配布は自由です。 #内容に変更を加えた際の再配布は、必ずその変更前と変更後の #明記を、本文中にて行ってあれば構いません。 #--------------------------------------------------------------- #以下環境設定 #(書き換えの際、文字コードS-JISが変換されないよう御注意下さい。) #■カメラを起動するプリセット設定を登録。(複数可)※詳細は後述 SetTitle[1]="カメラ (前回状態を復元、ビューア無し)" Angle[1]="画面方向 前回設定" Silence[1]="消音 前回設定" FocusCondition[1]="AFモード 前回設定" Burst[1]="連射 前回設定" TimerMode[1]="タイマー 前回設定" SetTitle[2]="カメラ (通常の起動、撮影後ビューア起動)" ViewerCmd[2]="\Program Files\XnView Pocket\xnpocket.exe" ViewerArg[2]="Auto" SetTitle[3]="バーコード リーダ (消音 QRコード読み取り)" CameraCmd[3]="BarCodeReader.exe" Silence[3]="消音 ON" SetTitle[4]="タテ写メ撮り (標準 QVGA / QCIF)" ViewerCmd[4]="\Windows\pimg.exe" ViewerArg[4]="AUTO" Angle[4]="縦持ち" Condition[4]="撮影シーン 標準" WhiteBalance[4]="ホワイトバランス オート" Brightness[4]="明るさ +0" Zoom[4]="ズーム X1" FocusCondition[4]="AFモード 通常" StillSize[4]="撮影サイズ QVGA" StillQuality[4]="高画質" SmileyFace[4]="笑顔 OFF" Panorama[4]="パノラマ OFF" AntiShake[4]="手ぶれ ON" ConditionVideo[4]="撮影シーン 標準" WhiteBalanceVideo[4]="ホワイトバランス オート" BrightnessVideo[4]="明るさ +0" ZoomVideo[4]="ズーム X1" VideoSize[4]="録画サイズ QCIF" VideoTime[4]="録画制限時間 15秒" AntiShakeVideo[4]="手ぶれ OFF" AudioEnable[4]="録音 ON" SetTitle[5]="ヨコ本気撮り (標準 3M / QVGA)" ViewerCmd[5]="\Windows\pimg.exe" ViewerArg[5]="AUTO" Angle[5]="横持ち" Condition[5]="撮影シーン 標準" WhiteBalance[5]="ホワイトバランス オート" Brightness[5]="明るさ +0" Zoom[5]="ズーム X1" FocusCondition[5]="AFモード 通常" StillSize[5]="撮影サイズ 3M" StillQuality[5]="高画質" SmileyFace[5]="笑顔 OFF" Panorama[5]="パノラマ OFF" AntiShake[5]="手ぶれ ON" ConditionVideo[5]="撮影シーン 標準" WhiteBalanceVideo[5]="ホワイトバランス オート" BrightnessVideo[5]="明るさ +0" ZoomVideo[5]="ズーム X1" VideoSize[5]="録画サイズ QVGA" VideoTime[5]="録画制限時間 30秒" AntiShakeVideo[5]="手ぶれ OFF" AudioEnable[5]="録音 ON" #※以下、詳細を説明します。 #SetTitleの[]内番号は1から連番で並んでいる必要があります。 #SetTitleを除く他の項目は省略が可能です。 #=の後が文字やパス指定の場合、""内に記述して下さい。 # SetTitle[]="プリセットの任意タイトル名 (指定必須)" # CameraCmd[]="実行するアプリのパスを指定 (省略時は"カメラ"を起動します)" # CameraArg[]="CameraCmdへの引数があれば指定" # ViewerCmd[]="撮影終了後に起動するアプリ(ビュアー等)のパスを指定" # ViewerArg[]="ViewerCmdへの引数があれば指定 (画像とビデオ,XnViewは"AUTO"が可能※)" #下記の項目は、レジストリの数値、またはキーワード文字指定も可能です。 #例:Store[1]=0と、Store[1]="本体"は、同じ内容となります。 #レジストリ数値による直接指定の場合、=後の""は省略しても構いません。 #共通設定 # Store[]="保存先 0=本体 1=カード # Angle[]="画面方向 0=縦持ち 1=横持ち 2=前回設定" # Silence[]="消音 0=OFF 1=ON 2=前回設定" #カメラ設定 # Condition[]="撮影シーン 0=標準 1=人物 2=スポーツ 3=風景 4=夜景 5=雪景色 6=ビーチ" # WhiteBalance[]="ホワイトバランス 0=オート 1=太陽光 2=蛍光灯 3=白熱灯 4=曇り" # Brightness[]="明るさ 0=+3 1=+2 2=+1 3=+0 4=-1 5=-2 6=-3" # Zoom[]="ズーム 0=X1 1=X2 2=X4" # FocusCondition[]="AFモード 0=通常 1=人物優先 2=接写 3=前回設定" # StillSize[]="撮影サイズ 0=QVGA 1=VGA 2=SXGA 3=UXGA 4=3M 5=5M" # StillQuality[]="画質 0=低画質 1=標準 2=高画質" # Burst[]="連射(5秒) (排他&強制VGA) 0=OFF 1=ON 2=前回設定" # SmileyFace[]="笑顔撮影 (排他&強制AF人物) 0=OFF 1=ON" # Panorama[]="パノラマ撮影 (排他) 0=OFF 1=ON" # AntiShake[]="手ぶれ防止 0=OFF 1=ON" # TimerMode[]="タイマー撮影(5秒) (排他) 0=OFF 1=ON 2=前回設定 " #ビデオ設定 # ConditionVideo[]="撮影シーン 0=標準 1=人物 2=スポーツ 3=風景 4=夜景 5=雪景色 6=ビーチ" #WhiteBalanceVideo[]="ホワイトバランス 0=オート 1=太陽光 2=蛍光灯 3=白熱灯 4=曇り" # BrightnessVideo[]="明るさ 0=+3 1=+2 2=+1 3=+0 4=-1 5=-2 6=-3" # ZoomVideo[]="ズーム 0=X1 1=X2 3=X4" # VideoSize[]="録画サイズ 0=QCIF 1=QVGA 2=VGA" # VideoTime[]="録画制限時間 0=15秒 1=30秒 2=制限なし(低画質)" # AntiShakeVideo[]="手ぶれ防止 0=OFF 1=ON" # AudioEnable[]="オーディオ録音 0=OFF 1=ON" #"HKEY_CURRENT_USER\Software\Sharp\Camera"への #レジストリキー[プリセット番号]=値 という書式になっています。 #Angle(画面方向),Silence (消音),FocusCondition(AFモード),Burst(連射),TimerMode(タイマー) #以上5つの項目は、特に指定が無ければカメラ起動時にデフォルト設定で起動します。(仕様) #※本mscrでは"画像とビデオ","XnView"の場合のみ、 #ViewerArg[]="AUTO"と指定すると、本体/カードは自動的に判断します。 #参考までに、ビュアーの起動指定パスは以下の通りです。 #"画像とビデオ"のパス、"\Windows\pimg.exe" #"画像とビデオ"の引数本体メモリ、"-directory:\My Documents\マイ ピクチャ" #"画像とビデオ"の引数SDカード、"-directory:\microSDカード\DCIM" #XnView Pocketのパス、"\Program Files\XnView Pocket\xnpocket.exe" #XnView Pocketの引数本体メモリ、"\My Documents\マイ ピクチャ\" #XnView Pocketの引数SDカード、"\microSDカード\DCIM\" #■0xF2(V+),0xF1(V-)を発行する16進スキャンコードを指定。 #SortInchKey等キーフックカスタムを行っていれば変更して下さい。。 #文字列から変換を行うので"0x5B+0xC1"といった指定も可能です。 #起動設定にSilence[]=1を使用しないのであれば特に必要ありません。 VolUpKey="0xF2" VolDnKey="0xF1" #■もし下記のカメラ以外を動作判定対象に加えるなら配列を追加。 #基本は変更不要です、デフォルトの配列と順序は変えないで下さい。 ExeName=Array ("ShCamera.exe","BarCodeReader.exe","BCardReader.exe",\ "ColumnReader.exe","InfoReader.exe","PSdigitizer.exe") #--------------------------------------------------------------- #バージョン履歴 #1.02 サンプル設定のバーコードリーダがPDF SHOTだったのを修正。 #1.01 カメラ終了後、画面の向きを起動前と同じに戻すよう機能修正。 #1.00 公開。 #--------------------------------------------------------------- #Main Script #■PPC制限 If(MortScriptType() ne "PPC") message("This script is PPC only.") Exit EndIf #LastDataSt PreSetNumber=1 PreAngle=0 PreSilence=0 PreFocusCondition=0 PreBurst=0 PreTimerMode=0 #LastDataEd WndName=Array ("Camera Main","バーコード リーダ","名刺リーダ",\ "コラムリーダ","情報リーダ","Mobile Scanner - Import") ArrAllSet=Array ("Angle","Silence","Store",\ "Condition","WhiteBalance","Brightness","Zoom","FocusCondition","StillSize",\ "StillQuality","Burst","SmileyFace","Panorama","AntiShake","TimerMode",\ "ConditionVideo","WhiteBalanceVideo","BrightnessVideo","ZoomVideo",\ "VideoSize","VideoTime","AntiShakeVideo","AudioEnable","Running") ArrBefSet=Array ("Store",\ "Condition","WhiteBalance","Brightness","Zoom","StillSize",\ "StillQuality","SmileyFace","Panorama","AntiShake",\ "ConditionVideo","WhiteBalanceVideo","BrightnessVideo","ZoomVideo",\ "VideoSize","VideoTime","AntiShakeVideo","AudioEnable") ArrAftSet=Array ("Angle","Silence","FocusCondition","Burst","TimerMode" ) ForEach FEBox in Array ("ArrAllSet") ["Reg"&FEBox]="RegRead (""HKCU"",""Software\Sharp\Camera"","""&FEBox&""")" EndForEach RegRunning="RegRead (""HKCU"",""Software\Sharp\Camera"",""Running"")" SDMFolder=RegRead ("HKLM","System\StorageManager\Profiles\SDMemory","Folder") #■スキャンコードを10進にして+があれば分割して、配列化 ForEach FEBox in Values ("VolUpKey","VolDnKey") If (IsEmpty ([FEBox])) Switch (FEBox) Case ("VolUpKey") [FEBox]="0xF2" Case ("VolDnKey") [FEBox]="0xF1" EndSwitch EndIf [FEBox]=ToLower([FEBox]) [FEBox]=Replace([FEBox],"0x","") i=0 ForEach Hex in split ([FEBox],"+",1) i=i+1 [FEBox&"["&i&"]"]=HexToNumber(Hex) EndForEach EndForEach #■カメラが起動していたら終了 If (ProcExists ("ShCamera.exe")) Close ("カメラアプリ ") Sleep (500) EndIf #■ごういんな引数受け取りチェック ErrorLevel ("Off") If ( (Set>=1) and (Not IsEmpty (SetTitle[Set])) ) ErrorLevel ("error") SetNumber=Set Else #■ダイアログリスト、ページ&インデックスナンバー割り当て ErrorLevel ("error") DPg=0 DNm=1 ForEach FEBox in array ("SetTitle") If(DNm<10) DlgList[DPg][DNm]=DNm&". "&FEBox DNm=DNm+1 ElseIf(DNm=10) DlgList[DPg][DNm]="0. "&FEBox DNm=DNm+1 Else If (DPg>=1) DlgList[DPg][DNm]="*. Back <<" DNm=DNm+1 EndIf DlgList[DPg][DNm]="#. Next >>" DPg=DPg+1 DNm=1 DlgList[DPg][DNm]="1. "&FEBox DNm=DNm+1 EndIf EndForEach If (DPg>=1) DlgList[DPg][DNm]="*. Back <<" EndIf #■前回カメラ設定 表示準備 v=PreAngle PreSetAngle="" Switch(v) Case(0) PreSetAngle="タテ持ち" Case(1) PreSetAngle="ヨコ持ち" EndSwitch v=PreSilence PreSetSilence="" Switch(v) Case(0) PreSetSilence="" Case(1) PreSetSilence="消音" EndSwitch v=PreFocusCondition PreSetFocusCondition="" Switch(v) Case(0) PreSetFocusCondition="AF通常" Case(1) PreSetFocusCondition="AF人物" Case(2) PreSetFocusCondition="AF接写" EndSwitch v=Eval (RegStore) PreSetStore="" Switch(v) Case(0) PreSetStore="本体保存" Case(1) PreSetStore="カード保存" EndSwitch v=Eval (RegCondition) PreSetCondition="" Switch(v) Case(0) PreSetCondition="S標準" Case(1) PreSetCondition="S人物" Case(2) PreSetCondition="Sスポーツ" Case(3) PreSetCondition="S風景" Case(4) PreSetCondition="S夜景" Case(5) PreSetCondition="S雪景" Case(6) PreSetCondition="Sビーチ" EndSwitch v=Eval (RegWhiteBalance) PreSetWhiteBalance="" Switch(v) Case(0) PreSetWhiteBalance="Wオート" Case(1) PreSetWhiteBalance="W太陽光" Case(2) PreSetWhiteBalance="W蛍光灯" Case(3) PreSetWhiteBalance="W白熱灯" Case(4) PreSetWhiteBalance="W曇り" EndSwitch v=Eval (RegBrightness) PreSetBrightness="" Switch(v) Case(0) PreSetBrightness="明+3" Case(1) PreSetBrightness="明+2" Case(2) PreSetBrightness="明+1" Case(3) PreSetBrightness="明+0" Case(4) PreSetBrightness="明-1" Case(5) PreSetBrightness="明-2" Case(6) PreSetBrightness="明-3" EndSwitch v=Eval (RegZoom) PreSetZoom="" Switch(v) Case(0) PreSetZoom="X1" Case(1) PreSetZoom="X2" Case(2) PreSetZoom="X4" EndSwitch v=Eval (RegStillSize) PreSetStillSize="" Switch(v) Case(0) PreSetStillSize="QVGA" Case(1) PreSetStillSize="VGA" Case(2) PreSetStillSize="SXGA" Case(3) PreSetStillSize="UXGA" Case(4) PreSetStillSize="3M" Case(5) PreSetStillSize="5M" EndSwitch v=Eval (RegStillQuality) PreSetStillQuality="" Switch(v) Case(0) PreSetStillQuality="低画質" Case(1) PreSetStillQuality="標準画質" Case(2) PreSetStillQuality="高画質" EndSwitch v=Eval (RegAntiShake) If (v=1) PreSetAntiShake="手" Else PreSetAntiShake="" EndIf PreSetOption="" v=Eval (RegSmileyFace) If (v=1) PreSetOption="笑顔撮影" EndIf v=Eval (RegPanorama) If (v=1) PreSetOption="パノラマ" EndIf v=PreBurst If (v=1) PreSetOption="連射5秒" EndIf v=PreTimerMode If (v=1) PreSetOption="タイマー" EndIf v=Eval (RegConditionVideo) PreSetConditionVideo="" Switch(v) Case(0) PreSetConditionVideo="S標準" Case(1) PreSetConditionVideo="S人物" Case(2) PreSetConditionVideo="Sスポーツ" Case(3) PreSetConditionVideo="S風景" Case(4) PreSetConditionVideo="S夜景" Case(5) PreSetConditionVideo="S雪景" Case(6) PreSetConditionVideo="Sビーチ" EndSwitch v=Eval (RegWhiteBalanceVideo) PreSetWhiteBalanceVideo="" Switch(v) Case(0) PreSetWhiteBalanceVideo="Wオート" Case(1) PreSetWhiteBalanceVideo="W太陽光" Case(2) PreSetWhiteBalanceVideo="W蛍光灯" Case(3) PreSetWhiteBalanceVideo="W白熱灯" Case(4) PreSetWhiteBalanceVideo="W曇り" EndSwitch v=Eval (RegBrightnessVideo) PreSetBrightnessVideo="" Switch(v) Case(0) PreSetBrightnessVideo="明+3" Case(1) PreSetBrightnessVideo="明+2" Case(2) PreSetBrightnessVideo="明+1" Case(3) PreSetBrightnessVideo="明+0" Case(4) PreSetBrightnessVideo="明-1" Case(5) PreSetBrightnessVideo="明-2" Case(6) PreSetBrightnessVideo="明-3" EndSwitch v=Eval (RegZoomVideo) PreSetZoomVideo="" Switch(v) Case(0) PreSetZoomVideo="X1" Case(1) PreSetZoomVideo="X2" Case(2) PreSetZoomVideo="X4" EndSwitch v=Eval (RegVideoSize) PreSetVideoSize="" Switch(v) Case(0) PreSetVideoSize="QCIF" Case(1) PreSetVideoSize="QVGA" Case(2) PreSetVideoSize="VGA" EndSwitch v=Eval (RegVideoTime) PreSetVideoTime="" Switch(v) Case(0) PreSetVideoTime="15秒" Case(1) PreSetVideoTime="30秒" Case(2) PreSetVideoTime="制限なし" EndSwitch v=Eval (RegAntiShakeVideo) If (v=1) PreSetAntiShakeVideo="手" Else PreSetAntiShakeVideo="" EndIf v=Eval (RegAudioEnable) If (v=1) PreSetAudioEnable="録音" Else PreSetAudioEnable="無音" EndIf DlgPrmPreMode="LastSet^TAB^"&PreSetStore&" "&PreSetAngle&" "&PreSetSilence\ &"^NL^-カメラ: "&PreSetStillSize&" "&PreSetFocusCondition&" "&PreSetStillQuality&" "&PreSetOption\ &"^NL^-^TAB^"&PreSetZoom&" "&PreSetBrightness&" "&PreSetWhiteBalance&" "&PreSetCondition&" "&PreSetAntiShake\ &"^NL^-ビデオ: "&PreSetVideoSize&" "&PreSetAudioEnable&" "&PreSetVideoTime\ &"^NL^-^TAB^"&PreSetZoomVideo&" "&PreSetBrightnessVideo&" "&PreSetWhiteBalanceVideo&" "&PreSetConditionVideo&" "&PreSetAntiShakeVideo #LastSet カード保存 タテ持ち 消音 #-カメラ: SXGA AF通常 標準画質 タイマー #- X4 明+0 Wオート Sスポーツ 手 #-ビデオ: QVGA 録音 制限なし #- X4 明+0 Wオート Sスポーツ 手 #■ダイアログ選択画面(-1は10をページアップしない措置) DefNum=(PreSetNumber-1) mod 10 + 1 DPg=((PreSetNumber-1) - (PreSetNumber-1) mod 10) / 10 DBack=0 DNext=0 DlgTitle="ShCamera_Sp_HB / by AC-Promenade" DlgPrmTitle=DlgPrmPreMode DlgTime=0 If (MaxIndex (SetTitle)>10) ListMax=" / "&MaxIndex (SetTitle) Else ListMax="" EndIf Ok=0 While (Ok=0) If (DPg=MaxIndex (DlgList)) ListEnd=MaxIndex (SetTitle) If (DBack+DNext>=1) DefNum=MaxIndex (DlgList[DPg]) EndIf Else ListEnd=(DPg+1)*10 If (DBack=1) DefNum=11 ElseIf (DNext=1) DefNum=12 EndIf EndIf DlgPrompt=(DPg&1)*1&"-"&ListEnd&ListMax&" User preset list^NL^"&DlgPrmTitle ChoiceDefault (DlgTitle,DlgPrompt,DefNum,DlgTime,"DlgList[DPg]") Case (0) Exit Case (1) DNm=1 Case (2) DNm=2 Case (3) DNm=3 Case (4) DNm=4 Case (5) DNm=5 Case (6) DNm=6 Case (7) DNm=7 Case (8) DNm=8 Case (9) DNm=9 Case (10) DNm=10 Case (11) DNm=11 Case (12) DNm=12 EndChoice If (DlgList[DPg][DNm] eq "*. Back <<") DPg=DPg-1 DBack=1 DNext=0 ElseIf (DlgList[DPg][DNm] eq "#. Next >>") DPg=DPg+1 DBack=0 DNext=1 Else SetNumber=DPg*10 + DNm Ok=1 EndIf EndWhile EndIf #■変更値の配列振り分け(SHARP)、実変数名に置き換え(これ以後SetNumber不要) CameraCmd=CameraCmd[SetNumber] CameraArg=CameraArg[SetNumber] ViewerCmd=ViewerCmd[SetNumber] ViewerArg=ViewerArg[SetNumber] If (CameraCmd eq "") CameraCmd="\Windows\ShCamera.exe" EndIf #■文字列変換プロセス (ForEachで回したら遅くなったのでストレート記述) i=0 ForEach FEBox in array ("ArrBefSet") If ([FEBox&"["&SetNumber&"]"] ne "") i=i+1 ArrBefEnb[i]=FEBox [FEBox]=ToLower ([FEBox&"["&SetNumber&"]"]) EndIf EndForEach ForEach FEBox in array ("ArrAftSet") If ([FEBox&"["&SetNumber&"]"] ne "") [FEBox]=ToLower ([FEBox&"["&SetNumber&"]"]) EndIf EndForEach FEBox="Angle" If ( (Not IsEmpty([FEBox])) and Not ( (Length ([FEBox])=1)\ and ((([FEBox]<=2) and ([FEBox]>=1)) or (Find ([FEBox],"0"))) ) ) If ( (Find ([FEBox],"縦")) or (Find ([FEBox],"た"))\ or (Find ([FEBox],"タ")) or (Find ([FEBox],"タ")) ) [FEBox]=0 ElseIf ( (Find ([FEBox],"横")) or (Find ([FEBox],"よ"))\ or (Find ([FEBox],"ヨ")) or (Find ([FEBox],"ヨ")) ) [FEBox]=1 ElseIf ( (Find ([FEBox],"前")) or (Find ([FEBox],"ぜ"))\ or (Find ([FEBox],"ゼ")) or (Find ([FEBox],"ゼ")) ) [FEBox]=2 Else [FEBox]=3 EndIf EndIf FEBox="FocusCondition" If ( (Not IsEmpty([FEBox])) and Not ( (Length ([FEBox])=1)\ and ((([FEBox]<=3) and ([FEBox]>=1)) or (Find ([FEBox],"0"))) ) ) If (Find ([FEBox],"人")) [FEBox]=1 ElseIf ( (Find ([FEBox],"接")) or (Find ([FEBox],"マ")) or (Find ([FEBox],"マ")) ) [FEBox]=2 ElseIf ( (Find ([FEBox],"前")) or (Find ([FEBox],"ぜ"))\ or (Find ([FEBox],"ゼ")) or (Find ([FEBox],"ゼ")) ) [FEBox]=3 Else [FEBox]=0 EndIf EndIf ForEach FEBox in Values ("Silence","Burst","TimerMode") If ( (Not IsEmpty([FEBox])) and Not ( (Length ([FEBox])=1)\ and ((([FEBox]<=2) and ([FEBox]>=1)) or (Find ([FEBox],"0"))) ) ) If ( (Find ([FEBox],"n"))\ or (Find ([FEBox],"N")) or (Find ([FEBox],"n"))\ or (Find ([FEBox],"ン")) or (Find ([FEBox],"ン")) ) [FEBox]=1 ElseIf ( (Find ([FEBox],"前")) or (Find ([FEBox],"ぜ"))\ or (Find ([FEBox],"ゼ")) or (Find ([FEBox],"ゼ")) ) [FEBox]=2 Else [FEBox]=0 EndIf EndIf EndForEach FEBox="Store" If ( (Not IsEmpty([FEBox])) and Not ( (Length ([FEBox])=1)\ and (([FEBox]=1) or (Find ([FEBox],"0"))) ) ) If ( (Find ([FEBox],"カ")) or (Find ([FEBox],"カ"))\ or (Find ([FEBox],"s")) or (Find ([FEBox],"c"))\ or (Find ([FEBox],"S")) or (Find ([FEBox],"s"))\ or (Find ([FEBox],"C")) or (Find ([FEBox],"c")) ) [FEBox]=1 Else [FEBox]=0 EndIf EndIf ForEach FEBox in Values ("Condition","ConditionVideo") If ( (Not IsEmpty([FEBox])) and Not ( (Length ([FEBox])=1)\ and ((([FEBox]<=6) and ([FEBox]>=1)) or (Find ([FEBox],"0"))) ) ) If (Find ([FEBox],"人")) [FEBox]=1 ElseIf ( (Find ([FEBox],"ス")) or (Find ([FEBox],"ス")) ) [FEBox]=2 ElseIf (Find ([FEBox],"風")) [FEBox]=3 ElseIf (Find ([FEBox],"夜")) [FEBox]=4 ElseIf (Find ([FEBox],"雪")) [FEBox]=5 ElseIf ( (Find ([FEBox],"ビ")) or (Find ([FEBox],"ビ")) ) [FEBox]=6 Else [FEBox]=0 EndIf EndIf EndForEach ForEach FEBox in Values ("WhiteBalance","WhiteBalanceVideo") If ( (Not IsEmpty([FEBox])) and Not ( (Length ([FEBox])=1)\ and ((([FEBox]<=4) and ([FEBox]>=1)) or (Find ([FEBox],"0"))) ) ) If (Find ([FEBox],"太")) [FEBox]=1 ElseIf (Find ([FEBox],"蛍")) [FEBox]=2 ElseIf (Find ([FEBox],"白")) [FEBox]=3 ElseIf ( (Find ([FEBox],"曇")) or (Find ([FEBox],"雲")) ) [FEBox]=4 Else [FEBox]=0 EndIf EndIf EndForEach ForEach FEBox in Values ("Brightness","BrightnessVideo") If (Length ([FEBox])>=2) If ( (Find ([FEBox],"-")) or (Find ([FEBox],"−"))\ or (Find ([FEBox],"ー")) or (Find ([FEBox],"ー")) ) If ( (Find ([FEBox],"3")) or (Find ([FEBox],"3")) ) [FEBox]=6 ElseIf ( (Find ([FEBox],"2")) or (Find ([FEBox],"2")) ) [FEBox]=5 Else [FEBox]=4 EndIf ElseIf ( (Find ([FEBox],"1")) or (Find ([FEBox],"1")) ) [FEBox]=2 ElseIf ( (Find ([FEBox],"2")) or (Find ([FEBox],"2")) ) [FEBox]=1 ElseIf ( (Find ([FEBox],"3")) or (Find ([FEBox],"3")) ) [FEBox]=0 Else [FEBox]=3 EndIf ElseIf ( (Not IsEmpty([FEBox])) and ( ([FEBox]>6)\ or (([FEBox]=0) and (Not Find ([FEBox],"0"))) ) ) [FEBox]=3 EndIf EndForEach ForEach FEBox in Values ("Zoom","ZoomVideo") If (Length ([FEBox])>=2) If ( (Find ([FEBox],"4")) or (Find ([FEBox],"4")) ) [FEBox]=2 ElseIf ( (Find ([FEBox],"2")) or (Find ([FEBox],"2")) ) [FEBox]=1 Else [FEBox]=0 EndIf ElseIf ( (Not IsEmpty([FEBox])) and ( ([FEBox]>2)\ or (([FEBox]=0) and (Not Find ([FEBox],"0"))) ) ) [FEBox]=0 EndIf EndForEach FEBox="StillSize" If ( (Not IsEmpty([FEBox])) and Not ( (Length ([FEBox])=1)\ and ((([FEBox]<=5) and ([FEBox]>=1)) or (Find ([FEBox],"0"))) ) ) If ( ([FEBox]=4915200)\ or ( ([FEBox]<=2560) and ([FEBox]<>2048) and ([FEBox]>=1920) )\ or (Find ([FEBox],"5")) or (Find ([FEBox],"5")) ) [FEBox]=5 ElseIf ( ([FEBox]=3145728)\ or ( ([FEBox]<=2048) and ([FEBox]<>1600) and ([FEBox]>=1536) )\ or (Find ([FEBox],"3")) or (Find ([FEBox],"3")) ) [FEBox]=4 ElseIf ( ([FEBox]=1920000)\ or ( ([FEBox]<=1600) and ([FEBox]<>1280) and ([FEBox]>=1200) )\ or (Find ([FEBox],"u"))\ or (Find ([FEBox],"U")) or (Find ([FEBox],"u")) ) [FEBox]=3 ElseIf ( ([FEBox]=1310720)\ or ( ([FEBox]<=1280) and ([FEBox]>=1024) )\ or (Find ([FEBox],"s"))\ or (Find ([FEBox],"S")) or (Find ([FEBox],"s")) ) [FEBox]=2 ElseIf ( ([FEBox]=307200)\ or ( ([FEBox]<=640) and ([FEBox]>=480) )\ or ( (Not Find ([FEBox],"q"))\ and (Not Find ([FEBox],"Q")) and (Not Find ([FEBox],"q")) ) ) [FEBox]=1 Else [FEBox]=0 EndIf EndIf FEBox="StillQuality" If ( (Not IsEmpty([FEBox])) and Not ( (Length ([FEBox])=1)\ and ((([FEBox]<=2) and ([FEBox]>=1)) or (Find ([FEBox],"0"))) ) ) If ( (Find ([FEBox],"高"))\ or (Find ([FEBox],"h"))\ or (Find ([FEBox],"H")) or (Find ([FEBox],"h")) ) [FEBox]=2 ElseIf ( (Find ([FEBox],"準")) or (Find ([FEBox],"通"))\ or (Find ([FEBox],"m"))\ or (Find ([FEBox],"M")) or (Find ([FEBox],"m")) ) [FEBox]=1 Else [FEBox]=0 EndIf EndIf ForEach FEBox in Values ("SmileyFace","Panorama","AntiShake","AntiShakeVideo","AudioEnable") If ( (Not IsEmpty([FEBox])) and Not ( (Length ([FEBox])=1)\ and (([FEBox]=1) or (Find ([FEBox],"0"))) ) ) If ( (Find ([FEBox],"n"))\ or (Find ([FEBox],"N")) or (Find ([FEBox],"n"))\ or (Find ([FEBox],"ン")) or (Find ([FEBox],"ン")) ) [FEBox]=1 Else [FEBox]=0 EndIf EndIf EndForEach FEBox="VideoSize" If ( (Not IsEmpty([FEBox])) and Not ( (Length ([FEBox])=1)\ and ((([FEBox]<=2) and ([FEBox]>=1)) or (Find ([FEBox],"0"))) ) ) If ( (([FEBox]=307200) or (([FEBox]<=640) and ([FEBox]>=480)))\ or ((Not Find ([FEBox],"q"))\ and (Not Find ([FEBox],"Q")) and (Not Find ([FEBox],"q"))) ) [FEBox]=2 ElseIf ( ([FEBox]=76800)\ or ( ([FEBox]<=320) and ([FEBox]>=240) )\ or (Find ([FEBox],"v"))\ or (Find ([FEBox],"V")) or (Find ([FEBox],"v")) ) [FEBox]=1 Else [FEBox]=0 EndIf EndIf FEBox="VideoTime" If ( (Not IsEmpty([FEBox])) and Not ( (Length ([FEBox])=1)\ and ((([FEBox]<=2) and ([FEBox]>=1)) or (Find ([FEBox],"0"))) ) ) If ( (Not Find ([FEBox],"1")) and (Not Find ([FEBox],"1"))\ and (Not Find ([FEBox],"3")) and (Not Find ([FEBox],"3"))\ and (Not Find ([FEBox],"5")) and (Not Find ([FEBox],"5")) ) [FEBox]=2 ElseIf ( (Find ([FEBox],"3")) or (Find ([FEBox],"3")) ) [FEBox]=1 Else [FEBox]=0 EndIf EndIf #レジストリ読み込みの効かない設定を前回指定されたので、実値を読み込み ForEach FEBox in Values ("Angle","Silence","Burst","TimerMode") If([FEBox]=2) [FEBox]=["Pre"&FEBox] EndIf EndForEach FEBox="FocusCondition" If([FEBox]=3) [FEBox]=["Pre"&FEBox] EndIf #■設定項目特有の排他処理 (前回設定表示の逆順で同期) i=0 ForEach FEBox in values ("TimerMode","Burst","Panorama","SmileyFace") If (i=1) [FEBox]=0 ElseIf ([FEBox]=1) i=1 EndIf EndForEach If (Burst=1) StillSize=1 ElseIf (SmileyFace=1) FocusCondition=1 EndIf If (Find(CameraCmd,"PSdigitizer.exe")) Angle=0 EndIf #■RegCheckModeレジストリ値反映チェック(デバッグ用) RegCheckMode=0 If (RegCheckMode=1) word="" ForEach FEBox in array ("ArrBefEnb") word=word&FEBox&" = "&[FEBox]&"^NL^" EndForEach word=word&"^NL^" ForEach FEBox in array ("ArrAftSet") word=word&FEBox&" = "&[FEBox]&"^NL^" EndForEach BigMessage(word) Exit EndIf #■先レジストリ値反映 ForEach FEBox in array ("ArrBefEnb") RegWriteDWord ("HKCU","Software\Sharp\Camera",FEBox,[FEBox]) EndForEach #■ボリューム、画面方向 If (Silence=1) PreSpkLev=RegRead ("HKCU","ControlPanel\Phone","ReceiverWgtSpkLev") RegWriteDWord ("HKCU","ControlPanel\Phone","ReceiverWgtSpkLev",0) If (RegRead ("HKCU","ControlPanel\Volume","Volume") >= 0) ForEach FEBox in Values ("VolUpKey","VolDnKey") Call ("VolKeyUpDown") Sleep (500) EndForEach Else ForEach FEBox in Values ("VolDnKey","VolUpKey") Call ("VolKeyUpDown") Sleep (500) EndForEach EndIf EndIf BefAngle=Screen("landscape") If (Angle < 2) If (BefAngle<>Angle) Rotate (270*Angle) EndIf EndIf #■事前ディレクトリ内容チェック Call ("DCIMDirChk") PreDevFiles=DevFiles PreMSDFiles=MSDFiles #■準備完了、アプリケーション実行 ProcExe="" ProcWnd="" ProcNum=0 #アプリケーションパスからプロセス名取得を試みる i=0 While (i < MaxIndex(ExeName)) i=i+1 If (Find (ToLower(CameraCmd),ToLower(ExeName[i]))) ProcExe=ExeName[i] ProcWnd=WndName[i] ProcNum=i i=MaxIndex(ExeName) EndIf EndWhile Run (CameraCmd,CameraArg) #パス取得が不明であれば、約7秒以内の起動プロセスから取得を試みる t=0 While ( (t<14) and (ProcExe eq "") ) t=t+1 i=0 While (i < MaxIndex(ExeName)) i=i+1 If (ProcExists(ExeName[i])) ProcExe=ExeName[i] ProcWnd=WndName[i] ProcNum=i i=MaxIndex(ExeName) EndIf EndWhile Sleep(500) EndWhile #最終的にプロセス名が不明であれば、"カメラ"を対象とする If (ProcExe eq "") ProcExe=ExeName[1] ProcWnd=WndName[1] EndIf #■起動待機 If (MaxIndex(WndName) >= ProcNum) ErrorLevel ("syntax") WaitFor (ProcWnd,10) ErrorLevel ("error") #待機ウィンドウ名のデバッグチェック用 #message(""""&ActiveWindow()&"""^NL^"""&ProcWnd&"""") EndIf CameraOn=0 #■カメラ用後レジストリ値反映 If (ProcExists("ShCamera.exe")) CameraOn=1 i=0 While ( (ProcExists("ShCamera.exe")) and (Eval (RegRunning)=0) and (i < 20) ) i=i+1 Sleep (500) EndWhile Sleep (500) Loading=0 word="" ForEach FEBox in values ("FocusCondition","Burst","TimerMode") If ([FEBox] >= 1) Loading=1 word=word&FEBox&", " RegWriteDWord ("HKCU","Software\Sharp\Camera",FEBox,[FEBox]) EndIf EndForEach If (Loading=1) SleepMessage (1,"Loading...^NL^"&word) EndIf EndIf #■終了待機、カメラなら直前までのレジストリ取得 While (ProcExists(ProcExe)) If (CameraOn=1) Burst=Eval (RegBurst) TimerMode=Eval (RegTimerMode) FocusCondition=Eval (RegFocusCondition) EndIf Sleep (3000) EndWhile #■事後画面方向取得、ボリューム戻し Angle=Screen("landscape") If(BefAngle<>Angle) Rotate (270*BefAngle) EndIf If (Silence=1) RegWriteDWord ("HKCU","ControlPanel\Phone","ReceiverWgtSpkLev",PreSpkLev) If (RegRead ("HKCU","ControlPanel\Volume","Volume") >= 0) ForEach FEBox in Values ("VolUpKey","VolDnKey") Call ("VolKeyUpDown") Sleep (300) EndForEach Else ForEach FEBox in Values ("VolDnKey","VolUpKey") Call ("VolKeyUpDown") Sleep (300) EndForEach EndIf EndIf #■前回不一致なら、今回選択項目番号保存 If ( (SetNumber<>PreSetNumber) or (Angle<>PreAngle) or (Silence<>PreSilence)\ or (Burst<>PreBurst) or (TimerMode<>PreTimerMode) or (FocusCondition<>PreFocusCondition) ) Call ("LastDataSave") EndIf #■事後ディレクトリ内容チェック、変化時ビュアーアプリ起動 If (ViewerCmd ne "") Call ("DCIMDirChk") If ( (PreDevFiles<>DevFiles) or (PreMSDFiles<>MSDFiles) ) #■引数"AUTO"判定 ViewerArgLow=ToLower (ViewerArg) If (ViewerArgLow eq "auto") LastStore=Eval (RegStore) ViewerCmdLow=ToLower (ViewerCmd) If (Find (ViewerCmdLow,"pimg.exe")) If (LastStore=0) ViewerArg="-directory:\My Documents\マイ ピクチャ" Else ViewerArg="-directory:\"&SDMFolder&"\DCIM" EndIf ElseIf (Find (ViewerCmdLow,"xnpocket.exe")) If (LastStore=0) ViewerArg="\My Documents\マイ ピクチャ\" Else ViewerArg="\"&SDMFolder&"\DCIM\" EndIf EndIf EndIf If (ViewerArg eq "") Run (ViewerCmd) Else Run (ViewerCmd,ViewerArg) EndIf EndIf EndIf #--------------------------------------------------------------- #Sub Script #■Call ("LastDataSave") 本mscrに前回環境を保存 Sub LastDataSave ThisFile=SystemPath ("ScriptName")&SystemPath ("ScriptExt") ThisFilePath=SystemPath ("ScriptPath")\ThisFile If (FileExists (ThisFilePath)) ThisFileText=ReadFile (ThisFilePath,0,"jis") PostFileText=Part (ThisFileText,"^NL^#LastDataSt",1,0)\ &"^NL^#LastDataSt"\ &"^NL^PreSetNumber="&SetNumber\ &"^NL^PreAngle="&Angle\ &"^NL^PreSilence="&Silence\ &"^NL^PreFocusCondition="&FocusCondition\ &"^NL^PreBurst="&Burst\ &"^NL^PreTimerMode="&TimerMode\ &"^NL^#LastDataEd"\ &Part (ThisFileText,"^NL^#LastDataEd",-1,0) WriteFile (ThisFilePath,PostFileText,0,"jis") EndIf EndSub #■Call ("DCIMDirChk") カメラ保存ディレクトリ内容チェック Sub DCIMDirChk DevFiles=0 ForEach FEBox in files ("\My Documents\マイ ピクチャ\*.*") DevFiles=DevFiles+1 EndForEach MSDFiles=0 ForEach FEBox in files (SDMFolder\"\DCIM\*.*") MSDFiles=MSDFiles+1 EndForEach EndSub #■Call ("VolKeyUpDown") ボリュームキーアップダウン処理 Sub VolKeyUpDown ForEach KeyCode in array ([FEBox]) SendSpecial (KeyCode,"down") EndForEach i=MaxIndex([FEBox]) While (i > 0) SendSpecial([FEBox&"["&i&"]"],"up") i=i-1 EndWhile EndSub