The fileName: When using it in scripts, how to avoid modifiying it for each user ?

André.Bisseret Andre.Bisseret at inria.fr
Thu Nov 2 05:13:57 CST 2006


Hi Jim,
Thanks to your advices, my app is working nicely now (at least on  
this point :-))
Changes in "userName" and location of the app'file on his/her disk  
are taken into account automatically when setting the fileName(s) by  
script.

I thank you very much

Best regards from Grenoble
André


Le 1 nov. 06 à 17:08, Jim Ault a écrit :

>
> On 11/1/06 9:30 AM, "André.Bisseret" <Andre.Bisseret at inria.fr> wrote:
>
>> Hi,
>> I have an app a substack of which is a model. This model is clone in
>> ordre to create other stacks. These created stacks  are main stacks
>> (not substacks) because they are populated with data which have to be
>> saved. They are accumulated in a folder (say « theFolder »).
>>
>> So, for each created stack, I must set its fileName in order to place
>> it into « theFolder » ; also I must use the fileName in order to be
>> able to re-open on such stack from «theFolder ». (in each of these
>> cases, if I simpy use the stack name, that does not work).
>>
>> Ex : stack « /Users/user’name/desktop/theFolder/oneStackName »
>>
>> My problem arises when I want to give my app to another user who will
>> use it with stackRunner (or as a standalone if I save it under this
>> form) :
>> then, in several scripts I must change the fileName ; specifically ,
>> the « user’name ». But also, possibly the destination (« theFolder »
>> or even « desktop/theFolder », depending on where the user want to
>> put this folder).
>>
>> If I want several users get my app., this change becomes
>> unacceptable (even not possible).
>>
>> Is it a way to get rid of this constraint ?
>
>
> First,
> the stack filename contains the path to its location.  Use that as the
> 'home' or 'root' folder name.
>
> Second, on starting the app, get a list of the folders in that same  
> folder
> your stack is currently in.  If there are none, then ask the user  
> for a
> folder name (or create a "defaultHome" folder)(or
> set the itemdel to "/"
> put item 3 of the filename of this stack into tUser
> creae folder tUser&"Data"
>
> Third, use the defaultHome folder until the user chooses to do it
> differently and names the folder to his liking.  At this time, move  
> all of
> the files from the defaultHome to the new folder, then delete the old
> defaultHome folder.  On start, this will be the only folder that  
> contains
> the dataFile you need.  Now your stack startup routine will get a  
> list of
> folders, then look inside until it finds the 'userData.txt file you  
> saved
> previously.
>
> Fourth, in your defaultFolder, save a text file with the names of  
> the stacks
> the user may choose in the future, but use default names in case  
> they don't
> make the effort.
>
> Hope this helps.
>
> Jim Ault
> Las Vegas
>
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>




More information about the use-livecode mailing list