Entropy.ch Discussion Forums Forum Index Entropy.ch Discussion Forums
Discussion forums about Mac OS X software development.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Unable to Sleep, and iTunes restarting

 
Post new topic   Reply to topic    Entropy.ch Discussion Forums Forum Index -> LogitechLCDTool
View previous topic :: View next topic  
Author Message
isteel



Joined: 18 Sep 2007
Posts: 1

PostPosted: Wed Sep 19, 2007 14:05    Post subject: Unable to Sleep, and iTunes restarting Reply with quote

Hi,

Firstly I'd like to say a big thanks for creating LCDTool - a real missing link!

I've got a couple of niggles with it which I thought I'd mention to see if anyone else has the same, or knows how to get around them.

My mac mini will not enter sleep when LCDTool is running. I can manually make it sleep, but it will not do it automatically. If I stop LCDTool and iTunesHelper then it will auto sleep. I have to stop both processes to make it sleep.

The second thing is that if I quit iTunes, it immediately starts again. I have to quit LCDTool first, then iTunes, and iTunes will then not auto restart.

As I said, not a complaint at all, just a couple of niggles.

Ian
Back to top
View user's profile Send private message
Sei



Joined: 01 Sep 2007
Posts: 23
Location: UK

PostPosted: Sat Sep 22, 2007 1:32    Post subject: quick and dirty Reply with quote

That's normal function, the default script polls iTunes every second, keeping iTunes active and your mac awake. the following script will allow you to pause LCDTool by pressing the 3 button.

Alternatively... (shameless plug) you could try my MultiScreen script and just switch from the iTunes screen Smile

Safari 3.0 (see additional for 2.0)
Code:
<html>
<head>
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript">
   var timer;
   var offMessage = "LCDTool paused, press 2 to restart."; 
   function setText(id, value) {$(id).innerHTML = value}
   function formatTime(sec) {var ss = Math.floor(sec % 60); ss = ss < 10 ? '0' + ss : ss; return Math.floor(sec/60) + ':' + ss}

function update() {
      var itunesStatus = application.runSystemScript('iTunesCurrentTrackFullStatus');
      itunesStatus = '(' + itunesStatus + ')';
      var itunes = eval(itunesStatus);
      setText('pos', formatTime(itunes['position']));
      setText('duration', formatTime(itunes['duration']));
      setText('artist', itunes['artist']);
      setText('name', itunes['name']);
      setText('album', itunes['album']);
       
      $('diamond').style.left = Math.floor(90 / itunes['duration'] * itunes['position']) + 'px';
      if(!application.updateDisplay()) stop();
 }

   function handleButton(button, upDown) {
      if (upDown == "down") return;
      if (button == "Softkey1") window.application.runUserScript('iTunesActivate');
      if (button == "Softkey2") start();
      if (button == "Softkey3") {
      setText('overlay', offMessage);
      $('overlay').style.display = 'block';
      setTimeout("stop();", 2000);
      }
      if (button == "Softkey4") window.application.runSystemScript('visitEntropyWebsite');
      if (button == "Display") showOverlay();
   }

   function showOverlay() {
      var data = window.application.runUserScript('doShellScript');
      setText('overlay', data);
      $('overlay').style.display = 'block';
      setTimeout("$('overlay').style.display = 'none';", 4000);
   }

   function init() {
      window.application.registerUserScript('iTunesActivate', 'tell application "iTunes" to activate');
      window.application.registerUserScript('doShellScript', 'do shell script "uptime"');
      start();
   }
   
   function start() {
      timer = setInterval("update()", 1000);
   $('overlay').style.display = 'none';
   }
   
   function stop() {
      clearInterval(timer);
   }
</script>
<style type="text/css">
   #top {overflow: hidden; height: 13px; margin-left: 1px;}
   #time {width: 156px;}
   #progress {width: 90px; height: 7px; border: 1px solid black; position: relative; overflow: hidden;}
   #diamond {position: absolute; z-index: -1; margin-left: -3px;}
   #overlay {position: fixed; top: 0; left: 0; background-color: white; width: 160; height: 43; padding: 2px; display: none;}
</style>
<link rel="stylesheet" href="css/default.css" />
</head>

<body class="border" onload="init();">
<div id="top"><span id="artist"></span></div>
<marquee scrolldelay="1000" scrollamount="20"><span id="name"></span> - <span id="album"></span></marquee>
<table id="time"><tr><td id="pos"></td><td><div id="progress"><img id="diamond" src="data:image/gif;base64,R0lGODlhBwAHAIAAAP///wAAACH5BAAAAAAALAAAAAAHAAcAAAIMhGMZq8sOAUSHJZkKADs=" /></div></td><td id="duration"></td></tr></table>
<div id="overlay"></div>
</body>
</html>


Safari 2.0 replace update with:
Code:
   function update() {
      var itunes = eval(window.application.runSystemScript('iTunesCurrentTrackFullStatus').replace(/'\\''/g, "\\'"));
      setText('pos', formatTime(itunes['position']));
      setText('duration', formatTime(itunes['duration']));
      setText('artist', itunes['artist']);
      setText('name', itunes['name']);
      setText('album', itunes['album']);

      $('diamond').style.left = Math.floor(90 / itunes['duration'] * itunes['position']) + 'px';
        if(!window.application.updateDisplay()) stop();
   }
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Entropy.ch Discussion Forums Forum Index -> LogitechLCDTool All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group