MACRO Language | open dialog for a single file

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

MACRO Language | open dialog for a single file

Rainer M. Engel
Maybe I'm missing something here, but I get no open-dialog
for a single file ..



//This brings up a dialog
dir = getDirectory("Open a Dir");

//This not, but it should?.. mmh.
file = File.openAsString("Open my File");



Regards,
Rainer


--
Rainer M. Engel, Dipl. Digital Artist
scientific|Media GbR
Pichelsdorferstr. 143
D-13595 Berlin

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: MACRO Language | open dialog for a single file

Mario Faretta-2
dear Rainer,
it should work like this:

filepath=File.openDialog("Select a File");

file=File.openAsString(filepath);
//you have to insert the path to the target in brackets in the File.OpenAsString

Hope it helps
Mario

Il 6/22/2012 11:23 AM, Rainer M. Engel ha scritto:

> Maybe I'm missing something here, but I get no open-dialog
> for a single file ..
>
>
>
> //This brings up a dialog
> dir = getDirectory("Open a Dir");
>
> //This not, but it should?.. mmh.
> file = File.openAsString("Open my File");
>
>
>
> Regards,
> Rainer
>
>


--
---PLEASE Note the change in the email address---

--
Mario Faretta
Department of Experimental Oncology
European Institute of Oncology
c/o IFOM-IEO Campus for Oncogenomics
via Adamello 16 20139 Milan Italy
Phone: ++39-0294375027
email: [hidden email]
http://www.ifom-ieo-campus.it

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: MACRO Language | open dialog for a single file

Rainer M. Engel
Thanks Mario,

I simply was confused by the information on "File.openAsString"

> File.openAsString(path) - Opens a text file and returns the contents as a string. Displays a file open dialog box if path is an empty string. Use lines=split(str,"\n") to convert the string to an array of lines.

and overlooked the openDialog function beneath that ..

Thanks again.

Rainer



Am 22.06.2012 14:13, schrieb Mario Faretta:

> dear Rainer,
> it should work like this:
>
> filepath=File.openDialog("Select a File");
>
> file=File.openAsString(filepath);
> //you have to insert the path to the target in brackets in the
> File.OpenAsString
>
> Hope it helps
> Mario
>
> Il 6/22/2012 11:23 AM, Rainer M. Engel ha scritto:
>> Maybe I'm missing something here, but I get no open-dialog
>> for a single file ..
>>
>>
>>
>> //This brings up a dialog
>> dir    = getDirectory("Open a Dir");
>>
>> //This not, but it should?.. mmh.
>> file     = File.openAsString("Open my File");
>>
>>
>>
>> Regards,
>> Rainer
>>
>>
>
>


--
###################################
Rainer M. Engel - Managing Director
endime | ENGEL DIGITAL MEDIA

Pichelsdorfer Str. 143
13595 Berlin

Ust-StNr.:DE254256305
BLZ: 20010020
Kto: 971873201

web: www.endime.de
mail: [hidden email]
fon.:-Berlin +49 (0)30-92252096
mobile: +49 (0)174 33 555 49
skype: tomdooley4711
###################################
not only a game http://cx.endime.de
###################################

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html