to handle enterapplication forward --- Start Add Menu Items in mainwindow sysSuspend = false remove menu "MyTools" at author sysSuspend = true add menu "MyTools" at author end add menuitem "Set HTML Dir" alias "setprojdir" to menu "MyTools" at author add menuitem "Paste Text from Clipboard" alias "PasteText" to menu "MyTools" at author add menuitem "Paste Image from Clipboard" alias "PasteImage" to menu "MyTools" at author add menuitem "Show All Objects on Page" alias "ShowObjects" to menu "MyTools" at author add menuitem "Hide Selected Object" alias "HideSelection" to menu "MyTools" at author add menuitem "Show Book Path" alias "showBookPath" to menu "MyTools" at author add menuitem "Show Number of Backgrounds in Book" alias "BgCount" to menu "MyTools" at author add menuitem "Compact Book" alias "compactbook" to menu "MyTools" at author add menu "Insert pages" in menu "MyTools" at author add menuitem "Copy Specific Page No." alias "CopyPageNo" to menu "Insert Pages" in menu "MyTools" at author add menuitem "Copy Specific Page Name" alias "CopyPageName" to menu "Insert Pages" in menu "MyTools" at author forward end --- End of Add Menu Items Section. ---------------------------------------------------------------------------------------------------------------------- to handle setprojdir ASYMI_ProjectDir of this book=ASYM_pathOfFile(name of this Book)&"HTML" end --- Paste unformatted text into a formatted field. to handle PasteText sysSuspend= false send pastespecial "text" sysSuspend = true end --- Paste Clipboard graphic as a paintobject. to handle PasteImage send pastespecial "bitmap" end --- Used to show all objects on foreground of page. to handle ShowObjects show objects of this page end --- Used to hide the currently selected object. to handle HideSelection hide selection end --- Used to show the location of the current book. to handle showBookPath local mypath,myname get asym_pathoffile(name of this book) mypath= it get asym_shortfilename(name of this book) myname= it request mypath&myname end --- Display total number of backgrounds in current book. to handle BgCount request "Backgrounds:" && backgroundcount of this book end ---Copy a specific page number to handle CopyPageNo local mypageno ask "What is the number of the page you want to copy?" mypageno=it if mypageno<>null go to page mypageno send selectpage send copy send back local tbversion tbversion=char 1 of sysversion&char 3 of sysversion send pastespecial "tb"&tbversion&&"Page" end if end ---Copy a specific page name to handle CopyPageName local mypagename ask "What is the name of the page you want to copy?" mypagename=it if mypagename<>null go to page mypagename send selectpage send copy send back local tbversion tbversion=char 1 of sysversion&char 3 of sysversion send pastespecial "tb"&tbversion&&"Page" end if end to handle compactbook --This script provided by Peter Hoyt -- writen for removing unused bitmap resources request "Want to remove the unused bitmaps from this book?" with "Yes" or "No" if it = "Yes" get resourceList(bitmap, this book) -- this makes a list of the resources bitList = it step i from 1 to itemCount(bitList); l_target = item i of bitList l_info = resourceInfo of l_target -- this gets information on item i of the resource list -- put l_target if item 1 of l_info = 0 remove resource l_target end if end step request "Removed unused bitmaps from book." end request "Want to remove the unused shared scripts from this book?" with "Yes" or "No" if it = "Yes" get resourceList(sharedscript, this book) -- this makes a list of the resources ssList = it step i from 1 to itemCount(ssList); l_target = item i of ssList l_info = resourceInfo of l_target -- this gets information on item i of the resource list -- put l_target if item 1 of l_info = 0 remove resource l_target end if end step request "Removed unused shared scripts from book." end if -- COMPACT THE BOOK request "Want to compact the book?" with "Yes" or "No" if it = "Yes" get PHH_compactBook() end end to GET PHH_compactBook sysOptimizedSave=true syssafesave=2 saveFileName = "tempFile.bak" get name of this book if it is null request "Can't compact an untitled book." return TRUE else saveFileName = ASYM_ShortFileName(name of this book) step i from 1 to 4 clear last char of saveFileName -- remove extension end saveFileName = saveFileName & ".bak" end get name of this book l_oldName = it clear sysError -- saves under new file name to compact the file save as saveFileName, true -- if the save was not successful, sysError contains an error if sysError is not null request "Save as " & saveFileName & " failed:"&&sysError break to system end if -- saves again under the original name save as l_oldName, true if sysError is not null request "Save As to original name failed:"&& sysError break to system end if request "Finished compacting: " & l_oldName & CRLF & CRLF & "You can now delete " & saveFileName & " or leave it as a backup file." return TRUE end PHH_compactBook --===================================================================================== ---Other direct functions, etc. --==================================================================================== ---Use CTRL+Shift+V to do a Pastespecial, Text Only ---CTRL+V still does a normal paste of any formatted text. to handle authorKeyDown Key, isCtrl, isShift if key = keyV and isCtrl = true and isShift = true bs = ASYM_BlockSuspend() send pasteSpecial "text" get ASYM_RestoreSuspend(bs) end forward end --====================================================================================