Book script to help in development

MODIFIED August 18, 2018 with slight improvements.
PowerPac enabled books prefer to be opened in author mode.
The following book script will make your books open in author mode by just double-clicking on the file name in Windows Explorer or other file manager.
What does this do?
PowerPac enabled books prefer to be opened in author mode.
The following book script will make your books open in author mode by just double-clicking on the file name in Windows Explorer or other file manager.
- Code: Select all
--CLIFTON: FORCES ALL BOOKS TO OPEN AND GO TO AUTHOR MODE
to handle enterApplication
forward
--ENABLE NEXT LINE TO DISABLE FORCING AUTHOR MODE AND MAXIMIZING WINDOW
--break
linkDLL32 "user32" --MAYBE GETS LINKED TWICE BUT THAT'S OKAY
int UpdateWindow(DWORD)
int RedrawWindow(DWORD, DWORD, DWORD, DWORD)
--USUALLY get RedrawWindow(windowHandle32 of mainWindow, 0, 0, 129)
--129 SIGNIFIES TO UPDATE ENTIRE CLIENT AREA INCLUDE ALL ITS CHILD ELEMENTS
--PARAMETER 2 IS A STACK OF 4 INTEGERS INDICATING THE RECTANGLE OF THE REDRAW AREA ... 0 FORCES REDRAW OF WHOLE CLIENT AREA
--FOURTH PARAMETER IS THE FLAG(S) THAT CONTROL REDRAWING OF THE WINDOW
--RDW_INVALIDATE = 0x0001
--RDW_INTERNALPAINT = 0x0002
--RDW_VALIDATE = 0x0008
--RDW_NOINTERNALPAINT = 0x0010
--RDW_NOERASE = 0x0020
--RDW_NOCHILDREN = 0x0040
--RDW_ALLCHILDREN = 0x0080
--RDW_UPDATENOW = 0x0100
--RDW_ERASENOW = 0x0200
--RDW_FRAME = 0x0400
--RDW_NOFRAME = 0x0800
end linkDLL32
if sysLevel = "reader" then
send author
end if
timerID of self = timerStart(single,300,500,self)
end enterApplication
to handle enterPage
forward
if item 1 of clientSize of this window < item 1 of size of parent of currentPage of this window then
item 1 of clientSize of this window = item 1 of size of parent of currentPage of this window
end if
if item 2 of clientSize of this window < item 2 of size of parent of currentPage of this window then
item 2 of clientSize of this window = item 2 of size of parent of currentPage of this window
end if
end enterPage
to handle timerNotify timerID
--CLIFTON: ADDED THIS TO SUPPORT ENTERBOOK HANDLER ABOVE
if timerID = timerID of self then
--state of viewer id 0 of self = "maximized" --ENABLE TO MAXIMIZE WINDOW --OPTIONAL (USE TO MAXIMIZE MAIN WINDOW)
get RedrawWindow(windowHandle32 of this window, 0, 0, 129)
get timerStart(single, 750, 500, self) --Rerun timer to activate window
else
forward
clear timerID of self
activate viewer id 0 of self
end if
end timerNotify
--END OF MOFIFICATIONS BY CLIFTON
What does this do?
- Forces the book to open and immediately go to author mode before attempting to run any action code.
- Once in author mode, the script will do one of two things: (1) it will maximize your authoring window (enable the fullscreen line in the code); (2) and it will set your authoring mode to display the largest page in your book based on navigation during your authoring session.
- Paste the above openScript code at book level.
- Save your book. Thereafter, each time you open your book, it will immediately go to author mode and maximize of set the page size to be completely visible as you navigate during your authoring session.