(* (mysite)edit v.1.00 * written: Sasaki Atsushi * last modified: 2003-12-21T10:21:07+09:00 *) set dfltDlm to AppleScript's text item delimiters set mySite to path to "site" from user domain as string tell application "Safari" to set safariURI to URL of document 1 on sHash(hash) tell application "Jedit4" to if hash is not "" then find "id=\"" & hash & "\"" in document 1 with grep and wrap around end sHash try if safariURI contains "#" then set AppleScript's text item delimiters to "#" set safariURI to every text item of safariURI as list set hash to item 2 of safariURI as string set safariURI to item 1 of safariURI as string else set hash to "" end if set AppleScript's text item delimiters to "/" set safariURI to every text item of safariURI as list if length of safariURI < 4 or item 1 of safariURI is not "http:" or item 4 of safariURI is not "hm7" then display dialog "Open HI-MATICal Archives with Safari." buttons "OK" default button "OK" with icon note return false end if if item -1 of safariURI is "" then set item -1 of safariURI to "index.html" repeat 3 times set safariURI to rest of safariURI end repeat set AppleScript's text item delimiters to ":" set localPath to safariURI as string set localFile to item -1 of safariURI as string set localPath to mySite & localPath as string tell application "Jedit4" activate open file localPath activate document 1 end tell sHash(hash) on error errMsg number errNum set AppleScript's text item delimiters to dfltDlm if errNum is -1708 then tell application "Jedit4" to activate document localFile sHash(hash) else display dialog errMsg & return & "Error# :" & errNum buttons {"Done"} default button "Done" with icon stop end if end try set AppleScript's text item delimiters to dfltDlm -- EOF