(* ユーザー毎の初期設定 *) --"管理画面のURL"を入れる。もしも、変わったら入れ直してください。 property myURL : "http://control.blog.fc2.com/control.php" ----わたしの環境ではこれでした --ユーザ名、もしくは登録しているメールアドレスを入れる ※必ず書き換えてください property myID : "ユーザ名" --アップロード時に自動的にサムネイルを作成するか(offの場合は""にする) property createThumb : "on" --アップロード時に作成されるサムネイルのサイズ(幅・高さ) property thumbWidth : 400 --幅 property thumbHeight : 225 --高さ --同名のファイルが既にある場合、上書きするかどうか -- 上書きする場合は"force" 別名で保存する場合は"rename"にする property overwrite : "force"--わたしの環境では上書き出来ませんでした --ブログのパスワード property msg1 : "ブログのパスワード" as Unicode text (* ユーザー毎の初期設定ここまで *) property msg2 : "終了しました。" as Unicode text property msg3 : "ログインに失敗しました。" as Unicode text property cookiePath : " ~/Library/Cookies/fc2uploader_cookie.txt" ----保存するcookieのパス property label_num : 7 --ラベル色(1から7好きな色、0=色なし) on open drop tell application "Finder" if (count drop) > 1 then set drop_list to drop as alias list set karifol to (make folder at desktop) as alias delete karifol set karifol to result as alias repeat with f in drop_list (make alias file to (f as alias) at karifol) as alias end repeat open karifol set properties of first window to {toolbar visible:false, current view:list view} set visible of column 6 of list view options of first window to true set sort column of list view options of first window to 6 set x_plus to 200 --個の数値でウインドウ横幅調整可 set bounds of first window to {310, 58, (310 + x_plus), 232} --ウィンドウリサイズ(上まま)↓ set count_in_item to count every item in Finder window 1 if count_in_item > 6 then set {x1, y1, x2, y2} to bounds of Finder window 1 set h1 to 196 + ((count_in_item - 6) * 18) --最小196、6行--1行=18と仮定 set bounds_1 to bounds of Finder window 1 set y2 to (y1 + h1) set bounds of Finder window 1 to {x1, y1, x2, y2} end if --ウィンドウリサイズ(上まま)↑ try set bounds_sdesktop_y2 to item 4 of ((bounds of window of desktop) as list) --ディスプレイの縦pixelを検出 if y2 > (bounds_sdesktop_y2 - 100) then set bounds of Finder window 1 to {x1, y1, x2, (bounds_sdesktop_y2 - 100)} --100pixel余裕をもったうえで、ウィンドウがディスプレイの縦pixelを超えてしまった場合い、収まるように再設定(バージョンによってうまくいくか心配なのでtry on errorで防御) on error {} end try end if end tell activate me --set myPass to text returned of (display dialog "パスワード" default answer msg1) set myPass to msg1 ----ログイン処理&Cookie保存 set loginScript to "curl -d \"id=" & myID & "&pass=" & myPass & "&mode=admin&mode=logging&process=in\" -c " & cookiePath & " -L " & myURL & " | tail -n 300" set response_login to do shell script loginScript as string ----パスワードの入力フォームがレスポンスに含まれていた場合、ログイン失敗と判定(ちょっとこのへんが微妙…) if response_login contains "input type=\"password\"" then beep display dialog msg3 with icon 0 buttons "OK" default button 1 error number -128 end if --POST時に送信するCRCの値を取得(コード中にタブ記号が含まれています) set getCrcScript to "curl -b " & cookiePath & " -d \"mode=control&process=upload\" -L " & myURL & " | grep 'name=\"crc\"' | sed 's/ * 1 then set theFile_alias to ((karifol & (name of theFile)) as text) as alias set label index of theFile_alias to label_num end if end tell end repeat beep display dialog msg2 default button 1 buttons "OK" end open