Created
December 18, 2013 06:29
-
-
Save TakamiChie/8018127 to your computer and use it in GitHub Desktop.
FlashAirの制御画像の状態を変更する(UWSC) ref: http://qiita.com/TakamiChie/items/9ccc7c08b29c617b005a
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dim fso = CREATEOLEOBJ("Scripting.FileSystemObject") | |
for i = 0 to GETOLEITEM(fso.Drives) - 1 | |
// ドライブの検索(リムーバブルかつ、制御用画像が存在するか?) | |
dim d = ALL_OLE_ITEM[i] | |
PRINT d.DriveLetter + ": Type " + d.DriveType | |
IFB d.DriveType = 1 THEN | |
PRINT "found " + d.path | |
dim path = fso.buildPath(fso.buildPath(fso.buildPath(d.path, "DCIM"), "100__TSB"), "FA000001.JPG") | |
PRINT "path " + path | |
IFB fso.FileExists(path) THEN | |
PRINT "file found" | |
// 制御用画像のプロテクト判定 | |
dim file = fso.GetFile(path) | |
IFB file.attributes AND $1 = $1 THEN | |
// プロテクトON=無線OFF | |
SELECT SLCTBOX( SLCT_BTN, 0, "無線はOFFのようです", "ONにする", "OFFのまま(再設定)") | |
CASE SLCT_1 | |
file.attributes = file.attributes XOR $1 | |
BALLOON("Flash Airの無線をONにしました", 0, 20, 20, 24, "MS ゴシック", $00FF00, $FFFFFF) | |
SLEEP(3) | |
BALLOON() | |
PRINT "Wi-Fi ON" | |
CASE SLCT_2 | |
// いったんONにしてOFFにし直す | |
file.attributes = file.attributes XOR $1 | |
SLEEP(1) | |
file.attributes = file.attributes OR $1 | |
PRINT "Wi-Fi Reset" | |
SELEND | |
ELSE | |
// プロテクトOFF=無線ON | |
SELECT SLCTBOX( SLCT_BTN, 0, "無線はONのようです", "OFFにする", "ONのまま(再設定)") | |
CASE SLCT_1 | |
file.attributes = file.attributes OR $1 | |
BALLOON("Flash Airの無線をOFFにしました", 0, 20, 20, 24, "MS ゴシック", $00FF00, $FFFFFF) | |
SLEEP(3) | |
BALLOON() | |
PRINT "Wi-Fi OFF" | |
CASE SLCT_2 | |
// いったんOFFにしてONにし直す | |
file.attributes = file.attributes OR $1 | |
SLEEP(1) | |
file.attributes = file.attributes XOR $1 | |
PRINT "Wi-Fi Reset" | |
SELEND | |
ENDIF | |
// FlashAir二枚差しには非対応です | |
EXIT | |
ELSE | |
PRINT "file not found" | |
ENDIF | |
ENDIF | |
next |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment