Providing feedback in scripts - Tip

Under development: PCMCIA, wireless, etc.
Post Reply
Message
Author
User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

Providing feedback in scripts - Tip

#1 Post by rarsa »

This is not cutting edge, but it's development and it didn't fit anywhere else.

I've seen that Barry's scripts execute the 'please wait..' xmessage before doing something time consuming.

The problem I saw is that the script "killall xmessage" will kill other scripts with xmessage windows open.

I found this while looking for a way to provide feedback in my vncserver-wizard. So I saw how Barry was doing it and took the idea one step further to only close the window I want to close. Here is the generic form:

Code: Select all

# Show the wait message
xmessage -bg "#b3bfab" -center -name "wait" -title "A title" \
   -buttons "" "Doing something. Please wait ..." & echo $! > /tmp/msg1PID

# Do some task that takes some time
dosomething 

# Kill the window we started abobe
kill `cat /tmp/msg1PID`
or

Code: Select all

# Show the wait message
xmessage -bg "#b3bfab" -center -name "wait" -title "A title" \
   -buttons "" "Doing something. Please wait ..." & 

# Save the window's process ID
MSG_PID=$!

# Do some task that takes some time
dosomething 

# By killing the process we in fact close the window
kill $MSG_PID

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#2 Post by BarryK »

Yes, thanks for that suggestion,
my scripts do need to be fixed.

Post Reply