Help file issues are issues

[file:///Applications/Script%20Debugger%207b/Script%20Debugger.app/Contents/Resources/English.lproj/sd7help/indexfolder/developfolder/debug.html](file:///Applications/Script%20Debugger%207b/Script%20Debugger.app/Contents/Resources/English.lproj/sd7help/indexfolder/developfolder/debug.html)

On the Debug page (above), the first image (the paid icon) isn’t displaying.

(sorry for the topic name but it wouldn’t let me create a topic that wasn’t a sentence, what’s up with that?)

About the icon, in the doc the bug is on a white circle, but in the help files it’s just the bug. Would it be better to be consistent?

[file:///Applications/Script%20Debugger%207b/Script%20Debugger.app/Contents/Resources/English.lproj/sd7help/indexfolder/developfolder/editfolder/editingafolder/clipping.html](file:///Applications/Script%20Debugger%207b/Script%20Debugger.app/Contents/Resources/English.lproj/sd7help/indexfolder/developfolder/editfolder/editingafolder/clipping.html)

On the clippings page, the image for the clippings menu is just the menu icon. Maybe it would be better to show it as a menu, with the scripts menu next to it and maybe the built in selections displaying?

[file:///Applications/Script%20Debugger%207b/Script%20Debugger.app/Contents/Resources/English.lproj/sd7help/indexfolder/developfolder/editfolder/editingafolder/completion.html](file:///Applications/Script%20Debugger%207b/Script%20Debugger.app/Contents/Resources/English.lproj/sd7help/indexfolder/developfolder/editfolder/editingafolder/completion.html)

In the Code Completion page the image for Cocoa terms doesn’t look right. It’s kind of blurry and hard to read.

That might be because two different kinds of selections are on top of each other, maybe redo it with an item further down in the list selected, the way the Keyboard Shortcuts image is done?

[file:///Applications/Script%20Debugger%207b/Script%20Debugger.app/Contents/Resources/English.lproj/sd7help/indexfolder/developfolder/editfolder/scriptwifolder/viewfolder/tabstops.html](file:///Applications/Script%20Debugger%207b/Script%20Debugger.app/Contents/Resources/English.lproj/sd7help/indexfolder/developfolder/editfolder/scriptwifolder/viewfolder/tabstops.html)

On Tab Stops page, maybe an image showing what the tab stops look like?

file:///Applications/Script%20Debugger%207b/Script%20Debugger.app/Contents/Resources/English.lproj/sd7help/indexfolder/developfolder/runfolder/record.html

I think on the Record page where the Paid Icon image is displayed should make clear it’s the Explorer view that’s paid

file:///Applications/Script%20Debugger%207b/Script%20Debugger.app/Contents/Resources/English.lproj/sd7help/indexfolder/developfolder/runfolder/times.html

The Times Page, I thing it would be better if the title were:

Timing your scripts, or Script Timing.

file:///Applications/Script%20Debugger%207b/Script%20Debugger.app/Contents/Resources/English.lproj/sd7help/indexfolder/openingafolder/savefolder/formatsfolder/applicat.html

On the Application page:
The Enhanced applet icons? Is that what you’re going with?

file:///Applications/Script%20Debugger%207b/Script%20Debugger.app/Contents/Resources/English.lproj/sd7help/indexfolder/referencfolder/windows.html

On the Windows Page, the bullet list looks odd to have the plain-text “The” with the rest. Can that be improved?

file:///Applications/Script%20Debugger%207b/Script%20Debugger.app/Contents/Resources/English.lproj/sd7help/indexfolder/referencfolder/helpglossaryfolder/asoc.html

I think code completion image on this glossary page is the same image I complained about above, just on a different page.

file:///Applications/Script%20Debugger%207b/Script%20Debugger.app/Contents/Resources/English.lproj/sd7help/indexfolder/referencfolder/helpglossaryfolder/sdefglossary.html

On the SDEF glossary page,

Is it possible to find a link for this video?

NOTE: Explaining how to write an sdef file for a bundle is beyond the scope of this documentation; watch WWDC 2013 video 416 to get started.

file:///Applications/Script%20Debugger%207b/Script%20Debugger.app/Contents/Resources/English.lproj/sd7help/indexfolder/referencfolder/windowsfolder/toolbar.html

On the Toolbar page, the images look kind of clunky, thanks to the paid image icon.

Would it be possible to put a little space between the images stacked on each other, and make the sizes of the toolbar par consistent. Maybe having which space on the left side of the non-paid toolbar to make them line up nicely?

OK, I’m done. I’ve looked at the images and skimmed the text of every help file page. This is a very impressive document. I think the first one, about the paid image is the only real problem I found. Everything else is just suggestions or impressions, to take for what they’re worth.

Also, just navigating help, I was worried I wasn’t following all the links or seeing every single page, so hacked together this script. Still a work in progress, but I’m pretty confident I visited every page.

use framework "Foundation"
use AppleScript version "2.4"
use scripting additions
use script "Myriad Tables Lib"

-->  Script Debugger 7.0 (7A35)
property sdVersionForHelp : "Script Debugger-7.0-7A35" -- -
property sdHelpDir : "sd7help"
property sdAppId : "com.latenightsw.ScriptDebugger7"
property debugging : false -- logging
property screenFraction : 3 --how much screen should results take
property previousSearchCount : 20 -- how many previous searches to remember
property allHelpTextFiles : {}
property fullScreenWindowBounds : {}
property helpFileList : {}
property helpTextFolder : ""
property htmlResultsPage : ""
property lastSearch : "Script Debugger Help"
property logFile : ""
property logInfo : ""
property previousFinds : {}
property previousSearches : {}
property sdHelpFileLocation : ""
property currentVersionInfo : ""
property searchDate : ""
property helpFileDisplayList : {}

property slugDate : ""
property startingTime : ""
property workFlowFolder : ""
property searchResultsFolder : ""
property sdLocation :  ""
property updateIsNeeded : true
property lastSelectedRow : {0}

on run
   
   set currentSDVersion to SDVersion()
   
   --
   set updateIsNeeded to true --note out when not debugging
   --
   if helpFileDisplayList is {} then
      set lastSelectedRow to {0}
      
      set sdHelpFileLocation to HelpFileLocation()
      if debugging then UpDateLog("Locating Help File", logFile)
      LocateHelpFiles(sdHelpFileLocation)
      --Sets helpFileList
      
      set AppleScript's text item delimiters to {"<Title>", "</Title>"}
      
      set helpFileDisplayList to {}
      repeat with thisHelpFile in helpFileList
         set thisHelpFile to thisHelpFile as item
         set helpFileTitle to read thisHelpFile
         set helpFileTitle to paragraph 1 of text item 2 of helpFileTitle
         set the end of helpFileDisplayList to {helpFileTitle, "", thisHelpFile as item}
      end repeat
   end if
   set markedFiles to {}
   
   repeat
      set {chosenItem, chosenFile, buttonNumber, helpFileDisplayList} to DisplayHelpTable()
      if buttonNumber is 2 then
         set the end of markedFiles to item chosenItem of helpFileDisplayList
         set item 2 of item chosenItem of helpFileDisplayList to "S"
      else
         set item 2 of item chosenItem of helpFileDisplayList to "√"
         set fileToDisplay to item 3 of item 1 of chosenFile
         my DisplayHelpFile(fileToDisplay)
      end if
   end repeat
end run



on DisplayHelpFile(htmlDisplayFile)
   if fullScreenWindowBounds is {} then -- First run only, learns size of screen
      tell application "Finder" to set fullScreenWindowBounds to (bounds of desktop's window)
      set {windowLeft, windowTop, windowRight, windowBottom} to fullScreenWindowBounds
      set {windowLeft, windowTop} to {25, 23}
      set fullScreenWindowBounds to {windowLeft, windowTop, windowRight, windowBottom}
   end if
   
   tell application "System Events"
      set helpFileURL to URL of (htmlDisplayFile as alias)
   end tell
   
   tell application "Google Chrome"
      set helpWindow to make new window
      set URL of tab 1 of helpWindow to helpFileURL
      tell helpWindow
         set {windowLeft, windowTop, windowRight, windowBottom} to fullScreenWindowBounds
         set bounds to {(windowRight / screenFraction) * (screenFraction - 1), windowTop, windowRight, windowBottom}
      end tell
   end tell
end DisplayHelpFile

on DisplayHelpTable()
   set nextRow to item 1 of lastSelectedRow
   set nextRow to nextRow + 1
   if nextRow > (count of helpFileDisplayList) then
      set nextRow to 1
   end if
   set helpFileTable to make new table with data helpFileDisplayList ¬
      with title ¬
      "Help Files" with prompt ¬
      "Select which file to open" multiple selections allowed false ¬
      can add and delete false ¬
      column headings {"Help File Topic", "Seen"} ¬
      row numbering false ¬
      initially selected rows {nextRow} ¬
      empty selection allowed false ¬
      multiple lines allowed false ¬
      with double click means OK
   
   modify table helpFileTable ¬
      OK button name ¬
      "View" OK button is default true ¬
      cancel button name ¬
      "Finish" extra button name ¬
      "Save this one" highlighted rows {} ¬
      row dragging false ¬
      column reordering false ¬
      hidden cancel button false ¬
      initial position {600.0, 0.0, 393.0, 900.0}
   
   set tableResults to display table helpFileTable ¬
      with extended results
   set modifiedTable to values returned of tableResults
   set lastSelectedRow to rows selected of tableResults
   set valueSelected to values selected of tableResults
   set buttonNumber to button number of tableResults
   set finalPosition to final position of tableResults
   
   return {lastSelectedRow, valueSelected, buttonNumber, modifiedTable}
   --final position:{731.0, -38.0, 433.0, 952.0}
end DisplayHelpTable
-------------

on HelpFileLocation()
   --on HelpFileLocation(mainFileName, appId, HelpFileDirectory)
   --set helpFilePath to (path to resource mainFileName in bundle (path to appId) in directory HelpFileDirectory)
   set helpFilePath to (path to resource "toc.html" in bundle (path to application id (sdAppId as text)) in directory sdHelpDir)
   tell application "Finder"
      set sdHelpFileLocaton to container of helpFilePath as alias
      if debugging then open sdHelpFileLocaton
   end tell
   return sdHelpFileLocaton
end HelpFileLocation

on LocateHelpFiles(sdHelpFileLocaton)
   set helpFileList to {}
   ProcessAFolder(sdHelpFileLocaton)
   
end LocateHelpFiles



on SDVersion()
   set mustUpdate to false
   set sdPath to (path to application id sdAppId)
   if sdPath is not sdLocation then
      set sdLocation to sdPath
      set sdVersionForHelp to "" --forces an update
   end if
   set sdPath to POSIX path of sdPath
   set sdPlist to quoted form of (sdPath & "Contents/Info.plist")
   set _cmd to "/usr/libexec/PlistBuddy -c Print:CFBundleShortVersionString -c Print:CFBundleVersion " & sdPlist
   set currentVersionInfo to paragraphs of (do shell script _cmd)
   set currentVersionInfo to "Script Debugger " & item 1 of currentVersionInfo & " (" & item 2 of currentVersionInfo & ")"
   
   set AppleScript's text item delimiters to {"-"}
   set currentVersionInfo to words of currentVersionInfo as text
   return currentVersionInfo
end SDVersion

-------------

on FixText(HelpFileText, thisHelpFile)
   tell application "System Events" to set helpFileURL to URL of thisHelpFile
   set HelpFileText to the rest of paragraphs of HelpFileText
   set item 1 of HelpFileText to helpFileURL
   set AppleScript's text item delimiters to {return}
   set HelpFileText to HelpFileText as text
   set HelpFileText to ReplaceAllInText(return & return & return, return & return, HelpFileText)
end FixText

on ReplaceText(findString, replaceString, textToFix)
   set saveTID to AppleScript's text item delimiters
   set AppleScript's text item delimiters to findString as list
   set textToFix to every text item of textToFix
   set AppleScript's text item delimiters to replaceString as list
   set textToFix to textToFix as text
   set AppleScript's text item delimiters to saveTID
   return textToFix
end ReplaceText

on ProcessAFolder(thisFolder)
   tell application "Finder"
      set myHelpFiles to (every file of thisFolder whose name extension is "html") as alias list
      set myFolders to every folder of thisFolder as alias list
   end tell
   set helpFileList to helpFileList & myHelpFiles
   repeat with aFolder in myFolders
      my ProcessAFolder(aFolder)
   end repeat
end ProcessAFolder

on ReplaceAllInText(findString, replaceString, textToFix)
   --findString: text or a list of text strings (all will be replaced)
   --replaceString: texx or a list of text strings (only first will be used)
   --textToFix: text
   set saveTID to AppleScript's text item delimiters
   repeat
      set AppleScript's text item delimiters to findString as list
      set textToFix to every text item of textToFix
      if (count of textToFix) = 1 then
         set textToFix to textToFix as text
         exit repeat
      end if
      set AppleScript's text item delimiters to {replaceString}
      set textToFix to textToFix as text
      if replaceString is in {findString} then exit repeat -- exits after one pass to avoid infinite loop
   end repeat
   set AppleScript's text item delimiters to saveTID
   return textToFix as text
end ReplaceAllInText

on UpDateLog(logInfo, myFile)
   set logTime to (current date)
   set elapsedTime to (time of (logTime) as integer) - startingTime
   log elapsedTime & tab & logInfo
   set logTime to short date string of logTime & " " & time string of logTime & " Seconds since start: " & elapsedTime as text
   set textToWrite to return & logTime & return & tab & logInfo & return
   
   try
      set openFile to open for access file myFile with write permission
   on error errMsg number errNum
      close access file myFile
      set openFile to open for access file myFile with write permission
   end try
   set startPoint to get eof file myFile
   write textToWrite to openFile starting at startPoint
   close access openFile
   return myFile
end UpDateLog

on WriteToFile(myFile, textToWrite)
   try
      set openFile to open for access file myFile with write permission
   on error errMsg number errNum
      close access myFile
      set openFile to open for access file myFile with write permission
   end try
   set eof of openFile to 1
   write textToWrite to openFile
   close access openFile
   return myFile
end WriteToFile


Thanks for a great job! I’ve followed up on some, and noted some for future reference. Just FYI:

Yes.

It’s the same resolution as the others. It’s not very pretty, but I think accuracy wins out here — that’s what the user will see when typing.

Both are used within the app. I think the one without the background fits better on a colored background.