Here is what I’m trying to do. I have a app that I’m trying to GUI script seeing as it does not have anyway to script it. It’s called SleepLess. Well when I run it, it only is able in the Finder menu bar.
Here what I tried for scripting for it.
tell application "Finder"
activate
end tell
tell application "System Events"
tell process "SleepLess"
click menu item "Turn SleepLess OFF" of menu 1 of menu bar item "SleepLess" of menu bar 1
click menu item "Turn SleepLess ON" of menu 1 of menu bar item "SleepLess" of menu bar 1
click menu item "Turn SleepLess OFF" of menu 1 of menu bar item "SleepLess" of menu bar 1
click menu item "Turn SleepLess ON" of menu 1 of menu bar item "SleepLess" of menu bar 1
end tell
end tell
Now here is what I get. And I don’t know why. Please help.
click menu item "Turn SleepLess OFF" of menu 1 of menu bar item "SleepLess" of menu bar 1 of process "SleepLess"
Now I know it works because I redid my script to this.
tell application "Finder"
activate
end tell
tell application "System Events"
tell process "SleepLess"
click menu item "Quit SleepLess" of menu 1 of menu bar item "SleepLess" of menu bar 1 of process "SleepLess"
And that script works like it should clicking the menu item to make SleepLess quit.
If anyone out there can find a way to make a GUI applescript that will click the menu item Trun SleepLess OFF then stop for say 5 to 10 seconds then click the menu item Turn SleepLess ON, Then stop for 5 to 10 seconds once more and just repeat that set over one more time. I would jump for joy.
Why I’m trying to do this is this? When SleepLess is runing I can close my PowerBook G3 and have the Laptop still runing with out the screen on. Then when I open the lid the screen comes back on. Well there are times that I need to sleep the mac. When I do Sleep it and then wake it up. All SleepLess will do is keep my PowerBook and screen from sleeping. So if I want to be able to run the mac with the lid closed once more I have to do what I just typed out. I find my self haveing to do this all to often. So I though what not have AppleScript do it for me. Till I tried to script it, it sounded good when I put it down on paper.
Thank you for you time,
Michael
Model: PowerBook 233 Mhz G3, 100 GB Hard Drive with 160 MB of RAM
AppleScript: 1.10.3
Browser: Safari 417.9.2
Operating System: Mac OS X (10.4)