export source code stack

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
MarcVanCauwenberghe
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 142
Joined: Thu Feb 21, 2013 8:47 am

export source code stack

Post by MarcVanCauwenberghe » Wed Jun 18, 2014 10:00 am

Hi,
is there a plugin or any other 'easy' way to export all source of a live code stack.

Thanks for any answer.

Regards,
Marc

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

Re: export source code stack

Post by bn » Wed Jun 18, 2014 10:22 am

Hi Marc,

if you are looking for a tool that lists all scripts of a stack then there is

http://livecodeshare.runrev.com/

look for "script reporter"

Kind regards
Bernd

MarcVanCauwenberghe
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 142
Joined: Thu Feb 21, 2013 8:47 am

Re: export source code stack

Post by MarcVanCauwenberghe » Wed Jun 18, 2014 10:44 am

Thank you Bernd,

I will have to get used to looking in livecodeshare. Especially now it is getting revamped :)


Regards,
Marc

ThomasFireheart
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 48
Joined: Sat May 24, 2008 2:27 pm
Location: Indiana, USA

Re: export source code stack

Post by ThomasFireheart » Mon May 04, 2015 8:50 pm

I haven't been able to get 'Script Reporter' to work with Livecode 7. Has anyone been able to get it to work or is there any other program that would export all the source code for the stacks.

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

Re: export source code stack

Post by bn » Mon May 04, 2015 9:46 pm

Hi Thomas,
I haven't been able to get 'Script Reporter' to work with Livecode 7
it works but is very slow because for longer scripts it changes text font and size for every line. That is slow in LC 7.

There are two "scriptReporters" in livecodeshare.

One is by the original author Stewart Lynch from 2009, that one works reasonably fast.

And a second one by David Glass from 2011. David took Stewart's stack and did some cosmetic changes to it (among those to set the font and fontSize, which is slow)

You have the option to try "ScriptReporter" from Stewart or block line

378 in the stack script of script reporter by David in handler "getScript"

--formatScript "Display"--field "AllScripts"

text will not be the size and font of the preferences that you can select in David's stack.

Or you could be very patient... :)

Kind regards

Bernd

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

Re: export source code stack

Post by bn » Mon May 04, 2015 11:17 pm

Thomas,

there is another thing that does not work as expected when dispalying all scripts:
in the stack script replace function GetIconVal with the script below:

Code: Select all

function GetIconVal lnNo
   put the htmltext of of line LnNo of fld Display into dta
   put offset("src=",dta) + 5 into st
   put offset(" ",dta,st) into fn
   return char st to st + fn-2 of dta
end GetIconVal
it now looks for space instead of ">".

it will then list the object names. This applies to both "ScriptReporters" and works in 6.7.5 rc 2 and 7.0.5 rc2

Kind regards

Bernd

ThomasFireheart
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 48
Joined: Sat May 24, 2008 2:27 pm
Location: Indiana, USA

Re: export source code stack

Post by ThomasFireheart » Tue May 05, 2015 1:19 am

I made the changes and now trying to have it output the source of a simple 'clock' app (as a test before running it on an important file) - and it has been running for ~2 hrs. How long should it take to do this ?
clock-6.rev.zip
Clock
(67.49 KiB) Downloaded 303 times
Script Reporter-Edited.livecode.zip
Script Reporter (Edited)
(101.96 KiB) Downloaded 336 times

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

Re: export source code stack

Post by bn » Tue May 05, 2015 8:36 am

Hi Thomas,

you found a bug in ScriptReporter. In one of your graphics script there were only two empty lines. Script reporter chokes on this script because

Code: Select all

 repeat while the number of words in line -1 of tScript = 0
         delete last line of tScript
      end repeat
never leaves the repeat loop

I added this to the code

Code: Select all

 -- Sarah: remove any blank lines at the end & make sure there are enough to space entries
      -- Bernd: added "AND the number of lines of tScript > 0" because it would run endlessly if script has only 2 empty lines in it
      repeat while the number of words in line -1 of tScript = 0 AND the number of lines of tScript > 0
         delete last line of tScript
      end repeat
It now handles multiple empty lines as the only content of a variable graciously

What I meant with "very patient" was not 2 hours but more like a minute or two.

I upload your edited ScriptReporter with above addition.

Please tell us if this works for you.

Kind regards

Bernd
Attachments
Script Reporter-EditedBN.livecode.zip
(104.46 KiB) Downloaded 233 times

ThomasFireheart
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 48
Joined: Sat May 24, 2008 2:27 pm
Location: Indiana, USA

Re: export source code stack

Post by ThomasFireheart » Tue May 05, 2015 1:14 pm

bn wrote:Hi Thomas,
you found a bug in ScriptReporter. ... Please tell us if this works for you.
Kind regards
Bernd
Thank you. I had to delete the substacks that were password protected - or else the program displayed an error on line 47 of stack "Script Reporter" with the error [stack "Script Reporter": execution error at line 47 (Stack: stack is password protected), char 20].

Once I did that - since I didn't want the code of the password protected substacks (ChartMaker/flcDatePicker/Zygodact) - then the program worked wonderfully. It took about 3 minutes to display the code and about 10 minutes to print to PDF. But, I now have 192 pages of code and 6002 lines that I can view/review.

Again, thank you !

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

Re: export source code stack

Post by bn » Tue May 05, 2015 11:35 pm

Thomas,

3 minutes is too long, I changed the scripts again and reinstated the formatting. Now the preferences for display font/fontSize and print font/fontSize work again.
Since I also changed from going through each line of the field to set those text properties I resorted to set them in the styledText array. This speeds things up considerably.
It took about 2 seconds for displaying all scripts (after having been imported). Also changing text font/size in the preferences now takes about a couple of seconds for being displayed.

All the changes I made are in the stack script in handler "formatScript", I marked the changes.

I think this version of "ScriptReporter" is fast enough for Livecode 7 to be actually usable.

Kind regards
Bernd
Attachments
Script Reporter-EditedBN_2.livecode.zip
(104.54 KiB) Downloaded 287 times

ThomasFireheart
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 48
Joined: Sat May 24, 2008 2:27 pm
Location: Indiana, USA

Re: export source code stack

Post by ThomasFireheart » Fri May 29, 2015 1:10 pm

Yes, that works wonderfully. :)

Thank you so much !

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”