Re: Dragging folder to a field under linux adds "file://"beforethefolder

2011-10-02 Thread J. Landman Gay

On 10/1/11 7:45 AM, Olivier Dussutour wrote:

Hi Matthias,
I'm sorry to insist (needless to say I'm a beginner).
I read your answer but I wanted this script to a program that would
allow students from primary to copy files on all the computers of their
room and I found the drag and drop easier than choosing from a list.
Hence my interest in your script but if the students could select more
than one at once it would be great.


They can do that. In the script Matthias gave, "tList" is just a 
variable name. You could easily call it "tFiles" or anything else.


Your student would select several files in the Finder or Windows 
Explorer, then drag them all to your stack at the same time. The 
dragdrop handler Matthias posted will put all the file paths into the 
variable, one path per line.


Your own handler can then get each line of tList and work with it.



ON dragdrop
put the dragdata["files"] into tList
END dragdrop


If I have selected three files in the OS, the above handler would 
contain something like this in the variable tList:


volume/folder/file1.txt
volume/folder/file2.txt
volume/folder/file3.txt

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

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


Re: Dragging folder to a field under linux adds "file://"beforethefolder

2011-10-01 Thread Olivier Dussutour

Hi Matthias,
I'm sorry to insist (needless to say I'm a beginner).
I read your answer but I wanted this script to a program that would allow 
students from primary to copy files on all the computers of their room and I 
found the drag and drop easier than choosing from a list.
Hence my interest in your script but if the students could select more than 
one at once it would be great.

Cordialement,
Olivier Dussutour
olivierdussut...@gmail.com
- Original Message - 
From: "Matthias Rebbe" 

To: "How to use LiveCode" 
Sent: Thursday, September 29, 2011 8:11 AM
Subject: Re: Dragging folder to a field under linux adds 
"file://"beforethefolder




Olivier,,

if you just need the list of the dragged files in an variable for example 
then


ON dragdrop
   put the dragdata["files"] into tList
END dragdrop

should do.

Regards,

Matthias
Am 29.09.2011 um 07:40 schrieb Olivier Dussutour:


Hello Matthias,
Thank you for responding but I misspoke. I am French and my English is 
awful. :'-(
This is the idea of your script that interests me but how do I change to 
allow drag several files at once?


Cordialement,
Olivier Dussutour
olivierdussut...@gmail.com

- Original Message - From: "Matthias Rebbe" 


To: "How to use LiveCode" 
Sent: Wednesday, September 28, 2011 8:00 PM
Subject: Re: Dragging folder to a field under linux adds "file://" 
beforethefolder




Oliver,

I do not drag multiple folders simultaneously, but one folder which 
contains subfolders.


I use the following field scripts

ON dragEnter
 IF there is a folder the dragdata["files"]  THEN set the dragaction to 
copy

END dragEnter
## The DragEnter checks if a folder is dragged. No folder no dragaction.

##dragDrop then removes the file:// from the path
ON dragDrop
 IF the platform="Linux" THEN replace "file://" WITH "" in fld 1 of me
END dragDrop


If you need a list of that subfolders or the files in the subfolder you 
can use the following script from David Vaughan. I found it in the 
ScripterScrapbook.


FUNCTION walkDir dirPath
  put empty into tList
  set defaultfolder to dirPath
  put the files into fList

  REPEAT FOR each line fLine in fList
  IF char 1 of fLine <> "." THEN
  put fLine into fData -- & comma & last item of fLine into 
fData

  put dirPath & "/" & fData & return after tList
  END IF
  END REPEAT
  get the folders
  REPEAT FOR each line x in it
  IF char 1 of x <> "." THEN
  put walkDir(dirPath & "/" & x) after tList
  END IF
  END REPEAT
  return  tList
END walkDir

HTH,

Matthias


Am 28.09.2011 um 18:51 schrieb Olivier Dussutour:


Hello,
I am interested in your script, but how can you drag multiple folders 
simultaneously.

If you could help me, thank you in advance

Cordialement,
Olivier Dussutour
olivierdussut...@gmail.com
- Original Message - From: "Matthias Rebbe" 


To: "How to use LiveCode" 
Sent: Sunday, September 25, 2011 2:34 AM
Subject: Dragging folder to a field under linux adds "file://" before 
thefolder




Hi,

