FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 07-09-2012, 10:51 AM
user1
 
Default how to start a program using autoexpect

I am using 12.04

I have installed: expect and expect-dev

Autoexpect is in expect-dev package

When I try to use autoexpect to start firefox I get:

warning: The global `on()` function in content scripts is deprecated in
favor of the `self.on()` function, which works the same. Replace calls to
`on()` with calls to `self.on()`

I can run commands like date and ls using autoexpect without problems.

Example on how I use use autoexpect:

$ autoexpect -c (To start autoexpect session)

$ date (command I want to be run)

$ exit (or Ctrl+d) - When done autoexpect session

$ ^C (or close bash konsole) - To 'remove' autoexpect session

To run the session:

$ ./script.exp (sitting in /home/myusername/

Anybody know how to start a program using autoexpect?



--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 07-09-2012, 01:18 PM
"Kevin O'Gorman"
 
Default how to start a program using autoexpect

On Mon, Jul 9, 2012 at 3:51 AM, user1 <bqz69@telia.com> wrote:
> I am using 12.04
>
> I have installed: expect and expect-dev
>
> Autoexpect is in expect-dev package
>
> When I try to use autoexpect to start firefox I get:
>
> warning: The global `on()` function in content scripts is deprecated in
> favor of the `self.on()` function, which works the same. Replace calls to
> `on()` with calls to `self.on()`
>
> I can run commands like date and ls using autoexpect without problems.
>
> Example on how I use use autoexpect:
>
> $ autoexpect -c (To start autoexpect session)
>
> $ date (command I want to be run)
>
> $ exit (or Ctrl+d) - When done autoexpect session
>
> $ ^C (or close bash konsole) - To 'remove' autoexpect session
>
> To run the session:
>
> $ ./script.exp (sitting in /home/myusername/
>
> Anybody know how to start a program using autoexpect?

Your question is unclear. You just started the program /bin/date in
the snippet in your email. What more do you want?

--
Kevin O'Gorman, PhD

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 07-09-2012, 01:24 PM
"Kevin O'Gorman"
 
Default how to start a program using autoexpect

On Mon, Jul 9, 2012 at 6:18 AM, Kevin O'Gorman <kogorman@gmail.com> wrote:
> On Mon, Jul 9, 2012 at 3:51 AM, user1 <bqz69@telia.com> wrote:
>> I am using 12.04
>>
>> I have installed: expect and expect-dev
>>
>> Autoexpect is in expect-dev package
>>
>> When I try to use autoexpect to start firefox I get:
>>
>> warning: The global `on()` function in content scripts is deprecated in
>> favor of the `self.on()` function, which works the same. Replace calls to
>> `on()` with calls to `self.on()`
>>
>> I can run commands like date and ls using autoexpect without problems.
>>
>> Example on how I use use autoexpect:
>>
>> $ autoexpect -c (To start autoexpect session)
>>
>> $ date (command I want to be run)
>>
>> $ exit (or Ctrl+d) - When done autoexpect session
>>
>> $ ^C (or close bash konsole) - To 'remove' autoexpect session
>>
>> To run the session:
>>
>> $ ./script.exp (sitting in /home/myusername/
>>
>> Anybody know how to start a program using autoexpect?
>
> Your question is unclear. You just started the program /bin/date in
> the snippet in your email. What more do you want?

If you have a command-line program, you can start it directly by
putting it on the command-line
autoexpect -c /bin/date
but unless it takes commands, I cannot see the point of using Expect at all.

Example using an old old game:

kevin@treat CWumpus $ autoexpect ./wumpus
autoexpect started, file is script.exp
INSTRUCTIONS (Y-N): n

ATTENTION ALL WUMPUS LOVERS!!!
THERE ARE NOW TWO ADDITIONS TO THE WUMPUS FAMILY
OF PROGRAMS.

WUMP2: SOME DIFFERENT CAVE ARRANGEMENTS
WUMP3: DIFFERENT HAZARDS

HUNT THE WUMPUS

YOU ARE IN ROOM 6
TUNNELS LEAD TO 5 7 15

SHOOT OR MOVE (S-M): m
WHERE TO: 5

YOU ARE IN ROOM 5
TUNNELS LEAD TO 1 4 6

SHOOT OR MOVE (S-M): ^Cautoexpect done, file is script.exp
kevin@treat CWumpus $

--
Kevin O'Gorman, PhD

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 07-12-2012, 08:49 AM
user1
 
Default how to start a program using autoexpect

>
> Your question is unclear. You just started the program /bin/date in the
> snippet in your email. What more do you want?

E.g. to start firefox or to start a bunch of programs after login

The more I know the more ideas I get in future - ideas spawn new ideas in
my brain.

I am experimenting to learn - hoping others will learn from this list :-)



--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 07-12-2012, 03:13 PM
"Kevin O'Gorman"
 
Default how to start a program using autoexpect

On Thu, Jul 12, 2012 at 1:49 AM, user1 <bqz69@telia.com> wrote:
>
>>
>> Your question is unclear. You just started the program /bin/date in the
>> snippet in your email. What more do you want?
>
> E.g. to start firefox or to start a bunch of programs after login
>
> The more I know the more ideas I get in future - ideas spawn new ideas in
> my brain.

I love Expect, but it is the wrong tool for that job. Even if I were
to use it, autoexpect is an even stranger choice.

If I want to start a GUI program like firefox (browser), or pidgin
(chat), or CALibre (document repository), I would use bash (a shell).
So I suggest you learn more about the shell. You are running one any
time you start a terminal program. Just type something like
> firefox&
(That "&" detaches firefox from the shell so they run independently).

On the other hand, if you want to start a CLI program and direct it to
do several things, Expect is a reasonable tool. It really shines,
however, at running multiple programs simultaneously, taking note when
any of them issues output and responding according to what it sees.

Autoexpect is a quick way to get an Expect script created. Unless you
are doing something exceedingly simple, the resulting script will
need to be edited. The script generated by autoexpect can only handle
in the future the exact same results that were seen when you created
the script. Anything else will cause the script to wedge or otherwise
fail.

Oh, and to start multiple programs, you would write a bash script thus:

====================== cut here ====================
#!/bin/bash

firefox&
pidgin&
calibre&
====================== cut here ====================

make that script executable, and run it when needed. You can get it
executed on login by editing the startup scripts in your home
directory. Bash can be set up in various ways, but on Ubuntu you'd
want to start with .profile or .bashrc.

====================== add this to .bashrc (at the end) =====================
# Put your fun stuff here.
if [ -e ~/.mybashrc ]
then
source ~/.mybashrc
fi
====================== end =========================================
then create .mybashrc, and put any commands you like in it.

> I am experimenting to learn - hoping others will learn from this list :-)

If you want to become good at this, experimenting will take forever.
You need to do some serious reading. There are tutorials on the web,
I'm sure.

--
Kevin O'Gorman, PhD

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 07-12-2012, 04:16 PM
Colin Law
 
Default how to start a program using autoexpect

On 12 July 2012 09:49, user1 <bqz69@telia.com> wrote:
>
>>
>> Your question is unclear. You just started the program /bin/date in the
>> snippet in your email. What more do you want?
>
> E.g. to start firefox or to start a bunch of programs after login

To start applications after login you can use Startup Applications
under the settings cog in the top right hand corner. You can start an
application or run a script to do whatever you want.

Colin

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 07-13-2012, 12:08 PM
user1
 
Default how to start a program using autoexpect

> but unless it takes commands, I cannot see the point of using Expect at
> all.

My idea was to be able to start a bunch of programs at a time like e.g.
firefox, dolphin, konsole, kate and thunderbird using autoexpect

Otherwise I am experimenting and learning which sometimes brings up new
ideas for me

By the way I am searching for an easy to use Macro program which can
remember keyboard strokes mixed with mouse actions?


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 01:38 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org