I’m trying to change a preference in an application. Using a button step doesn’t work, and amazingly, neither does using a mouse click. I’ve verified a couple of ways that the mouse click is in the correct position, but the checkbox doesn’t change state. The application is Socialite, a rather old application, but still (pretty much) does its job.
Hey Julian,
If you’ll post a screenshot of what you’re talking about, we’ll have a better idea of how to help.
-Chris
I'm trying to change "Show unread application badge" to always be on. For some reason Socialite has suddenly started turning it off at launch. I've even edited the preferences file to turn it on, but Socialite still turns it off at launch. Seems like the easiest way to deal with this misbehavior is a macro.
Hey Julian,
Hmm... Try setting things the way you want and then locking the preference file in the Finder.
If that doesn't work we'll try System Events.
Later... I'm about to hit the sack.
-Chris
Hi Chris,
No go. Socialite changes its preferences after loading the preference file.
–julian
Hey Julian,
I downloaded the trial, and it does NOT turn OFF “Show unread application badge” on my system.
<shrug>
There's no telling what the difference is between our set-ups.
I'm presently using macOS 10.12.3.
I would move my preferences to the desktop and start over to see if there was a change.
If that doesn't help then you can do something like this:
Preferences – Turn On “Show unread application badge”.kmmacros (24 KB)
You'll have to change the Found Image, so it matches your system.
BTW – click at x,y works fine if you substitute it for click at found image. I imaging you had a timing issue, when it didn't work for you.
This is why I have the pause-until action in there.
-Chris
For me it also auto-disables “Show unread application badge”.
It seems “Show unread application badge”=ON is the app’s default setting, but on every app launch it writes ShowUnreadBadge false
to the preferences.
It doesn’t make much sense to edit the prefs file with a normal text editor, because with recent macOS versions the prefs are handled and cached by the cprefsd
process.
But what you can do is, set the prefs via the default command:
defaults delete com.apparentsoft.socialite ShowUnreadBadge
This should restore the default setting (badge = on). Until the app sets it to false again
You can put the script into a KM macro and auto-launch it each time when the app starts:
Socialite Prefs Hack.kmmacros (2.2 KB)
Experiment with the value of the pause action. The script must run after Socialite has completely started up.
Socialite was discontinued a couple of years ago, so who knows what they decided to leave up on the website. I wish I could find something up-to-date for twitter reading, but nothing out there matches the capabilities of this ancient app.
I forgot to mention that I was using PlistEdit Pro to check the prefs file so I could see exactly what was going on in it.
Thanks for the script steps. I put those in and now I have a working script! One quick invocation and everyone is happy! Plus I learned some more about KM.
–julian
Hi Tom,
Thing is, Socialite is always muddling that pref after launching. It didn’t use to do this, but of course it’s never going to get fixed. I got a working script per Chris, but I like your launch script, so I’m going to modify the macro to do that. Again, I wish there was some up-to-date software that could do what Socialite does.
–julian
Hi Julian,
I think you misunderstood. The script does not launch anything.
defaults
interacts with the computer’s UserDefaults system (see man page).
To understand how it works, do this:
-
Launch Socialite
-
Make sure you have some unread articles
-
Disable “Show unread application badge” in the preferences and leave the preferences window open
- → The badge disappears from the app icon in the dock
- Run the script
``` in the Terminal
- → The badge re-appears
- → “Show unread application badge” is checkmarked again
In other words, the result of the `defaults` script is the same as Chris’ macro. The difference is the way how this is achieved:
- Chris’ macro enables “Show unread application badge” by clicking the checkbox in the GUI
- `defaults` enables “Show unread application badge” by speaking to the UserDefaults system
So – in case you have done that – it makes no sense to combine my script with Chris’ macro. You would just enable the preference twice.
Hope it is clearer now.
Tom’s is the better method, because it’s more direct and therefore way faster.
I would probably write the positive value rather than have Socialite revert to the default.
defaults write com.apparentsoft.socialite ShowUnreadBadge -int 1
There may very well be no practical difference, but I’ve seen some instances when this is faster.
-Chris
Sorry, didn’t word that well. Right now I have a script that fixes the pref to what it’s supposed to be. What I meant is that a script that launches Socialite, waits a bit, and then fixes the pref would be better, because then I wouldn’t have to manually invoke the fixer script.
I’m familiar with the defaults command. It doesn’t work here. Socialite is explicitly discarding whatever is set in the prefs file or through the defaults command. As I watch the application start up, it’s actually has the desired value for the pref, but then after doing all the account refreshes, it turns off the pref. That’s why this action has to be done after launch.
Hey Julian,
You can run the defaults command after the app starts, and it will work fine.
-Chris
Are you sure? Have you tried the macro, or manually from the Terminal as described above? Works flawlessly on my machine (macOS 10.12.3).
That’s why my macro has the 3-seconds pause at the beginning
As mentioned in the macro post, if this is too short on your machine, experiment with a different value. (I tested it with only one account/subscription, and if it resets the pref after refreshing all accounts and you have lots of them, you may need 10s or even more…)
Thanks, Tom. Thought I understood it. It did indeed turn out to be a timing problem. I have Socialite on a creaky old mac mini, and I ended up with 14 seconds. That made sure to take care of all the launching operations, plus the unpredictable amount of time it takes Socialite to do all the twitter account (six) refreshes.