Change string via shell script [solved]

Hi all,

I want to change a string in a FVWM-Button created with a FVWM script. Here’s my FVWM script:[code]WindowTitle {FvwmScript-CPU}
WindowSize 64 27

Set $cpu = 100%
ChangeTitle 1 $cpu

Widget 1
Size 64 27
Position 0 -5
Font “xft:Arial:pixelsize=12”
Type ItemDraw
Flags NoReliefString

Case message of

1 :
		ChangeTitle 1 $cpu


This is my shell script:[code]#!/bin/sh

FvwmCommand “SendToModule FvwmScript-CPU SendString 1 1 200%”

exit 0[/code]

I swallow it in my FVWM button box with*FvwmDocks: (5x3+22+3, Padding 0 0, Container(Frame 0)) *FvwmDocks: (1x1, Swallow "FvwmScript-CPU" `FvwmScript $[fvwm_script]/FvwmScript-CPU`) *FvwmDocks: (End)

After restart the text is printed under my xosview cpu meter. But if I execute the shell script nothing happens. As in the FVWM-script manpages described it should change the text …

Could anybody help me ? I don’t know what’s going wrong …

Thanks in advance


Hmm, why don’t you just read the output of whatever script you plan to use in with FvwmScript? Using GetOutput and PeriodicAction (iirc, check the manpage) should help with that.

If otoh you just want to use your FvwmScript to display the output of some script then why not use an FvwmButton? You can easily change the title of any FvwmButton you please by using something like:

SendToModule my_fvwm_buttons ChangeButton button_name Title whatever_you_want_to_display

As to your actual question: I have no idea why it wouldn’t work, as you’ve probably deducted by now I haven’t yet had the need to call into my FvwmScripts :wink:

This is only a pretest for my cpu program (extracted from wmcpuload). I need less than 1 second for updating. Therefore I want to send the output to my FVWM button (see screenshot below). The shell script is only a simulation if it works 8)

So, do you think my FvwmScript is correct ?



1 : Begin Set $cpu = (LastString) ChangeTitle 1 $cpu End

Yes the (LastString) part was missing in my script. But it didn’t worked also :frowning:

But I have let it in the script and test it with the SingleClic, too. This part works well, so I thought it could be a problem with my shell script / FvwmCommand call - and yes I found the problem: I need the full path to the script !!![code]#!/bin/sh

FvwmCommand “SendToModule /home/tf/.fvwm/script/FvwmScript-CPU SendString 1 1 200%”

exit 0[/code]
Now the title was changed.

But is there no way to take a FVWM variable like $[script] for instance ? Because this would be better and more common than the full path :wink:



Try with $$[variable] when doublequoting.

WithFvwmCommand "SendToModule $fvwm_script/FvwmScript-CPU SendString 1 1 200%"
it works 8)

Thank all for helping.

Best Regards


*FvwmScript: Path $[FVWM_USERDIR]/script

So you don’t need the full path or SetEnv.

Where must I put in this line ? :confused:


In my config is above
ImagePath $FVWM_USERDIR… line. :slight_smile:

Thanks for your reply. Cool knowledge 8) . But I have so many parts in my configs/scripts with the SetEnv variable fvwm_script that I take my last version (too much too change :blush: ). Hope you excuse me …

Best Regards,