Indigo Speaks!

Discuss Python scripts here.
jltnol
Posts: 1003
Joined: Tue Oct 15, 2013 11:11 pm

Indigo Speaks!

Post by jltnol »

This script is on a schedule, and every time it fires, Indigo "speaks" the entire script.

The script does do exactly what I want it to, but don't know why all this text is actually spoken... no doubt I've got some punctuation wrong... but I'm lost...

Code: Select all

import time
time = time.strftime("%A"" " "%B"" " "%d"", ""%Y")
pCount = indigo.variables[146848088].value #todays date
list ="\n%s \t%s \t%s" %(time, "Today's Total",  pCount)

with open('/Users/kitchen/SynologyDrive/MyLogs/templist.txt', encoding='utf-8', mode='a') as outfile:
    outfile.write(list)
User avatar
DaveL17
Posts: 6828
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Indigo Speaks!

Post by DaveL17 »

Here's a revised script and a couple pointers.

- Don't use reserved words like "time" and "list" as variable names. It's confusing, but moreover it could cause things to go haywire depending on what you're doing.

- I wouldn't use "%s" string formatting. It's really outdated and there are much better options now.

Code: Select all

import time
now = time.strftime("%A %B %d, %Y")
pCount = indigo.variables[146848088].value
my_str = f"\n{now}    Today's Total    {pCount}"

with open('/Users/kitchen/SynologyDrive/MyLogs/templist.txt', encoding='utf-8', mode='a') as outfile:
    outfile.write(my_str)
I can't guess why Indigo is speaking the script unless you've somehow asked it to. Can you share a picture of the Action that runs the script?
I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]
jltnol
Posts: 1003
Joined: Tue Oct 15, 2013 11:11 pm

Re: Indigo Speaks!

Post by jltnol »

Got it.

I have a bunch of Kindergarten python scripts I’ve collected over the years that I cobble together to get these low level tasks done., but will be aware of ‘reserved words’ going forward.

Not sure how to share a pic of the “action’… This runs on a schedule, there are no conditions, the script IS the Action, and it just writes data to a .txt file, but I’m happy to share whatever part of that, that might be helpful.

And I can easily see the changes you’ve made and don’t think I’ll have any problems adapting them in the future, and may go back over some older ones and update those as well. its the little things that are a huge help for me.

As always, thanks!
User avatar
DaveL17
Posts: 6828
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Indigo Speaks!

Post by DaveL17 »

There's got to be something else causing Indigo to speak the script. There's nothing here that would cause that to happen. Does the schedule run other actions at the same time?
Attachments
Screenshot 2024-07-07 at 5.49.01 AM.png
Screenshot 2024-07-07 at 5.49.01 AM.png (501.55 KiB) Viewed 321 times
I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]
User avatar
Grognard
Posts: 56
Joined: Tue May 17, 2011 8:28 pm
Location: Seabrook, TX
Contact:

Re: Indigo Speaks!

Post by Grognard »

If you open the schedule as if to edit (so you see the dialog like the one that Dave posted above), is the "Test" button to the right of "Speak" (near the bottom of the dialog box) enabled?

If so, what do you hear when you click "Test"?

One possible explanation for the behavior you describe is that you accidentally pasted the text of the script into the "Speak" text entry field at some point. As an experiment I pasted your script into this field in one of my action groups, pressed the "Test" button, and sure enough, it spoke the whole script.

Just a thought.
jltnol
Posts: 1003
Joined: Tue Oct 15, 2013 11:11 pm

Re: Indigo Speaks!

Post by jltnol »

well OK

So the entire text string WAS entered into the “Speak” field. I’ve never used it this function, and honestly didn’t even know that it existed, so would be at a loss to explain how that got in there, but no doubt in copying and pasting, somewhere along the lline I did indeed put it in there .

Mystery Solved!

Thanks
Post Reply

Return to “Python Scripting”