Notes {labels: 'NIL, viewFont: 10241} // nil=Unfiled, or specify a folder, e.g., 'Business. remove viewFont for current Styles default //ERASE! remove initial // to erase existing entries in this folder first Idler just burns some CPU cycles so that my MP120 just works fine now. What's problem? The display just goes off and on when the Newton has nothing to do. If it has to do something like I/O or handwriting recognition, everything's just fine. So until I know the reason for this problem, I just use this app. Probably it also can be used to power drain your batteries. ----------------------- idler //:doObj('build, 'idler) //:doObj('add, 'idler) //:doObj('remove, 'idler) //:saveApp('idler) { _proto: protoFloater, helpBook: :helpBookTemplate(), helpView: NIL, viewSetupDoneScript: func() begin RegPowerOff(kAppSymbol, func(what, why) self:powerOffScript(what, why)); RegPowerOn(kAppSymbol, func(why) self:powerOnScript(why)); end, viewQuitScript: func() begin :SetupIdle(0); UnRegPowerOff(kAppSymbol); UnRegPowerOn(kAppSymbol); end, viewSetupFormScript: func() begin :SetupIdle(self.idleTime); end, declareSelf: 'base, title: "Idler", action: nil, viewIdleScript: func() begin local i := sqrt(idleTime); return idleTime; end, viewBounds: {left: 0, top: 0, right: 230, bottom: 150}, viewJustify: 16+64, idleTime: 100, kData: { interval: 100, saveinterval: 'false, }, _package: { shortTitle: "idler", title: "Newton Idler", devSignature: "JoSch", version:2, copyright: "© 2002, 2007, 2008 Jochen SchŠfer", installScript: nil, removeScript: nil, noOpen: true, }, } ----- Idler idler+slider { _proto: protoSlider, trackSlider: func() begin local i := GetSlot(self, 'viewValue); if self._parent.aLabel2 <> nil then begin local text := NumberStr(i); SetValue(self._parent.aLabel2, 'text, text); RefreshViews(); end; end, viewSetupFormScript: func() begin local entry := GetAppPrefs(kAppSymbol, kData); value := if (entry.saveinterval) then entry.interval else 100; if value = nil then begin value := 100; entry.interval := 100; EntryChange(entry); end; SetValue(self, 'viewValue,value); end, changedSlider: func() begin local i := GetSlot(self, 'viewValue); self._parent.idleTime := self.viewValue; local entry := GetAppPrefs(kAppSymbol, kData); if (entry.saveinterval) then begin entry.interval := GetSlot(self, 'viewValue); EntryChange(entry); end; end, viewValue: 100, minValue: 100, maxValue: 1000, viewJustify: 0x00000030, viewBounds: {left:12 , top: 52, right: -8, bottom: 62}, } ----- Idler idler._package.installScript func(partFrame) begin constant kData := '{ interval: 100, saveinterval: false, }; local entry := GetAppPrefs(kAppSymbol, kData); end ----- Idler idler._package.removeScript func(partFrame) begin end ----- Idler idler+status {_proto: protoStatusBar, } ----- Idler idler.status+info {_proto: protoInfoButton, DoInfoAbout: func() begin if float exists then float:Open(); else PlaySound(@102); end, DoInfoHelp: func() begin local ttim := GetRoot().tinyTim; if not helpView then helpView := BuildContext({ _proto: ttim._proto, bookRef: helpBook}); ttim:close(); helpView:openManual(helpBook); end, DoInfoPrefs: func() begin if prefsfloat exists then prefsfloat:Open(); else PlaySound(@102); end, viewFlags: 515, viewJustify: 17414, viewBounds: :ButtonBounds(-13), } ----- Idler idler.status+minimize {_proto: protoTextButton, viewClickScript: func(unit) begin inherited:?viewClickScript(unit); local fn := func() self._parent._parent:actionCallback(); self.action := GetRoot().notifyIcon:AddAction(kActionName, fn, nil); self._parent._parent:Hide(); end, viewJustify: 0x00800406, text: "Min", viewBounds: :ButtonBounds(30), } ----- Idler idler+title {_proto: protoTitle, title: kTitle, } ----- Idler idler.ButtonBounds func(width) begin local left1:=10, top:=2, spacing:=6, bottom:=15; if width >0 then SetBounds(spacing,top, spacing+width,bottom); else SetBounds(left1,top, left1-width, bottom); end ----- Idler idler.status+zclose {_proto: protoLargeCloseBox, } ----- Idler idler+float {_proto: protoFloatNGo, viewFlags: 0x00000240, viewBounds: {left: 0, top:0, right: 150, bottom: 60}, viewJustify: 16+64, } ----- Idler idler.float+aboutText { viewClass: clParagraphView, textFlags: 0x00000008, viewBounds: RelBounds(5,5,140,80), viewFlags: 0x00000003, text: "Idler\n(C) 2002, 2007, 2008 Jochen SchŠfer\nThis is freeware.", } ----- Idler idler+aLabel1 {_proto: protoStaticText, viewFlags: 3, viewFormat: 0x00000000, viewJustify: 0x00000000, text: "Interval time (ms)", viewBounds: {left: 10, top: 33, right: 150, bottom: 55}, } ----- Idler idler+aLabel2 {_proto: protoStaticText, text: "100", viewBounds: {left: 160, top: 35, right: 260, bottom: 55}, } ----- Idler idler.actionCallback func() begin if self.action <> nil then GetRoot().notifyIcon:KillAction(self.action); self:Show(); end ----- Idler idler.powerOffScript func(what, why) begin :SetupIdle(0); if what = 'okToPowerOff then return true; else return nil; end ----- Idler idler.powerOnScript func(why) begin :SetupIdle(self.idleTime); end ----- Idler idler.reorientToScreen func() begin call ROM_DefRotateFunc with(); end ----- Idler idler+prefsfloat {_proto: protoFloatNGo, viewFlags: 0x00000240, viewBounds: {left: 0, top:0, right: 150, bottom: 60}, viewJustify: 16+64, } ----- Idler idler.prefsfloat+check {_proto: protoCheckBox, viewSetupDoneScript: func() begin local entry := GetAppPrefs(kAppSymbol, kData); if (entry.saveinterval) then begin :ToggleCheck(); end; end, viewJustify: 0x00000054, viewFlags: 513, viewBounds: SetBounds(0,0,130,15), text: "Save interval value", buttonValue: true, valueChanged: func() begin local entry := GetAppPrefs(kAppSymbol, kData); entry.interval := self._parent._parent.slider.viewValue; entry.saveinterval := self.viewValue; EntryChange(entry); end, } ----- Idler init func() begin :DefConst('kAppName, "idler:JoSch"); :DefConst('kSoupName, kAppName); :DefConst('kTitle, "Idler by Josch"); :DefConst('kActionName, "Idler"); :DefConst('kAppSymbol, Intern(kAppName)); end ----- Idler idler.helpBook+page1 .subject 1 About idler .story I developed idler to test a theory about my MP120. When it idles, its display went blank, but when I tapped anything or it performed an operation, the display went on again. So I conceived idler to let my MP120 do something permanently. ----- Idler idler.helpBook+page2 .subject 1 Usage .story Usage is easy: Just tell idler by dragging the slider, how often the operation should fire. If the Newton is turned off, the operations are interrupted to prevent the batteries from depleting. In the preferences,you can make the interval value permanent. ----- Idler idler.helpBook+page3 .subject 1 Source code .story You will find the source code at http://www.joschs-robotics.de/newton/index.html#idler. Do what you like with it as long as you give me credit. ----- Idler