5
  1. I want to save a firefox webpage using xdotool, and rename the saved file to be test.

    $ xdotool search "<FirefoxWindowName>" windowactivate --sync  \
    key ctrl+s  type  'test'  --sync  key alt+s
    

    But the rename isn't current, and may include part of --sync key alt+s as the new name. Also alt+s isn't performed.

  2. I also hope to choose "Webpage, complete", and possibly change saving destinationHow shall I do these by xdotool?

    Thanks.

Tim
  • 25,177
  • Instead of alt+s you can also use "enter" – Smile4ever Apr 23 '15 at 11:52
  • @Tim: If you like the answer, just click the little grey ☑ under the "0" now turning it into beautiful green. If you do not like the answer, click on the little grey down-arrow below the 0, and if you really like the answer, click on the little grey checkmark and the little up-arrow... – Fabby Aug 19 '15 at 12:38
  • @Fabby; I appreciated the answer, so clicked the little up-arrow. I am still open to other answers, so I left the checkmark unchecked. – Tim Aug 19 '15 at 12:51

1 Answers1

5

Here is a little script for that.

Probably you still need to adjust the window names.

#!/bin/bash

# Firefox win id
FFWID=$(xdotool search --name "Google - Mozilla Firefox" | head -n1)

xdotool windowactivate "$FFWID" --sync

# Safe dialog win id
FFDWID=$(xdotool search --name "Save as" --sync)

xdotool windowactivate "$FFDWID"
xdotool key "ctrl+s" type "save"
xdotool key "alt+s"
A.B.
  • 90,397