Getting URL to Work in specialFolderDocuments

Bernard Devlin bdrunrev at gmail.com
Mon Oct 5 04:59:06 EDT 2020


 Hi

I get a headache looking at concatenations like this.  I don't use them
unless I'm constructing a simple string.

  put URL (tHttpsServerRoot & sStoryTitle & "/" & sStoryTitle &
".livecode") into tLocalDocumentsStories & sStoryTitle & "/" & sStoryTitle
& ".livecode"

It will be a cold day in hell when I don't use Merge() to construct
non-simple strings.

*put* "blurb1" into sStoryTitle

*put* "https://dev.himalayanacademy.com/media/stories/" into
tHttpsServerRoot

*put* specialFolderPath("Documents") & "/SivaSivaApp/media/stories/" into
tLocalDocumentsStories

*if* char -1 of tHttpsServerRoot is "/" *then* *delete* char -1 of
tHttpsServerRoot ## deleting "/" to make merge() template clearer

*if* char -1 of tLocalDocumentsStories is "/" *then* *delete* char -1 of
 tLocalDocumentsStories

*put* merge(          "[[tHttpsServerRoot
]]/[[sStoryTitle]]/[[sStoryTitle]].livecode" ) into tSourceURL

*put* merge( "binfile:[[tLocalDocumentsStories]]/[[
sStoryTitle]]/[[sStoryTitle]].livecode" ) into tDestURL
put URL  tSourceURL into URL tDestURL


On each of the above lines one can use breakpoints to check the values of
the variables and at the last line check that the URLs to use are correct.

Merge() will ignore spaces within [[]] and outside of the quotes around the
template string, so one can line up placeholders to check that all the
template parts match visually.

HTH
Bernard

On Fri, Oct 2, 2020 at 11:00 PM Sannyasin Brahmanathaswami via use-livecode
<use-livecode at lists.runrev.com> wrote:

> on dataServerStack
>    local tHttpsServerRoot,tLocalDocumentsStories
>    put "https://dev.himalayanacademy.com/media/stories/" --into
> tHttpsServerRoot
>    put specialFolderPath("Documents") & "/SivaSivaApp/media/stories/" into
> tLocalDocumentsStories
>    put URL (tHttpsServerRoot & sStoryTitle & "/" & sStoryTitle &
> ".livecode") into tLocalDocumentsStories & sStoryTitle & "/" & sStoryTitle
> & ".livecode"
> end dataServerStack
>
> it goes badly to documents folder,
>
> on dataServerStack
>    local tHttpsServerRoot,tLocalDocumentsStories
>    put "https://dev.himalayanacademy.com/media/stories/" into
> tHttpsServerRoot
>    put specialFolderPath("Documents") & "/SivaSivaApp/media/stories/" into
> tLocalDocumentsStories
>    put URL (tHttpsServerRoot & sStoryTitle & "/" & sStoryTitle &
> ".livecode") into tLocalDocumentsStories & sStoryTitle & "/" & sStoryTitle
> & ".livecode"
> end dataServerStack
>
> it goes badly to documents folder,
>
> ?
> put URL (tHttpsServerRoot & sStoryTitle & "/" & sStoryTitle & ".livecode")
> into tLocalDocumentsStories & sStoryTitle & "/" & sStoryTitle & ".livecode"
>
> Compile error line 119 (Handler: bad command) near "&", char 84
>
>
> BR
>
>
>     _______________________________________________
>     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
>
> _______________________________________________
> 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