• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Help browser font size, code timing, RegEx
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: Help browser font size, code timing, RegEx (From: Andrew Wylie <email@hidden>)

  • Prev by Date: Re: scripting keyboard strokes to action menu commands
  • Next by Date: Re: How did it end?
  • Previous by thread: Re: Help browser font size, code timing, RegEx
  • Next by thread: Re: Help browser font size, code timing, RegEx
  • Index(es):
    • Date
    • Thread