http://imagej.273.s1.nabble.com/Save-values-Popup-window-tp5017455p5017470.html
Creates a new text file and returns a file variable that refers to it.
To write to the file, pass the file variable to the print function.
Displays a file save dialog box if path is an empty string. The file is
closed when the macro exits. Currently, only one file can be open at a
time. For an example, refer to the SaveTextFileDemo macro."
brings up a file dialog or you enter a correct path.
you do not specify Output in your code snippet.
the ImageJ directory. The text file definitely contains:
I don't understand what goes wrong on your side. Please try to run the
instead.
> Hi Herbie,
>
> Thank you for your effert and time. Unfortunately my code is not working
> yet.
> The textfile thresholds is made, however in de debug screen it is stored as
> follows: file ="~0~". So it won't recognizes where it is stored I think.
> This is also the reason I think that nothing gets printed in it. When
> running this part of the code no error is given.
>
> file=File.open(Output+"Thresholds.txt")
> print(file, "Minimum threshold: "+lower + "\n")
>
> Do you maybe have an idea how to solve this?
>
> Thanks a lot.
>
> Iris
>
> 2016-10-24 17:10 GMT+02:00 Herbie [via ImageJ] <
>
[hidden email]>:
>
>> Iris,
>>
>> this is part 2 of my answer.
>>
>> Here is the macro code:
>>
>> /////////////////////////////////
>> waitForUser("set the threshold and press OK, or cancel to exit macro");
>> getThreshold( lower, upper );
>> print("your thresholds are: " + lower + " to "+ upper );
>>
>> txt_file = File.open( "Thresholds.txt" );
>> print( txt_file, "Minimum threshold: " + lower + "\n" );
>> print( txt_file, "Maximum threshold: " + upper );
>> /////////////////////////////////
>>
>> getNumber( "Minimum", lower );
>>
>> Does the latter help with your last question?
>>
>> Best
>>
>> Herbie
>>
>> ::::::::::::::::::::::::::::::::::::::
>> Am 24.10.16 um 16:11 schrieb Ihiertje:
>>
>>> Hi,
>>>
>>> Last time I was helped very well, so I hope someone can help me again.
>>> I have an image which I threshold manually. Afterwards I want to save
>> the
>>> minimal and maximal value of this threshold to a textfile. This is done
>> two
>>> times, so if the text file could be updated, that would be great.
>>>
>>> Underneath you find my code so far. First I want to create a textfile
>> where
>>> I can save my values. Then I want to print the text 'Minimal threshold'
>> plus
>>> its value. However, it creates the text file, but does not print any
>> text in
>>> it. Is there a way to print the text in the textfile and update it with
>> the
>>> maximal threshold?
>>>
>>> /run("Threshold...");
>>> waitForUser("set the threshold and press OK, or cancel to exit macro");
>>> getThreshold(lower,upper)
>>> print("your thresholds are; "+lower, "to "+ upper);
>>>
>>> file=File.open(Output+threshold.txt)
>>> open(file)
>>> print(file, "Minimal threshold"+lower+"\n");/
>>>
>>> Next to that, I would like to have a pop-up screen where some can select
>> a
>>> value that will be used in another calculation. I found that
>> Dialog.create
>>> could be used for this. However, normally codes like Dialog.create will
>>> change from black to a yellow collor when there typed right. With
>>> Dialog.create this does not happen and also does not show any pop-up
>> screen
>>> when an option with Dialog.addChoice is included.
>>>
>>> Thank you already.
>>>
>>> Iris
>>>
>>>
>>>
>>> --
>>> View this message in context:
http://imagej.1557.x6.nabble.
>> com/Save-values-Popup-window-tp5017455.html
>>> Sent from the ImageJ mailing list archive at Nabble.com.
>>>
>>> --
>>> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>>>
>>
>> --
>> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>>
>>
>> ------------------------------
>> If you reply to this email, your message will be added to the discussion
>> below:
>>
http://imagej.1557.x6.nabble.com/Save-values-Popup-window->> tp5017455p5017459.html
>> To unsubscribe from Save values & Popup window, click here
>> <
>> .
>> NAML
>> <http://imagej.1557.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
>
>
> --
> View this message in context:
http://imagej.1557.x6.nabble.com/Save-values-Popup-window-tp5017455p5017467.html> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>