i want to drag a folder into a field to get the path displayed.  I am 
using the following code in the field script:


ON dragEnter
 IF there is a folder the dragdata["files"]
 THEN
 set the dragaction to copy
 END IF
END dragEnter

ON dragDrop
set the text of me to the dragdata["files"]
END dragDrop


This works fine under Win and Mac OS x. The path is displayed 
correctly. Under Linux there is "file://" added before the path.


For example the path /home/matthias/desktop becomes 
file:///home/matthias/desktop


If i do not use any script in the field, the path is displayed 
correctly without the leading "file://".
But I need to use a field script, because my original script is doing 
some adjustments to the path (replace backslash with slash under 
windows). Is this Linux specific? Or am i doing something wrong?  I 
know i can solve this with
"replace "file://" with "" in field " , but i would like to know 
and understand why "file://" is added to the path.


Regards,

Matthias




___
use-livecode mailing list
use-livecode@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@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@lists.runrev.com
Please visit this url to subscribe

Re: Dragging folder to a field under linux adds "file://" beforethefolder

2011-09-28 Thread Matthias Rebbe
Olivier,,

if you just need the list of the dragged files in an variable for example then

ON dragdrop
put the dragdata["files"] into tList
END dragdrop

should do.

Regards,

Matthias
Am 29.09.2011 um 07:40 schrieb Olivier Dussutour:

> Hello Matthias,
> Thank you for responding but I misspoke. I am French and my English is awful. 
> :'-(
> This is the idea of your script that interests me but how do I change to 
> allow drag several files at once?
> 
> Cordialement,
> Olivier Dussutour
> olivierdussut...@gmail.com
> 
> - Original Message - From: "Matthias Rebbe" 
> 
> To: "How to use LiveCode" 
> Sent: Wednesday, September 28, 2011 8:00 PM
> Subject: Re: Dragging folder to a field under linux adds "file://" 
> beforethefolder
> 
> 
>> Oliver,
>> 
>> I do not drag multiple folders simultaneously, but one folder which contains 
>> subfolders.
>> 
>> I use the following field scripts
>> 
>> ON dragEnter
>>  IF there is a folder the dragdata["files"]  THEN set the dragaction to copy
>> END dragEnter
>> ## The DragEnter checks if a folder is dragged. No folder no dragaction.
>> 
>> ##dragDrop then removes the file:// from the path
>> ON dragDrop
>>  IF the platform="Linux" THEN replace "file://" WITH "" in fld 1 of me
>> END dragDrop
>> 
>> 
>> If you need a list of that subfolders or the files in the subfolder you can 
>> use the following script from David Vaughan. I found it in the 
>> ScripterScrapbook.
>> 
>> FUNCTION walkDir dirPath
>>   put empty into tList
>>   set defaultfolder to dirPath
>>   put the files into fList
>> 
>>   REPEAT FOR each line fLine in fList
>>   IF char 1 of fLine <> "." THEN
>>   put fLine into fData -- & comma & last item of fLine into fData
>>   put dirPath & "/" & fData & return after tList
>>   END IF
>>   END REPEAT
>>   get the folders
>>   REPEAT FOR each line x in it
>>   IF char 1 of x <> "." THEN
>>   put walkDir(dirPath & "/" & x) after tList
>>   END IF
>>   END REPEAT
>>   return  tList
>> END walkDir
>> 
>> HTH,
>> 
>> Matthias
>> 
>> 
>> Am 28.09.2011 um 18:51 schrieb Olivier Dussutour:
>> 
>>> Hello,
>>> I am interested in your script, but how can you drag multiple folders 
>>> simultaneously.
>>> If you could help me, thank you in advance
>>> 
>>> Cordialement,
>>> Olivier Dussutour
>>> olivierdussut...@gmail.com
>>> - Original Message - From: "Matthias Rebbe" 
>>> 
>>> To: "How to use LiveCode" 
>>> Sent: Sunday, September 25, 2011 2:34 AM
>>> Subject: Dragging folder to a field under linux adds "file://" before 
>>> thefolder
>>> 
>>> 
>>>> Hi,
>>>> 
>>>> i want to drag a folder into a field to get the path displayed.  I am 
>>>> using the following code in the field script:
>>>> 
>>>> ON dragEnter
>>>>  IF there is a folder the dragdata["files"]
>>>>  THEN
>>>>  set the dragaction to copy
>>>>  END IF
>>>> END dragEnter
>>>> 
>>>> ON dragDrop
>>>> set the text of me to the dragdata["files"]
>>>> END dragDrop
>>>> 
>>>> 
>>>> This works fine under Win and Mac OS x. The path is displayed correctly. 
>>>> Under Linux there is "file://" added before the path.
>>>> 
>>>> For example the path /home/matthias/desktop becomes 
>>>> file:///home/matthias/desktop
>>>> 
>>>> If i do not use any script in the field, the path is displayed correctly 
>>>> without the leading "file://".
>>>> But I need to use a field script, because my original script is doing some 
>>>> adjustments to the path (replace backslash with slash under windows). Is 
>>>> this Linux specific? Or am i doing something wrong?  I know i can solve 
>>>> this with
>>>> "replace "file://" with "" in field " , but i would like to know and 
>>>> understand why "file://" is added to the path.
>>>> 
>>>> Regards,
>>>> 
>>>> Matthias
>>>> 
>>>

