Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread Display Modes
Old Jan 19, 2007, 09:33 PM   #1
macrumors 6502
Join Date: Apr 2005
Location: London, UK
Send a message via AIM to fitinferno
Help w/Dashcode Widget: Ping & Refresh to Indicate Status

Hello all. Wondering if anyone can help me out w/this as I've been googling and learning all the js I can, but still can't seem to figure things out

Basically, I am trying to make a widget that will show the status of 9 computers on my network I am required to monitor. I have a feeling that by pinging the computers every 5 minutes or so and seeing if it gives a response that will let me know whether it's funcitioning properly or not (my job is just to make sure they stay connected to the network).

So, I've gone into the custom widget on Dashcode. I've gotten far enough to make a widget that has the 9 indicator buttons and then let them know that at a certain range in value 0 I want it to go green or red. However, I have no idea what to tell it so that I can have the ping status reflected as that green or red indication.

Here's my js code for the widget. At the bottom is the silly attempt I've made at adding in a refresh, but I don't think it's what I'm looking for (to be honest, I just cut it from another widget ). I really feel thick as this sounds so simple!

// This file was generated by Dashcode from Apple Computer, Inc.
// You may edit this file to customize your Dashboard widget.

function load()

function remove()
// your widget has just been removed from the layer
// remove any preferences as needed
// widget.setPreferenceForKey(null, createInstancePreferenceKey("your-key"));

function hide()
// your widget has just been hidden stop any timers to
// prevent cpu usage

function show()
// your widget has just been shown. restart any timers
// and adjust your interface as needed

function showBack(event)
// your widget needs to show the back

var front = document.getElementById("front");
var back = document.getElementById("back");

if (window.widget)

if (window.widget)
setTimeout('widget.performTransition();', 0);

function showFront(event)
// your widget needs to show the front

var front = document.getElementById("front");
var back = document.getElementById("back");

if (window.widget)

if (window.widget)
setTimeout('widget.performTransition();', 0);

if (window.widget)
widget.onremove = remove;
widget.onhide = hide;
widget.onshow = show;
function show ()
document.getElementById("indicator").object.setValue(1);document.getElementById("indicator1").object .setValue(1);document.getElementById("indicator2").object.setValue(1);document.getElementById("indic ator3").object.setValue(1);document.getElementById("indicator4").object.setValue(1);document.getElem entById("indicator5").object.setValue(1);document.getElementById("indicator6").object.setValue(1);do cument.getElementById("indicator7").object.setValue(1);document.getElementById("indicator8").object. setValue(1);

function refreshState() {
if(refreshBlocked) {
countdownCalledWhileBlocked = true;
seconds_left = 0;
countdownCalledWhileBlocked = false;

currentlyRefreshingState = true;
setTimer("in progress...");
the_timeout = null;

// get Location

// setup internal and external IPs (calls checkWAN() on itself)

// call if refresh ended
function refreshEnded(seconds_already_set) {
lastRefresh = new Date();
getObj("lastRefresh").innerHTML = formatDate(lastRefresh, true);

currentlyRefreshingState = false;
if(!seconds_already_set) {
seconds_left = original_timer;

setTimeout("adjustTotalSize(-1)", ANIM_DEF_TIME);
setTimeout("countdown()", 10);
fitinferno is offline   0 Reply With Quote

MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Help writing a WebApp with Dashcode iJC-1976 Mac Programming 3 May 11, 2011 12:48 AM
I need a little help with Dashcode thinhoo Web Design and Development 2 Apr 27, 2011 06:14 PM
dashcode errors in custom JavaScript jarv Web Design and Development 2 Jan 23, 2011 05:31 AM
Help With Dashcode Browser Template! goaliej71 iPhone/iPad Programming 0 Nov 29, 2009 09:19 PM
eMac Stuck at Grey Screen & Spinning Progress Indicator TheWineLover PowerPC Macs 3 Feb 23, 2008 08:06 AM

All times are GMT -5. The time now is 09:49 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013,, LLC