Stickies
« Sticky.exe »

Welcome Guest. Please Login or Register.
Sep 23rd, 2017, 6:38pm


Click to go to the
Zhorn Software Web Site
Click to go to the
Knowledgebase

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Sticky.exe  (Read 1707 times)
Lars
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 3
xx Sticky.exe
« Thread started on: Sep 20th, 2013, 7:28pm »

I was really happy to send a Stickies note using Python and sticky.exe. I wasn't able to get it to work with Friend Name, only IP address. Is there anything I should look out for when doing this. I'm pretty sure my subprocess call was sending the correct format. Friend name in quote marks, right?

I had put sticky.exe in the Stickies program folder, rather than the root of C:\ as in the examples, but other than that...

Any help appreciated. : )

Lars Cawley
User IP Logged

Tom Revell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 3556
xx Re: Sticky.exe
« Reply #1 on: Sep 22nd, 2013, 06:27am »

In order to check what address the friend has, sticky.exe will open the file "stickies.ini" in the current directory.

So, if you put the exe in your data directory, that should work?

Tom
User IP Logged

Lars
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 3
xx Re: Sticky.exe
« Reply #2 on: Sep 23rd, 2013, 02:39am »

Oh yes, thank you, I see the 'current directory' instruction on your web page about sticky.exe now. Unfortunately I can't get that to work.
What I can get to work:
IP or machine name. eg;

"C:\Documents and Settings\Administrator\Application Data\stickies\sticky.exe" 1XX.1XX.1XX.72 This is a test message.
"C:\Documents and Settings\Administrator\Application Data\stickies\sticky.exe" ERIC This is a test message.

What I can't get to work:
Friend name, even with ini in the same dir, even having cd'ed to that dir in the command dialog. eg;

"C:\Documents and Settings\Administrator\Application Data\stickies\sticky.exe" "Pamela_ERIC" This is a test message.

I can parse the ini file using Python, but we probably both want this to work the way it should, don't we. smiley

Perhaps I am making a silly mistake, but I can't see what it is.

Lars
« Last Edit: Sep 24th, 2013, 12:09am by Lars » User IP Logged

Tom Revell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 3556
xx Re: Sticky.exe
« Reply #3 on: Sep 24th, 2013, 2:11pm »

In your second example, you don't "cd" to the directory first of course - you are doing it in your script, I guess?

cd "C:\Documents and Settings\Administrator\Application Data\stickies"
sticky.exe "Pamela_ERIC" This is a test message

I've just checked it here, and it seems to be working OK, although it has been a LONG time since I looked through the source to sticky.exe, and it certainly needs a little <ahem> attention. I've learned a lot since I wrote it, it would seem...

...for example, if looking up the friend name takes more than a second (can't see why it would take that long!) the send will fail. The app will need rewriting for the changes I'm making to v8, so I'll do it then, and probably use the Stickies API to get the friend details instead.

Anyway - to check - are you actually changing directory first?

Tom
User IP Logged

Lars
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 3
xx Re: Sticky.exe
« Reply #4 on: Sep 24th, 2013, 5:15pm »

Hi Tom, thanks for your reply. Sorry that my example was a bit ambiguous. When you mentioned having to have the current directory where the ini is I tested my command directly in the XP command prompt, taking Python out of the equation.

I'm not sure what I did wrong when testing yesterday, but today it is working exactly as you have described. embarassed I have gone back to the Python method now that I am certain that it works!

I am really sorry to have bothered you now. But you did help me get there in the end. Here is how the code looks for this:


import subprocess

stickiesDir = 'C:\\Documents and Settings\Administrator\Application Data\stickies'
name="Pamela_ERIC"
message="This is a test."

#changing current dir here
os.chdir(stickiesDir)
#Assemble command
cmdText = 'sticky.exe \"'+name+'\" '+message

try:
handle=subprocess.Popen(cmdText)
returncode=handle.wait()
if returncode>0:
print("error code: %s\nSee terminal for details." % (returncode))
else:
print("Success. See terminal for details.")
except StandardError,x:
print("error:\n%s\nSee terminal for details." % (x))


That seems to working well, now I can build some interesting functions and UI to use this new ability. Thanks for your patience and help Tom.

Of course, now I realised I would have to look into the ini file to read the friends list for some things I want to do anyway, such as give the user a list of friends that adapts as our central friend list changes. I have my script fishing the list of friends from the ini file now. For more advanced Stickies features I should head towards the API, right?

Lars
« Last Edit: Sep 25th, 2013, 04:22am by Lars » User IP Logged

Tom Revell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 3556
xx Re: Sticky.exe
« Reply #5 on: Sep 26th, 2013, 02:21am »

I'm glad it's working!

For "more advanced" features, well I'm not so sure about that, but that's probably the best way to get data out of the app. For example, when v8 is released, you'll have to make one very small change to your script, but if there was an API for what you're doing, and you were using it, it would still work the same way.

A problem you may have with using the API is that it relies on having a window to send messages to. If you're running a script, I don't suppose that has a window to receive replies, which is going to immediately cause you trouble...

Tom
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls