on dragDrop
set the cursor to busy
lock screen
put dragData["files"] into tPath
-- ドロップしたターゲットがプレイヤー以外だったら
-- スクリプトから抜ける
if word 1 of the target is not "player" then
beep
exit to top
end if
set the filename of the target to tPath
set the itemDel to "/"
put the last item of tPath into fld "musicName"
put URL ("binfile:" & tPath) into fld "tBinary"
put (the duration of player "tPlayer") div the timescale of player \
"tPlayer" into fld "tDuration"
end dragDrop
on mouseUp
if fld "tBinary" is "" then
beep
exit to top
end if
set the cursor to watch
put the length of fld "tBinary" into tTotalChars
put tTotalChars div 4 into tDivFour
put tTotalChars mod 4 into tMod
put tTotalChars & " chars div 4 = " & tDivFour & " picels, mod = " & tMod into fld "tNumChars"
put sqrt(tDivFour) div 1 into tSqrt
put "sqrt = " & tSqrt & ", sqrt^2= " & tSqrt ^ 2 into fld "tSqrt"
set the tSqrtNum of btn "numberChars" to tSqrt
end mouseUp
on mouseUp
set cursor to watch
lock screen
put the tSqrtNum of btn "numberChars" into tSqrt
set the width of image "tMusic" to tSqrt
set the height of image "tMusic" to tSqrt
set the imagedata of image "tMusic" to char 1 to tSqrt^2 of fld "tBinary"
put the textdata of image "tMusic" into fld "tTextData"
put the imagedata of image "tMusic" into fld "tImageData"
set the width of image "tMusic" to 500
set the height of image "tMusic" to 500
set the topleft of image "tMusic" to 450,80
end mouseUp