capture / save data to a txt file

Posted on
Tue Jan 12, 2021 9:21 pm
DaveL17 offline
User avatar
Posts: 6751
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: capture / save data to a txt file

And there are no errors written to the Indigo Events log? I'm at a loss. I run the script on my system and it works.

I wonder if there's something going on with the OneDrive folder permissions. Perhaps try another folder like the current User's downloads folder.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Tue Jan 12, 2021 9:38 pm
SMUSEBY offline
Posts: 511
Joined: Sep 16, 2009
Location: California

Re: capture / save data to a txt file

moved the target to 'downloads' - same non-result (file date updated, but no data).

Posted on
Tue Jan 12, 2021 10:09 pm
DaveL17 offline
User avatar
Posts: 6751
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: capture / save data to a txt file

When you say the file has no data, are you literally looking at an empty file or are you getting this message?

Screen Shot 2021-01-12 at 10.06.29 PM.png
Screen Shot 2021-01-12 at 10.06.29 PM.png (105.22 KiB) Viewed 2906 times


Try changing the file extension to '.txt' instead of '.rtf'.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Tue Jan 12, 2021 10:15 pm
SMUSEBY offline
Posts: 511
Joined: Sep 16, 2009
Location: California

Re: capture / save data to a txt file

The rtf file is open w text edit, and blank. I’ll

Posted on
Tue Jan 12, 2021 10:25 pm
SMUSEBY offline
Posts: 511
Joined: Sep 16, 2009
Location: California

Re: capture / save data to a txt file

Just confirmed that I was executing the right file (I am), and that there are no errors.

Jan 12, 2021 at 20:17:50
Trigger run a script #3


Script #3 calls the python script of interest.
Maybe I should log data to the event log?

Where did the screen shot above come from? - and to answer the question, I can open the document - it's blank. - but the file size is 434 bytes.
Clue: I just ran the script 3 times, and not the file size is 530 bytes.
white font??? This is bizarre.

Posted on
Tue Jan 12, 2021 10:48 pm
SMUSEBY offline
Posts: 511
Joined: Sep 16, 2009
Location: California

Re: capture / save data to a txt file

fwiw, I just opened the file (on the tahoe computer) with both textedit and word on my berkeley computer, and there is nothing on the document in either app.

Posted on
Wed Jan 13, 2021 7:38 am
DaveL17 offline
User avatar
Posts: 6751
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: capture / save data to a txt file

???

If you've tried changing the name of the output file to .txt (the suggestion is very well hidden below the screenshot above) and it still isn't working for you, then I'm afraid I'm out of ideas.

If I change nothing but the id number and path to the file, the script works for me. The screenshot above is what I get when I double-click the 'rtf' file and Mac OS (Catalina) tries to open the file with Text Edit. However, if I right click on the file and select "Open with BBEdit" the file opens and contains valid data. If I change the extension from '.rtf' to '.txt' and then double-click on the file, it opens up in Text Edit. I can also preview it by selecting the file and hitting the space bar in Finder (when it has the .txt extension). I think the OS is having trouble because of the '.rtf' extension and the fact that it isn't a Rich Text File (it's a plain text file.)

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Wed Jan 13, 2021 2:04 pm
SMUSEBY offline
Posts: 511
Joined: Sep 16, 2009
Location: California

Re: capture / save data to a txt file

rtf was the issue.
Now I can put the script to work.
Thank you!
Bob

Posted on
Wed Jan 13, 2021 2:09 pm
DaveL17 offline
User avatar
Posts: 6751
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: capture / save data to a txt file

Wahoo! My only regret is that I didn't think of this sooner. I hardly ever use Text Edit.

Good luck.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Wed Jan 13, 2021 2:14 pm
SMUSEBY offline
Posts: 511
Joined: Sep 16, 2009
Location: California

Re: capture / save data to a txt file

If it's not difficult, could you please help me to modify the script to parse the data?
2021-01-13 12:03:01.181000, 5.5

Date and Hr:Min is all I need.

Posted on
Wed Jan 13, 2021 6:00 pm
DaveL17 offline
User avatar
Posts: 6751
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: capture / save data to a txt file

That's no problem. Change this bit:

Code: Select all
u"{0}, {1}\n"
to this:
Code: Select all
u"{0: %Y-%m-%d %H:%M}, {1}\n"
Leaving the remainder of the line unchanged.

If you literally meant just the date, it's this:

Code: Select all
u"{0: %d %H:%M}, {1}\n"

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Wed Jan 13, 2021 6:14 pm
SMUSEBY offline
Posts: 511
Joined: Sep 16, 2009
Location: California

Re: capture / save data to a txt file

I meant ymd and hour:min, but the day only is better. Perfect.
btw, I created a second script in about 30 seconds by replacing the device ID and output file name. Very elegant. l have come to love python, and wish I had 10% of your capability.

Posted on
Wed Jan 13, 2021 6:24 pm
DaveL17 offline
User avatar
Posts: 6751
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: capture / save data to a txt file

You're too kind. I'm but a flea on the backs of some of the real developers around here.

I understand what you mean about Python. Once I came to appreciate how much you can do with even a simple understanding, it made it feel like anything may be possible with Indigo and Python combined.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Who is online

Users browsing this forum: No registered users and 2 guests