Re: Help browser font size, code timing, RegEx
Re: Help browser font size, code timing, RegEx
- Subject: Re: Help browser font size, code timing, RegEx
- From: "Christopher C. Stone" <email@hidden>
- Date: Sat, 10 Mar 2001 20:21:11 -0600
>
The only hard part I can see is a routine for formatting the browser URL
>
into a path for Helpviewer.
This is just to demonstrate the various steps.
---------------------------------------------------------------------------
-- I personally would use RegEx commands for find/replace, but this handler
-- will suffice.
on findReplace(theText, findString, replaceString)
set AppleScript's text item delimiters to {findString}
set theText to text items of theText
set AppleScript's text item delimiters to {replaceString}
set theText to theText as string
end findReplace
-- Get the original Help Viewer page
tell application "Help Viewer"
set thePage to current file as string
end tell
--> result: "Minerva:System Folder:Help:AppleScript Help:at:pgs:at40.htm"
-- Munge the filepath to a suitable URL format for Explorer.
set thePage to findReplace(thePage, ":", "/")
set thePage to "file:///" & thePage
--> result: file:///Minerva/System Folder/Help/AppleScript Help/at/pgs/at40.htm
-- Open the Help Viewer page in Explorer.
tell application "Explorer"
Activate
OpenURL thePage toWindow 0
end tell
-- Get the file URL of the Help Viewer page from Explorer.
tell application "Explorer"
try
set fWin to item 1 of (ListWindows)
set theURL to item 1 of (GetWindowInfo fWin)
on error
beep
end try
end tell
-->rslt:file:///Minerva/System Folder/Help/AppleScript Help/at/pgs/at40.htm
-- Munge the URL back into a filepath.
if theURL starts with "file" then
set theURL to findReplace(theURL, "file:///", "")
set theURL to findReplace(theURL, "/", ":")
set theURL to findReplace(theURL, " ", "")
-- Open the page in Help Viewer.
tell application "Help Viewer"
activate
open alias theURL
end tell
end if
---------------------------------------------------------------------------
--
Best Regards,
Christopher Stone
______________________________
StoneWorks Computer Consulting
email@hidden