Re: Can't change directory with shell(cd)

2008-05-02 Thread Michael D Mays
Richard Hillen in September of last year was claiming on this list 25  
seconds to do a revcopyfile.


I typed CR into the dictionary and couldn't find it. I think I must  
have added an extra " or quote when I was  typing.


Michael

On May 1, 2008, at 10:06 PM, Sarah Reichelt wrote:

 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().


Something seems wrong there. However if using ditto works for you,
then that's fine.
I haven't done much with copying files. Moving them is very fast using
the rename command, but copying is different. If the files are small
you could try:
  put URL ("binfile:" & tOriginalFile) into URL ("binfile:" &  
tNewFile)

but if they are larger than a few MB, that might not be so good as it
reads the entire file into memory before writing it out again.



 Do you have cr defined as return?


"cr" is defined in Rev. I prefer using it instead of "return" because
"return" also means return a value from a function and I prefer to
make sure they are obviously different. And it's shorter to type :-)

Cheers,
Sarah
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your  
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Can't change directory with shell(cd)

2008-05-01 Thread Ken Ray



On 5/1/08 5:54 PM, "Michael D Mays" <[EMAIL PROTECTED]> 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.
> 
> What am I doing wrong or is this a 'feature';)?

The problem is that you're doing two separate shell calls, each one
evaluated based on the current folder (which is Rev's Home folder). You need
to make a single shell call that does both tasks. For Mac, that means
separating them by semicolons:

  put shell("cd /;ls")

This will get a directory listing of the root  drive. For Windows, you need
to use an ampersand instead of a semicolon, like this:

  put shell("cd c:\ & dir")



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Can't change directory with shell(cd)

2008-05-01 Thread Jim Ault
You can also just set the path to another legal folder.

Jim Ault
Las Vegas


On 5/1/08 8:06 PM, "Sarah Reichelt" <[EMAIL PROTECTED]> wrote:

>>  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().
> 
> Something seems wrong there. However if using ditto works for you,
> then that's fine.
> I haven't done much with copying files. Moving them is very fast using
> the rename command, but copying is different. If the files are small
> you could try:
>   put URL ("binfile:" & tOriginalFile) into URL ("binfile:" & tNewFile)
> but if they are larger than a few MB, that might not be so good as it
> reads the entire file into memory before writing it out again.
> 
>> 
>>  Do you have cr defined as return?
> 
> "cr" is defined in Rev. I prefer using it instead of "return" because
> "return" also means return a value from a function and I prefer to
> make sure they are obviously different. And it's shorter to type :-)
> 
> Cheers,
> Sarah
> ___
> use-revolution mailing list
> use-revolution@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Can't change directory with shell(cd)

2008-05-01 Thread J. Landman Gay

Michael D Mays wrote:
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).


That reminds me of an error that was built into the HyperCard engine, 
which reported "Script too silly to execute" (or something like that.) I 
believe I even saw it once.





Do you have cr defined as return?


The engine does. I've taken to using it exclusively for "carriage 
return" because not only is it shorter to type, it helps differentiate 
it from the "return" command.


--
Jacqueline Landman Gay | [EMAIL PROTECTED]
HyperActive Software   | http://www.hyperactivesw.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Can't change directory with shell(cd)

2008-05-01 Thread Sarah Reichelt
>  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().

Something seems wrong there. However if using ditto works for you,
then that's fine.
I haven't done much with copying files. Moving them is very fast using
the rename command, but copying is different. If the files are small
you could try:
  put URL ("binfile:" & tOriginalFile) into URL ("binfile:" & tNewFile)
but if they are larger than a few MB, that might not be so good as it
reads the entire file into memory before writing it out again.

>
>  Do you have cr defined as return?

"cr" is defined in Rev. I prefer using it instead of "return" because
"return" also means return a value from a function and I prefer to
make sure they are obviously different. And it's shorter to type :-)

Cheers,
Sarah
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Can't change directory with shell(cd)

2008-05-01 Thread Michael D Mays
Yes you do if you have space and other evil MacOS filename  
characters. Sarah saw what I was doing wrong.


I wonder if each shell call is threaded separately.

Thanks,
Michael


On May 1, 2008, at 6:01 PM, Richard Gaskin wrote:


Michael D Mays 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.
What am I doing wrong or is this a 'feature';)?


Does the path need to be in quotes? E.g.:

put "cd ""e&aPath"e into aRequest


--
 Richard Gaskin
 Managing Editor, revJournal
 ___
 Rev tips, tutorials and more: http://www.revJournal.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your  
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Can't change directory with shell(cd)

2008-05-01 Thread Michael D Mays
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  
<[EMAIL PROTECTED]> 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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your  
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution



___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Can't change directory with shell(cd)

2008-05-01 Thread Sarah Reichelt
On Fri, May 2, 2008 at 8:54 AM, Michael D Mays <[EMAIL PROTECTED]> 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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Can't change directory with shell(cd)

2008-05-01 Thread Richard Gaskin

Michael D Mays 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.

What am I doing wrong or is this a 'feature';)?


Does the path need to be in quotes? E.g.:

put "cd ""e&aPath"e into aRequest


--
 Richard Gaskin
 Managing Editor, revJournal
 ___
 Rev tips, tutorials and more: http://www.revJournal.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution