10年以上ぶりで[AppleScript]をさわった。実はG4を持っている。
MACさわるのは数ヶ月ぶり?
Windows専用[WebFormMaker4ie]のページですが、今回はMACなはなしです。
FileMakerのプラグイン作成でC++に挑んでいますが、なんか大変!
MACだとAppleScriptがあるので簡単なのでは、と思いちょっと調べてみました。
[safari]ってAppleScriptであんまり操作できない?のでJavaScriptを多用。
gmailへ自動ログイン:
注!:MAC環境古い!
OS X 10.3.9
safari 1.3.2
AppleScript 1.9.3
FileMaker 8.5
FileMakerからAppleScript実行でOK
--ここからアップルスクリプト
tell application "Safari"
 activate
 open location "https://www.google.com/accounts/ServiceLogin?service=mail&passive=true&rm=false&continue=http%3A%2F%2Fmail.google.com%2Fmail%2F%3Fui%3Dhtml%26zy%3Dl&bsv=zpwhtygjntrz&scc=1<mpl=default<mplcache=2&hl=ja"
 my readyState(10)
 do JavaScript "document.gaia_loginform.Email.value='googleアカウント'" in document 1
 do JavaScript "document.gaia_loginform.Passwd.value='パスワード'" in document 1
 do JavaScript "document.gaia_loginform.submit()" in document 1
 my readyState(10)
 set s1 to source of document 1
end tell
tell application "FileMaker Pro"
 tell database 1
  tell current record
   set cell "source" to s1
  end tell
 end tell
end tell
on readyState(t)
 tell application "Safari"
  repeat with i from 1 to t
   delay 1 -- 1秒待つ 
   if (do JavaScript "document.readyState" in document 1) = "complete" then
    exit repeat
   end if
  end repeat
 end tell
end readyState
 
0 件のコメント:
コメントを投稿