Can't change directory with shell(cd)
Michael D Mays
michael.rr at mdmays.com
Thu May 1 22:56:42 EDT 2008
It was the two separate shell calls. I had enclosed file name in
quotes. I neglected to type them into my email (my variable names in
my script were too silly to cut and paste).
The reason I was using shell() instead of a built in Rev command were:
1.) I didn't know about it :)
2.) My first objective was to copy a file into a folder. I had used
revCopyFile and it was taking 15 seconds to copy a small file. I new
I could use ditto and it would be (is) much faster. So I decided to
do the rest with shell().
Do you have cr defined as return?
Thanks!
Michael
On May 1, 2008, at 6:04 PM, Sarah Reichelt wrote:
> On Fri, May 2, 2008 at 8:54 AM, Michael D Mays
> <michael.rr at mdmays.com> wrote:
>> I'm doing this
>>
>> answer folder ""
>> put it into aPath
>> put "cd "&aPath into aRequest
>> put aRequest into fld 1
>> put shell(aRequest) into fld 2
>> put shell("ls") into fld 3
>>
>> No matter which folder I chose, Rev's 'Home' folder is the directory
>> listed.
>> When I cut and paste fld 1 into the Terminal, ls works as expected.
>
> I found 2 problems with this. Firstly, if the folder name contains a
> space, this will not work, so I surrounded the aPath with single
> quotes. Secondly, I think you are using 2 separate instances of the
> shell as you do the commands in two separate shell calls. If you
> combine them into a single command and just use one shell call, it
> works.
>
> Here is my edited version of your script:
>
> answer folder ""
> put it into aPath
> put "cd '" & aPath & "'" into aRequest
> put aRequest & cr & "ls" into tCmd
> put shell(tCmd) into fld 1
>
> However, why do you want to use a shell command for this, when the
> same functionality is built into Revolution commands? You could try
> something like this:
>
> answer folder ""
> put it into aPath
> set the defaultfolder to aPath
> put the files & cr & the folders into fld 1
>
> Cheers,
> Sarah
> _______________________________________________
> 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