"save as" of stack file from a script

Peter Haworth pete at lcsql.com
Sat Jul 4 12:23:43 EDT 2015


*dispatch* "revSaveAsStandalone" to stack "revSaveAsStandalone" with
"<yourstackname>"

On Fri, Jul 3, 2015 at 8:24 PM Dr. Hawkins <dochawk at gmail.com> wrote:

> On Fri, Jul 3, 2015 at 5:56 PM, Richard Gaskin <ambassador at fourthworld.com
> >
> wrote:
>
> > A mainstack has a filename property, which can be set from the value
> > returned from "ask file".  Follow that with a save command and you're
> done.
>
>
> Wow.  That easy.  And it turns out that save can even take a filename
> argument . . .
>
> So it now slices & dices quite nicely.
>
> I then made two more procedures to help update/move along.
>
> My files end up with path/names like
>
> someBaseDir/yymm/yymmdd/baseProgName.yymmdda.livecode
>
>
> where the "a" in the advancing letter subversion.
>
> So this procedure now bumps the version without leaving the ice
>
>
> *on* bmpVrsn
>
>    *--bump the version by a letter*
>
>
>
>    *local* oldFlNm, newFlNm
>
>    *save* this stack
>
>
>    *put* the filename of stack (the mainstack of this stack ) into newFlNm
>
>    *put* numToChar(charToNum(char -10 of newFlNm)+1) into char -10 of
> newFlNm
>
>    *save* this stack as newFlNm
>
>
>
> *end* bmpVrsn
>
>
> and this one is for when it opens, to see if it's new day, and to make any
> needed directories and but the name:
>
> *on* ckVersDat
>
>    *--to be used when opening.   Change the file if it is not from today*
>
>
>
>    *local* today, year, month, day
>
>    *local* oldYear, oldMonth, oldDay
>
>    *local* oldFilNm, newFilNm
>
>
>
>    *put* the long date into today
>
>    *convert* today to dateitems
>
>
>
>    *put* char 3 to 4 of the first item of today into year
>
>    *put*  char -2 to -1 of ("0" & item 2 of today) into month
>
>    *put* char -2 to -1 of ("0" & item 3 of today) into day
>
>
>
>    *put* year & month & day into today
>
>
>
>    *put* the fileName of stack (the mainStack of this stack) into oldFilNm
>
>
>
>    *--figure out the old file dates*
>
>    *set* the itemDel to "/"
>
>
>
>    *if* item -2 of oldFilNm = today *then*
>
>       *--it is the same day*
>
>      * exit ckVersDat*
>
>    *end* *if*
>
>
>
>
>
>    *put* char 1 to 2 of item -2 of oldFilNm into oldYear
>
>    *put* char 3 to 4 item -2 of oldFilNm into oldMonth
>
>    *put* char 5 to 6 of item -2 of oldFilNm into oldDay
>
>
>
>    *put* item 1 to -4 of oldFilNm & "/" & year & month into newFilNm
>
>    *if* there is not a folder newFilNm *then*
>
>       *create* folder newFilNm
>
>    *end* *if*
>
>
>
>    *put* "/" & today after newFilNm
>
>    *if* there is not a folder newFilNm *then*
>
>       *create* folder newFilNm
>
>    *end* *if*
>
>
>
>    *put* "/" & char 1 to -17 of item -1 of oldFilNm & today & "a.livecode"
> after newFilNm
>
>    *if* there is not a file newFilNm *then*
>
>       *save* this stack as newFilNm
>
>    *else*
>
>       *get* dhbkAnswr ("There is already a file", newFilNm)
>
>    *end* *if*
>
> *end* ckVersDat
>
>
> Now I just need to find the routine to cause a standalone to compile . . .
>
> --
> Dr. Richard E. Hawkins, Esq.
> (702) 508-8462
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list