Export long texts to PDF?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3990
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Export long texts to PDF?

Post by bn » Sun Apr 24, 2022 11:44 am

Richmond,

here it is. I do not remember what I edited in this very useful stack by Stewart Lynch and Sarah Reichelt.
Nor do I know why Cyril Pruszko put that version on his site

Script Reporter-EditedBN_2.livecode.zip
(104.54 KiB) Downloaded 84 times

Kind regards
Bernd

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Export long texts to PDF?

Post by richmond62 » Sun Apr 24, 2022 11:56 am

Thank you very much: that will be very useful.

stam
Posts: 2634
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Export long texts to PDF?

Post by stam » Sun Apr 24, 2022 1:06 pm

richmond62 wrote:
Sun Apr 24, 2022 8:14 am
https://youtu.be/1x3mZ1nLql8

Kevin tells it like it is,
Thanks Richmond

stam
Posts: 2634
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Export long texts to PDF?

Post by stam » Sun Apr 24, 2022 2:16 pm

bn wrote:
Sun Apr 24, 2022 11:44 am
Richmond,

here it is. I do not remember what I edited in this very useful stack by Stewart Lynch and Sarah Reichelt.
Nor do I know why Cyril Pruszko put that version on his site


Script Reporter-EditedBN_2.livecode.zip


