Script writing question

Using applications, configuring, problems
Post Reply
Message
Author
Ron
Posts: 184
Joined: Sun 03 Aug 2008, 17:36
Location: Around Seattle

Script writing question

#1 Post by Ron »

I'm trying to write a very simple executable script and have a question.

I need to call up defaultmediaplayer and also viewnior viewer in the same script. The problem is that as soon as the first app is brought up, the script apparently has to wait until the first one is exited before the second one is run and the program can go on. I imagine this is a simple problem, but can you help me with this? I call them up just by their names and file to run.

Thanks

Ron

User avatar
trapster
Posts: 2117
Joined: Mon 28 Nov 2005, 23:14
Location: Maine, USA
Contact:

#2 Post by trapster »

Code: Select all

defaultmediaplayer & viewnior &
trapster
Maine, USA

Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog

Ron
Posts: 184
Joined: Sun 03 Aug 2008, 17:36
Location: Around Seattle

#3 Post by Ron »

Great, thanks!

This works, but now no matter in which order I put the two commands, the mediaplayer dialog box is always on top of Viewnior. I would like for Viewnior to be on top. Any way to force which app's window is on top? Also, is there any way to force the windows to be minimized or maximized, and to set the displayed window size? All of this stuff has to be done in the script with no user involvement.

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#4 Post by big_bass »

the geometry is where you change the sizes

having the "$@" lets you do this as a dragNdrop thingy also

Code: Select all

xterm  -geometry 40x30+150+40 -e viewnior"$@"
Xdialog --title "Complete" \
        	--infobox "\nInstalling $@ has finished.\n" 0 0 3000


a quick example
using the program called top as an example I dont have viewnior installed the 3000 is 3 seconds to auto close the box

Code: Select all

xterm  -geometry 40x30+150+40 -e top"$@"
Xdialog --title "Complete" \
           --infobox "\nInstalling $@ has finished.\n" 0 0 3000 

there is a programming section in the forum where more people could help out with ideas

Joe

npierce
Posts: 858
Joined: Tue 29 Dec 2009, 01:40

#5 Post by npierce »

Ron wrote:This works, but now no matter in which order I put the two commands, the mediaplayer dialog box is always on top of Viewnior. I would like for Viewnior to be on top.
This is crude, but effective:

Code: Select all

defaultmediaplayer & sleep 1 ; viewnior &
Increase the sleep time if your defaultmediaplayer is so slow to appear that viewnior beats it.
Ron wrote:Any way to force which app's window is on top?
If you are using JWM, try adding this to your /root/.jwm/jwmrc-personal file, the restarting JWM:

Code: Select all

<Group>
<Name>viewnior</Name>
<Option>layer:5</Option>
</Group>
This should force viewnior to always be on top of defaultmediaplayer. The downside is that it forces it to be on top of all other windows that are opened in layer 4 (the default layer) or below, unless you minimize it. Of course, if you only have the two windows, or this window is small enough to place out of the way of others, that won't be a problem.

Another consideration is that if this window opens before the other, it won't have the keyboard focus even though it is on top. The user would need to click in the window first. Of course, if the user's first action in the window involves using the mouse, this shouldn't be a problem. But if the first thing the user does is, for instance, use Alt-f to access the file menu, it would be confusing to see a menu for a lower window appear -- or nothing appear if that part of the other window is covered. Using the sleep 1 command, as shown above, would eliminate this concern (and might eliminate the need for adding this Group tag to jwmrc-personal, depending upon your needs).
Ron wrote:Also, is there any way to force the windows to be minimized or maximized, . . .
Try adding this option within the Group tag show above, in addition to or in place of the layer option, depending upon your needs:

Code: Select all

<Option>maximized</Option>
There is also a minimized option. (For more options see:
http://www.joewing.net/programs/jwm/config.shtml#groups)
Ron wrote:. . . and to set the displayed window size?
The -geometry option mentioned by big_bass has been the recommended standard way of configuring the window geometry since before The GIMP was old enough to carry a tool kit. And there was a time when many, probably most, X applications supported it. Unfortunately, fewer and fewer applications support this option nowadays.

I've experimented with viewnior 0.6, and it does not seem to support it.

I don't know what you have for your defaultmediaplayer, but I have gxine 0.5.9, which doesn't exactly support the -geometry option either. It does, however, support a --geometry option. (Note the double-dash.) This is not documented by gxine --help or in the gxine man page, although it is documented in the xine man page. This uses the same format for describing the size and position as documented for -geometry in the X man page, and shown in the example given by big_bass: WIDTHxHEIGHT+XOFF+YOFF.

Be aware that, although gxine may initially appear at the size requested, it soon chooses to resize itself to whatever it thinks appropriate. At least that is what happens with the gxine 0.5.9 on Puppy 4.3.1. This also happens when using the maximized option in jwmrc-personal. Perhaps there is a way to change this behavior, but I do not know how. For what it's worth, you can gain some control by setting gxine's default window size in File -> Configure -> Preferences -> gui.

Have fun.

Ron
Posts: 184
Joined: Sun 03 Aug 2008, 17:36
Location: Around Seattle

#6 Post by Ron »

Thanks for all the great tips. I haven't had a chance to use them yet, but I'm sure they will help me a lot in trying to develop my project which seems to be growing...

Ron

npierce
Posts: 858
Joined: Tue 29 Dec 2009, 01:40

#7 Post by npierce »

You are welcome. Good luck with your project.

Post Reply