Training, Open Source computer languages

This is page http://www.wellho.net/forum/The-Tcl- ... guage/Expect-cannot-send-F11-keypress-to-Linux-Firefox.html

Our email: info@wellho.net • Phone: 01144 1225 708225

 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Expect - cannot send F11 keypress to Linux Firefox

Posted by donW6753 (donW6753), 7 September 2006
Just discovered this forum while searching for a solution. Have pulled most of my hair out, so before I am totally bald, here is my problem.
I am running Linux (testing on both FC3 and FC5). I am wanting to run Mozilla Firefox in full screen mode on a remote kiosk. I want to be able to launch Firefox remotely and have it come up in fullscreen mode (no menu bars, navigation, nothing ).  Without all the gory details I have looked at both Firefox and Epiphany, using Pessulus in lockdown and adjusting the config with about:config all to no avail. Firefox does not have command line settings to enable this at startup. So that brings me to Expect. I am a newbie to Expect, but I have Don Libes book and have read everything I can find but I am still vapor locked.

All I need to do is launch Firefox and press the F11 Key.
Sounds simple enough. Manually, everything works fine. But I want to be able to launch from a shell script and use Expect to do the F11 keypress. But I cannot make it work. I have run the 'do -c' command to retrieve the F11 keyboard string, put it in octal as '\033\[23~' and tried to send it but nope. I have run Don Libes autoexpect.exp script in an attempt to capture what is going on, but I don't get enough info.  I have tried dozens of scripts all to no avail. Below is a stripped down script of one of the many I have tried.

=================================
#!/usr/bin/expect --

# for testing, limit the run to 20 sec
set timeout 20

# launch firefox

spawn firefox

expect nothing

# pause to let firefox settle

sleep 3

# send the F11 key

send "\033\[23~"

expect nothing# [End of file]
================================

This is a very simple script and firefox does start. But the F11 key is not received by the process such that the app goes to fullscreen. Incidentally, I have tried other firefox functions (such as Ctrl-U) and they are not received either.  Surely, I am overlooking something obvious. When I run Expect with the -d option here is some of the output:
------- partial of diagnositc output ------------

executing commands from command file test_expect_script01.exp
spawn firefox
parent: waiting for sync byte
parent: telling child to go ahead
parent: now unsynchronized from child
spawn: returns {13623}
expect: does "" (spawn_id exp4) match glob pattern "nothing"? no
expect: read eof
expect: set expect_out(spawn_id) "exp4"
expect: set expect_out(buffer) ""
send: sending "\u001b[23~" to { exp4 send: spawn id exp4 not open while executing
"send "\033\[23~""
... and more ....
==============================

It appears Firefox process is closed and won't accept the send? Dunno

Any help you can provide would be much appreciated.

Posted by Custard (Custard), 7 September 2006
Hi,

Ok, it's not a Tcl or Expect fix, but I found this.. maybe you could try it and see what happens..

http://www.mouserunner.com/FF_Tips_Full_Screen.html

Let us know if it helps (It's nothing to do with me BTW, I just found it).

Another thing to try in expect: Send Alt-V Alt-F

Sorry I cant be more help here.

B

Posted by donW6753 (donW6753), 7 September 2006
Hi Custard,

Thanks for the quick reply ...

I checked into the Autohide link you provided.

I had forgot in my previous searching that I had come across the Autohide website.

The problem was ... that it is ONLY for Windows XP (darn). I need something for Linux FC3 or FC5.

I appreciate the feedback though. I just have to believe others have tried to lock down Firefox in Kiosk mode remotely. I am hoping it is something so simple I will be embarrassed.

Thanks again, DKW

Posted by admin (Graham Ellis), 8 September 2006
Don,

You say "I hope it's something so simple I'll be embarrassed".  I too hope it turns out to be simple, but it's not going to be anything to get embarrassed over - this is a darned good question and it's one of those highly specialised ones that has most of us here, I'm sorry, scratching our heads and saying "gosh - I've never been down THAT route but understand why he needs to". So the best I (and probably anyone else) can do here is be a questioner too, hoping that our questions can lead you in the right direction.

I agree with you that it appears that your Firefox prematurely closes.  Does Firefox do that because it knows its input is not interactive - i.e. by sensing the interactive bit.   I'm away from my office / library this morning, but I recall  that one of the ioctl bits controls this.   I'm also remembering things like the -T operator in Perl which can test whether or not STDIN is interactive (vi does the same thing if you background it!) and I wonder if Firefox is doing the same thing, and if so whether firefox can be fooled of has a command line switch to tell it to go ahead anyway.

With problems sending ^U as you describe, I don't think your immediate issue is with the sequence for the F11 key;  I trust you to have that right and if you haven't it may turn out to need further research once you get the more general issue sorted.

Hope this helps / starts a train of thought.   Certainly carry ion posting up here and we'll see whether we can worry our way to a solution for you.  I'm back in the office and with the manuals later today.


Posted by donW6753 (donW6753), 8 September 2006
Thanks Graham,

I will be working on it this morning (CST USA) so I hope to be back with some additional feedback.

Regards, DKW

Posted by donW6753 (donW6753), 11 September 2006
Well folks ... I have found the solution.

Alas, it does not have anything to do with Tcl or Expect as I was hoping. But the solution is easier for all of us.

It appears Mr. Heinaaro (Japan) has created a firefox extension that will do almost what I needed. He surely be a smart guy.

If you go to the Firefox Add-ons and look up R-kiosk under Extensions, you will find a firefox extension that can be used for Firefox 1.5+ and it really does work.  It says it will work for both Windows and Linux. I installed it on Linux FC5 so I know it works there.

The link is https://addons.mozilla.org/firefox/1659/

Before you do the download, read the 5th comment by Sean about setting up a 'test' Profile. Otherwise you might wipe out your good/default profile by mistake.

Once you install the extension you will need to manually launch Firefoxs about:config from the command line in order to adjust some of your browser settings (since in full screen you can no longer do that). Things like default homepage, automatic updates, et al.

Anyway, problem solved ... Enjoy!   DKW


Posted by admin (Graham Ellis), 11 September 2006
DKW, glad you have it sorted. Many thanks for following up and completing the thread.



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho