0

私のPerlはまったく良くなく、なぜこの素晴らしいperlスクリプトが返され続けるのかを判断するのに苦労しています。

エラー:実行中のウィンドウが見つかりません[xwininfo-tree-root]にウィンドウ[Mozilla]が見つかりませんでした

私はこれらの変数を設定しました:

my $PROGNAME = $0;
$PROGNAME =~ s|.*/||;
my $GRAB = 'xwd -silent -nobdrs -id %id | convert -quality 85 - %out';
my $XINFO = 'xwininfo -tree -root';
my $BROWSER = 'firefox';    # Must match find_window() code - see usage()

使用法ではこれを言います:

- Requires "Mozilla" or "Opera" browser
    (update find_window() code for other browsers)

関連するコードは次のとおりです。

# I'm using mozilla..
sub find_window {
  $BROWSER eq "opera" ?
    opera_find_window(@_) :
    mozilla_find_window(@_);
}

Firefoxブラウザを反映するために上記をどのように取得しますか?私のシェルでは、mozillaと入力しても何も起こらず、firefoxと入力するとブラウザが開くので、これを使用する必要があります。

そのエラーを返す問題のコードは次のとおりです。

sub mozilla_find_window {
  open(XINFO,"$XINFO|") || die("Couldn't run: [$XINFO]\n");

  # Pick the first mozilla window.  It's got the title in it, but
  # we have no way of knowing if that matches the URL, so we'll
  # hope this is the right one..
  my ($spacing,$id,$title,$x,$y);
  while(<XINFO>) {
    # This could easily break and is very mozilla specific (works on firefox)
    # Looks for [...("Mozilla" "navigator:browser") ..]
    # I've had this reported:     0x80002f "TITLE - Mozilla": ("Gecko" "Mozilla-bin")  889x687+0+22  +136+44
    last if (($spacing,$id,$title,$x,$y) = (/^(\s+)(0x[0-9a-f]+) "(.*)\s*-\s*Mozilla.*": \("Mozilla" "navigator:browser"\)\s*$GEOM_RE$/));

    last if (($spacing,$id,$title,$x,$y) = (/^(\s+)(0x[0-9a-f]+) "(.*)\s*-\s*Mozilla.*": \("mozilla-bin" "Mozilla-bin"\)\s*$GEOM_RE$/));
    # Mozilla Firefox 1.0.4
    last if (($spacing,$id,$title,$x,$y) = (/^(\s+)(0x[0-9a-f]+) "(.*)\s*-\s*Mozilla Firefox.*": \("Gecko" "Firefox-bin"\)\s*$GEOM_RE$/));
        # Debian Mozilla Firefox
        last if (($spacing,$id,$title,$x,$y) = (/^(\s+)(0x[0-9a-f]+) "(.*)\s*-\s*Mozilla Firefox.*": \("firefox-bin" "Firefox-bin"\)\s*$GEOM_RE$/));
  }
  die("Couldn't find window [Mozilla] in [$XINFO]\n") unless $title && $x && $y;

誰かが私がこれを修正する方法を知っています、私が間違っていることは何ですか?それはFirefoxがインストールされている場所に関係している問題ですか?

皆さんありがとう

アップデート

 0x140529c "Firefox": ()  10x10+-100+-100  +-100+-100
 0x14051b9 "Firefox": ()  10x10+-100+-100  +-100+-100
 0x14038c9 "Firefox": ("firefox" "Firefox")  1x1+-100+-100  +-100+-100
    1 child:
    0x14038ca (has no name): ()  1x1+-1+-1  +-101+-101
 0x14002bd "Firefox": ()  1x1+0+0  +0+0
    1 child:
    0x14002be (has no name): ()  1x1+-1+-1  +-1+-1
 0x1400210 "Firefox": ()  10x10+-100+-100  +-100+-100
 0x14000ea "Firefox": ("firefox" "Firefox")  200x200+0+0  +0+0
    1 child:
    0x14000eb (has no name): ()  1x1+-1+-1  +-1+-1
 0x14000a6 "Firefox": ("firefox" "Firefox")  200x200+0+0  +0+0
    2 children:
    0x14000a9 (has no name): ()  1x1+-1+-1  +-1+-1
       1 child:
       0x14000aa (has no name): ()  1x1+2+2  +1+1
          1 child:
          0x14000ab (has no name): ()  1x1+0+0  +1+1
             4 children:
             0x140519f (has no name): ()  1x1+-1+-1  +0+0
             0x140519e (has no name): ()  1x1+-1+-1  +0+0
             0x1400286 (has no name): ()  1x1+-1+-1  +0+0
             0x14000ad (has no name): ()  1x1+-1+-1  +0+0
    0x14000a7 (has no name): ()  1x1+-1+-1  +-1+-1
 0x140008d "Firefox": ("firefox" "Firefox")  200x200+0+0  +0+0

これを手動で実行すると、上記の結果が得られますxwininfo -tree -root

4

1 に答える 1

4

の出力から、xwininfoFirefox が X ウィンドウ リストに"Firefox": ("firefox" "Firefox")として表示されることがわかります。

現在、この組み合わせを探している正規表現はありません。このコードを行の直後#Debian Mozilla Firefox(または少なくとも同じwhileブロックのどこかに)追加します。

# my Firefox
last if (($spacing,$id,$title,$x,$y) = (/^(\s+)(0x[0-9a-f]+) "(Firefox)": \("firefox" "Firefox"\)\s*$GEOM_RE$/));
于 2009-12-29T03:25:44.967 に答える