Kind regards
Bernd
Thanks for the link Bernd... seemed interesting so i open one of my apps in it and it seemed to go into a tailspin, with what looked like an endless loop that had to be force-exited... (the app does link into some libraries and the liveCloud libs as well, one of which is password protected, although i wasn't asked for a password...).

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Export long texts to PDF?

Post by FourthWorld » Sun Apr 24, 2022 4:55 pm

One of my first projects with HyperCard was a script reporter. When I moved on to SuperCard I made a couple more, then some for MC, and then it dawned on me: while they were fun to make, I never actually used one for any production purpose.

For myself, I've found it more useful to be able to navigate through code in vivo more efficiently, and getting around inside of living projects has been more of a focus.

But I see interest in these things remains somewhat constant, so maybe I'm missing something.

What do you folks do with the output from script reporters, and how often do you use those files relative to reading scripts directly in objects?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Export long texts to PDF?

Post by richmond62 » Sun Apr 24, 2022 5:05 pm

What do you folks do with the output from script reporters
Personally I intend to print out some of my very long scripts from Devawriter Pro so that
I can work through them in the garden, in the sunshine, with no computer to distract me.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3990
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Export long texts to PDF?

Post by bn » Sun Apr 24, 2022 7:16 pm

stam wrote:
Sun Apr 24, 2022 2:16 pm
bn wrote:
Sun Apr 24, 2022 11:44 am
Richmond,
here it is. I do not remember what I edited in this very useful stack by Stewart Lynch and Sarah Reichelt.
Nor do I know why Cyril Pruszko put that version on his site
Script Reporter-EditedBN_2.livecode.zip
Kind regards
Bernd
Thanks for the link Bernd... seemed interesting so i open one of my apps in it and it seemed to go into a tailspin, with what looked like an endless loop that had to be force-exited... (the app does link into some libraries and the liveCloud libs as well, one of which is password protected, although i wasn't asked for a password...).
@Stam
I had a look at the stack an indeed it only checks if the mainStack is password protected, not if a subStack is password protected. I changed that in the script. Password protected substacks are omitted now. And it worked.
However I tested with a beast of a stack: about 170,000 objects that could potentially have scripts and the sum of the script-lines is over 4.5 million lines.
That choked some formatting routines of Script Reporter. (disclaimer: I did not write that beast of a stack).
I did however notice that some scripts were not very efficiently written: field access for getting repeatedly at lines etc.
I skipped some formatting for the display of all scripts in the main field and I got it to work however for the total of the script in plain text. Individual scripts are formatted as in the Script Editor and then some.

Historically I edited only one potential endless loop and sped up one formatting routine for display. I was not involved otherwise in that stack and have not used it except when I edited it in 2015.

@Richard: I agree that the idea of a "Stack Analyser" is intriguing but in practice I never or rarely used one.

@Richmond: did "Script Reporter" work for your project? If not I could probably coax it into reporting. I see a point in sitting in the sun and fanning fresh air with a bunch of printouts of the scripts of Devawriter Pro. Just tell me

Kind regards
Bernd

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Export long texts to PDF?

Post by richmond62 » Sun Apr 24, 2022 7:48 pm

I did however notice that some scripts were not very efficiently written
That is one of the reasons I need to have a 'distanced' look at the scripts in my Devawriter. 8)

bobcole
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 133
Joined: Tue Feb 23, 2010 10:53 pm
Location: Saint Louis, Missouri USA

Re: Export long texts to PDF?

Post by bobcole » Mon Apr 25, 2022 4:11 am

I have the Script Reporter version 1.1 stack and am now using the version (1.2) from Bernd's link.
I have always liked the Script Reporter (SR) app and have used it to produce searchable documents with all of the scripts in a stack. Handy for searching.
Today I had an issue with a button that did not appear to have a name. SR choked on the error.
The button's name was: <-- Back
The button's name was not displayed in SR's Display field because SR puts object names are in the Display field's htmlText.
The backward symbol and hyphens indicate a comment in html so the button's name was ignored.
The problem was fixed when I changed the button's name to: < Back
Tricky problem to diagnose but simple to fix.
Bob

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3990
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Export long texts to PDF?

Post by bn » Mon Apr 25, 2022 9:57 am

bobcole wrote:
Mon Apr 25, 2022 4:11 am
Today I had an issue with a button that did not appear to have a name. SR choked on the error.
The button's name was: <-- Back
The button's name was not displayed in SR's Display field because SR puts object names are in the Display field's htmlText.
The backward symbol and hyphens indicate a comment in html so the button's name was ignored.
The problem was fixed when I changed the button's name to: < Back
Tricky problem to diagnose but simple to fix.
Bob
Bob,

I try to avoid stuff like this by setting the name of e.g. a button to, well a name. If I want to display "<-- Name" I set the label of the button to that.
I am a bit superstitious with regards to funny characters in Names and the label is "user land".

Kind regards
Bernd

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Export long texts to PDF?

Post by FourthWorld » Mon Apr 25, 2022 4:07 pm

bobcole wrote:
Mon Apr 25, 2022 4:11 am
I have the Script Reporter version 1.1 stack and am now using the version (1.2) from Bernd's link.
I have always liked the Script Reporter (SR) app and have used it to produce searchable documents with all of the scripts in a stack. Handy for searching.
If all that code and the extra step of using it is for searching, sounds like an opportunity for a better search tool for stack files.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Export long texts to PDF?

Post by jacque » Mon Apr 25, 2022 5:49 pm

I use the advanced Find in the script editor. I suspect it's largely ignored but it's really very useful. You can search many different ways, including regex, and in a variety of different areas: current tab, open tabs, whole stack, whole stack file, and more.

The best part is the list of found results which allow you to jump to any instance immediately. The main Find and Replace in the IDE menu is also useful but for searching scripts I prefer the editor's version.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

bwmilby
Posts: 438
Joined: Wed Jun 07, 2017 5:37 am
Location: Henrico, VA
Contact:

Re: Export long texts to PDF?

Post by bwmilby » Mon Apr 25, 2022 10:36 pm

I also find doing a search in Atom useful, but the main reason I externalize my stack’s scripts is for version tracking. Git makes it very easy to see the changes to scripts over time. ScriptTracker provides this to me without the need to convert everything to real script only stacks (the files could easily be SOS but they are not linked that way).
Brian Milby

Script Tracker https://github.com/bwmilby/scriptTracker

stam
Posts: 2634
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Export long texts to PDF?

Post by stam » Tue Apr 26, 2022 8:28 am

jacque wrote:
Sat Apr 23, 2022 6:26 pm
Klaus' suggestion is the recommended way. See the pageHeights property in the dictionary to know how much to scroll the field on each iteration of the loop.
Dear Jacque, thank you for that - pageHeights is amazing, and i had no idea it was there!
Makes it very easy to create a 'print preview' within LC as well...

It's slightly annoying that you kinda had to know about it to find it - it's only 'association' in the Dictionary is 'Field' and it's not linked to printing in any way... all printing related features really should be grouped together in the documentation...

In the end i did also find this in the LiveCode User Guide.pdf -- which again is another pet peeve of mine.
Why create a great resource like the User Guide and then just dump it in a PDF file?
Why not have this online so it can be searchable by <insert your preferred search engine here>, preferably with some search engine optimisation to increase exposure?
Granted, it's a non-trivial cost to convert this to 'nice' html and not just dumping the entire pdf into a single file with for example the free https://pdf.online/convert-pdf-to-html, but maintenance would be trivial as the user guide is not updated that often...
But enough mumbling ;)

BTW i did also note that pageHeights links to formatForPrinting which seems like another gotcha i may have missed had i not scrutinised the pageHeights entry... although not sure how important that is for PDF creation?

Anyway thanks once again for the invaluable help!
Stam

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Export long texts to PDF?

Post by richmond62 » Tue Apr 26, 2022 8:38 am

it's a non-trivial cost to convert this to 'nice' html
It maybe 100% trivial as, in the Linux versions of LiveCode the Documentation
opens in a browser.

Also: surely (?) the clever thing to do is extract the bits of the User Guide that differ from the Dictionary
and integrate them into the Dictionary.

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”