Page 2 of 3

Re: How to Use AppleScript to Display Logs in Indigo Touch

PostPosted: Mon May 02, 2016 6:34 am
by Different Computers
That did fix it, I think. Thanks!

Was this a file name format change in 6.18?

Also, any idea on how to get
Code: Select all
May 2, 2016, 8:34:00 AM   Script                          2016-05-02 Events.txt

to stop appearing in the log every minute?

Re: How to Use AppleScript to Display Logs in Indigo Touch

PostPosted: Mon May 02, 2016 10:43 am
by howartp
Don't think the log file names will have ever changed.

You've not been around long enough to have had the script running at the beginning of last month (1st to 9th) I don't think? So you wouldn't have come across it until now.


Sent from my iPhone using Tapatalk

Re: How to Use AppleScript to Display Logs in Indigo Touch

PostPosted: Tue May 03, 2016 2:03 pm
by Different Computers
No ideas on how to get rid of

Code: Select all
May 2, 2016, 8:34:00 AM   Script                          2016-05-02 Events.txt
???

:cry: :cry:

Re: How to Use AppleScript to Display Logs in Indigo Touch

PostPosted: Tue May 03, 2016 3:03 pm
by jay (support)
It looks like your script is writing it. Does it have any "log" lines in it?

Re: How to Use AppleScript to Display Logs in Indigo Touch

PostPosted: Tue May 03, 2016 4:14 pm
by howartp
Yep, the "log indigolog" line.


Sent from my iPhone using Tapatalk

Re: How to Use AppleScript to Display Logs in Indigo Touch

PostPosted: Tue May 03, 2016 4:33 pm
by jay (support)
That's what's doing it. Take that line out and it will go away.

Re: How to Use AppleScript to Display Logs in Indigo Touch

PostPosted: Tue May 03, 2016 7:53 pm
by Different Computers
Got it. Thanks.

For anyone else wondering how to do this, the line to comment out is
Code: Select all
log IndigoLogName

Re: How to Use AppleScript to Display Logs in Indigo Touch

PostPosted: Tue May 10, 2016 1:23 pm
by Different Computers
I'm puzzled to be the only person with this problem:

I had to pad my log file name with a "0" in the date for the first 9 days of May. Today I had to take it out.

I didn't change any of the code. Is everyone else manually changing this 2x a month?

How to Use AppleScript to Display Logs in Indigo Touch

PostPosted: Tue May 10, 2016 4:59 pm
by howartp
You need to pad anything less than 10.

I can't see your script as I'm on phone, but it will probably be an if() command.

If dayofmonth is less than 10 then... otherwise ....

Same with months of the year because you'll have same problem in October when months become double-digit.


Sent from my iPhone using Tapatalk

Re: How to Use AppleScript to Display Logs in Indigo Touch

PostPosted: Fri Jul 08, 2016 10:01 pm
by MartyS
I'm a bit late to this topic, but for anyone else following along and implementing other code suggestions brought up after creation of the original script…

I don't believe that the extra AppleScript code for building and then using the actual Indigo log filename (in "yyyy-mm-dd Events.txt" format) is necessary. The code by the OP uses the filename of indigo_log.txt which is a symlink to the latest date-based name. That didn't change between Indigo 5 and 6: they both have that same symlink. The same has likely been true for several (or all) major versions.

That avoids any issue about which day of the month, or which month it is, and when to pad them with an extra "0". Just use indigo_log.txt! 8)

I for one implemented the additional code, debugged it to my satisfaction and only then realized that it wasn't needed.

Re: How to Use AppleScript to Display Logs in Indigo Touch

PostPosted: Wed Jan 31, 2018 1:43 pm
by Different Computers
I'm considering revisiting this. As I moved Indigo from one Mac to another a while ago, I lost this feature somehow.

The original AppleScript has "tell IndigoServer" in it, so this won't work soon. Thoughts about how to do this with Python?

Re: How to Use AppleScript to Display Logs in Indigo Touch

PostPosted: Wed Jan 31, 2018 7:22 pm
by jay (support)
Well, the log is in Indigo Touch.

But, this script is similar (untested but should be close):

Code: Select all
import sys
import collections

def tail(iterable, N):
    deq = collections.deque()
    for thing in iterable:
        if len(deq) >= N:
            deq.popleft()
        deq.append(thing)
    return list(deq)

# A list of the variable IDs - this script doesn't create them so they have to exist already
variable_ids = [1, 2, 3, 4, 5]

lines = tail(open("/Library/Application Support/Perceptive Automation/Indigo 7/Logs/indigo_log.txt"), len(variable_ids))
for index, line in enumerate(lines):
   indigo.variable.updateValue(variable_ids[index], value=line)


This doesn't create the variables that hold the log lines, they must already exist. But it also will use the number of variables specified in the list at the number of lines to get.

Re: How to Use AppleScript to Display Logs in Indigo Touch

PostPosted: Thu Feb 01, 2018 6:54 am
by Different Computers
Thanks Jay! I'll try this today.

jay (support) wrote:
Well, the log is in Indigo Touch..


It is???? You mean I can look at it via IT, right? Sure. But it's super handy to have a running glimpse of the log on a control page that is sitting open on my desk. For watching those non-responsive camera notifications I'm getting. (I've got a Foscam C2 that's losing its mind, even after two hard resets.)

Re: How to Use AppleScript to Display Logs in Indigo Touch

PostPosted: Thu Feb 01, 2018 8:19 am
by Different Computers
Jay, thanks again. That script worked perfectly first try.

Now I'm confronted with the same issue mentioned for the AppleScript about a page back: Any simple way to strip the timestamps before they become the variable values? Or after for that matter.

I searched for "python equivalent of tail" and as I started to read my head nearly exploded.

Re: How to Use AppleScript to Display Logs in Indigo Touch

PostPosted: Thu Feb 01, 2018 11:41 am
by jay (support)
Different Computers wrote:
Now I'm confronted with the same issue mentioned for the AppleScript about a page back: Any simple way to strip the timestamps before they become the variable values? Or after for that matter.


Can you just restate the problem?