Re: Dragging folder to a field under linux adds "file://" beforethefolder

2011-09-28 Thread Olivier Dussutour

Hello Matthias,
Thank you for responding but I misspoke. I am French and my English is 
awful. :'-(
This is the idea of your script that interests me but how do I change to 
allow drag several files at once?


Cordialement,
Olivier Dussutour
olivierdussut...@gmail.com

- Original Message - 
From: "Matthias Rebbe" 

To: "How to use LiveCode" 
Sent: Wednesday, September 28, 2011 8:00 PM
Subject: Re: Dragging folder to a field under linux adds "file://" 
beforethefolder




Oliver,

I do not drag multiple folders simultaneously, but one folder which 
contains subfolders.


I use the following field scripts

ON dragEnter
  IF there is a folder the dragdata["files"]  THEN set the dragaction to 
copy

END dragEnter
## The DragEnter checks if a folder is dragged. No folder no dragaction.

##dragDrop then removes the file:// from the path
ON dragDrop
  IF the platform="Linux" THEN replace "file://" WITH "" in fld 1 of me
END dragDrop


If you need a list of that subfolders or the files in the subfolder you 
can use the following script from David Vaughan. I found it in the 
ScripterScrapbook.


FUNCTION walkDir dirPath
   put empty into tList
   set defaultfolder to dirPath
   put the files into fList

   REPEAT FOR each line fLine in fList
   IF char 1 of fLine <> "." THEN
   put fLine into fData -- & comma & last item of fLine into fData
   put dirPath & "/" & fData & return after tList
   END IF
   END REPEAT
   get the folders
   REPEAT FOR each line x in it
   IF char 1 of x <> "." THEN
   put walkDir(dirPath & "/" & x) after tList
   END IF
   END REPEAT
   return  tList
END walkDir

HTH,

Matthias


Am 28.09.2011 um 18:51 schrieb Olivier Dussutour:


Hello,
I am interested in your script, but how can you drag multiple folders 
simultaneously.

If you could help me, thank you in advance

Cordialement,
Olivier Dussutour
olivierdussut...@gmail.com
- Original Message - From: "Matthias Rebbe" 


To: "How to use LiveCode" 
Sent: Sunday, September 25, 2011 2:34 AM
Subject: Dragging folder to a field under linux adds "file://" before 
thefolder




Hi,

i want to drag a folder into a field to get the path displayed.  I am 
using the following code in the field script:


ON dragEnter
  IF there is a folder the dragdata["files"]
  THEN
  set the dragaction to copy
  END IF
END dragEnter

ON dragDrop
 set the text of me to the dragdata["files"]
END dragDrop


This works fine under Win and Mac OS x. The path is displayed correctly. 
Under Linux there is "file://" added before the path.


For example the path /home/matthias/desktop becomes 
file:///home/matthias/desktop


If i do not use any script in the field, the path is displayed correctly 
without the leading "file://".
But I need to use a field script, because my original script is doing 
some adjustments to the path (replace backslash with slash under 
windows). Is this Linux specific? Or am i doing something wrong?  I know 
i can solve this with
"replace "file://" with "" in field " , but i would like to know and 
understand why "file://" is added to the path.


Regards,

Matthias




___
use-livecode mailing list
use-livecode@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@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@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode