SendToModule with FvwmCommand

Quick question, I’m sure I’m just overlooking something:

I have a FvwmScript that has the function named “SingleClic” in it. Everything works fine, and when I click on the button the resulting code is executed.

Here is the related portion of my .fvwm2rc:

*WeatherIcon: (1x1+0+0, Swallow "WeatherImage" "FvwmScript scripts/WeatherImage", ActionOnPress SendToModule WeatherImage SendString SingleClic)

The problem is that if I try to execute SingleClic using FvwmCommand nothing happens.

FvwmCommand "SendToModule WeatherImage SendString SingleClic"

Am I doing something wrong, or does it just not work in this way?

That looks OK. Can you paste your script in full? Do you have ‘CommandS’ started in your StartFunction? Where are you calling FvwmCommand from?

– Thomas Adam

I have CommandS in my .fvwm2rc. I’m running FvwmCommand from aterm, and know FvwmCommand works from there, since I’ve used it for other things.

The script, including the singnal for SingleClic, works great normally, but not using FvwmCommand.

Here is the script:

[code]WindowTitle {WeatherImage}
WindowSize 50 50
Colorset 54

Init
Begin
#change icon
Set $icon = (GetOutput {perl ~/.fvwm/scripts/weather_current.pl icon} 1 -1)
ChangeIcon 1 $icon
End

PeriodicTasks
Begin
If (RemainderOfDiv (GetTime) 1800)==0 Then
Begin

            #change icon
            Set $icon = (GetOutput {perl ~/.fvwm/scripts/weather_current.pl icon} 1 -1)
            ChangeIcon 1 $icon
    End

End

Widget 1
Property
Type ItemDraw
#Icon $icon
Size 50 50
Position 0 0
Font “Shadow=0 SE:xft:Comics:size=13”
Flags NoFocus NoReliefString
#Main
#Case message of
#End

Main
Case message of
SingleClic:
Begin
Do {Exec ~/.fvwm/scripts/moveweathermap.sh}
End
End
[/code]

Because you’re probably using FvwmCommand in the wrong way. If you can, enclose whatever evaluation you need to within a PipeRead command and just echo the sendtomodule command inside that.

– Thomas Adam

I don’t think I’m understanding your suggestion… I’ve been always a bit hazy on how to use PipeRead’s correctly, and when I shoudl use them.

I tried this:

FvwmCommand "PipeRead 'echo SendToModule WeatherImage SendString SingleClic'"

But it does nothing. I’ve tried a whole bunch of other variations on this command, but no luck… or else I wouldn’t be posting :slight_smile:

By the way… In the above example, running the moveweathermap.sh script works fine, without any FvwmCommand interaction, but this is more of a test of how to send a signal to a FvwmScript using FvwmCommand.

I’m only getting tiny sporadic pieces of information from you, Mike – it’s like having to do the whole “question -> answer” thing in reverse. You give me some symptoms, and I then have to work out what the question was, and the interim that took you to the answer. :stuck_out_tongue: It’s not fun, or meant to be that way. :wink:

The reason why I suggest “PipeRead” to you is because it’s probably the command you ought to be using. So many people I have helped in the past have used FvwmCommand when it was utterly superfluous to their means.

However, despite my own efforts, SendToModule to my own FvwmScript failed for the SingleClic event. The snippet below however approximate it:

Main
 Case message of
  SingleClic :
  Begin
    Set $str2 = hellothere
    ChangeTitle 1 $str2
  End

  10 :
  Begin
    Set $str2 = hellothere
    ChangeTitle 1 $str2
  End
End

Such that one can then do:

SendToModule somename SendString 1 10 somname

What’s contained within label “10:” is all that the single clic event would be doing. YMMV on this one — I am not a big FvwmScript user.

– Thomas Adam