Sign in to follow this  
Followers 0
mraymond

How do I run my Perl script from AutoIT

15 posts in this topic

I have Cygwin installed on XP and Windows 2000 so I can create and run Perl scripts. How do I run these scripts or call them from inside AutoIT scripts? I'm using AutoIT V3

For example:

My AutoIT script is running and needs to start a script called filelauncher.pl Then when filelauncher.pl is done I should still be running my AutoIT script and it may do other things, perhaps launch another Perl script. We don't care as long as we can run our Perl scripts from inside AutoIT

Share this post


Link to post
Share on other sites



HI,

RunWait(@ComSpec & ' /c start c:\downloads\perl\Tag2Übung1.pl', '', @SW_HIDE)

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Thanks for posting my post. :lmao:

Did it help you out?

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Thanks for posting my post. :lmao:

Did it help you out?

So long,

Mega

Hi.

Sorry about that post of the post. I meant to come back and remove that somehow but got tied up black box testing. Anyway... it hasn't helped me yet. I've tried several ways of executing that runwait code, but it either doesn't launch my scipt, can't find the script, or gives me an error saying it can't run the external program. Does the Perl script have to be in Perl directory. I hope not, because I'm trying to write a driver that runs a set of automation scripts sitting in a specific folder. The path to the folder is:

c:\Program Files\Vernier Software\Test_Automation\filelauncher.pl

My AutoIt script driver to call these Perl script resides in the same folder as these Perl scripts.

Some of the code lines I've tried:

RunWait(@ComSpec & ' /c start c:\Program Files\Vernier Software\Test_Automation\filelauncher.pl', '', @SW_HIDE)

RunWait(@ComSpec & '$Path_To_File$', '', @SW_HIDE)

RunWait(@ComSpec & string($Path_To_File), '', @SW_HIDE)

Share this post


Link to post
Share on other sites

HI,

try this one:

RunWait(@ComSpec & ' /c start "c:\Program Files\Vernier Software\Test_Automation\filelauncher.pl"', '', @SW_HIDE)

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

HI,

try this one:

RunWait(@ComSpec & ' /c start "c:\Program Files\Vernier Software\Test_Automation\filelauncher.pl"', '', @SW_HIDE)

So long,

Mega

Nope! This one gets as far as opening up a DOS window, although in the correct directory... but that's all. It stops at that point. The question is, can you run Perl scripts from DOS? To run filelauncher.pl I generally start Cygwin (a unix environment), then type cd "c:\program files\vernier software\test_automation", and then type ./filelauncher.pl to run the script. The scripts runs fine. I would think this RunWait function couldn't do that, but I don't know.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Hi,

:lmao: okay, when your system isn't configured tht way, then Run or RunWait or ShellExecute can not work. That is true. If you cannot run perl scripts manually in a DOS way, why should the automatic way work?

If you need to start cygwin first, then do so. Surely, that is possible.

So long,

Mega

Edited by th.meger

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

what are you using to launch the pearl script if you just run it by itself?

To run those Perl scripts, I've only been running them directly from the Cygwin enviroment just by typing the command ./filelauncher.pl, so I've not been using anything to launch them other than a hand typed command at the prompt. I've tried th.meger's idea of first launching Cygin so the enviroment is running, but that didn't work either. What I was hoping to be able to do was use AutoITs GUI to create a driver that a tester would be able to just double-click from Windows Explorer. AutoIT driver would allow the user to select the test sets they want to run (via checkbox). The driver would then unzip the selected self extracting test set(s) and then call the intermal Perl script of the same name (less the TS_ in front of the zipped file).

For example:

TS_filelauncher.exe (this would be the self extracting zip file the user selected from the AutoIT driver)

filelauncher.pl (this would be the Perl script the driver calls after the test set is unzipped)

Open_Files.exe (part of the test set and a compiled AutoIt called by filelauncher.pl

What I am attempting to do is find some slick easy way for a user to select which test sets to run. Maybe you can't do this from Windows? Can AutoIT run Perl scripts if the user has logged into Cygwin? I tried ts.meger's idea by launching Cygwin first and running a compiled version of this RunWait function and it sill just opens a DOS window and stops.

Share this post


Link to post
Share on other sites

Heres a quick test, Go to windows folder, and copy cmd.exe, paste it into the same directory as the perl script, run the cmd.exe and type filelauncher.pl

Does it run?


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Hi,

I've got AcitvePerl installed and in my System variable PATH the path to the exe. (c:\Programme\Perl\bin)

Now I can easily click on every *.pl file or run it out of a DOSBox.

So long,

Mega

Edited by th.meger

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Hi,

I've got AcitvePerl installed and in my System variable PATH the path to the exe. (c:\Programme\Perl\bin)

Now I can easily click on every *.pl file or run it out of a DOSBox.

So long,

Mega

I got the Perl script to run from the DOS dialog by typing "Perl ./filelauncher.pl", and as long as I added the path to the "C:\Cygwin\usr\bin" directory in the PATH command first. Haven't figured out how to get it all to work in AutoIT yet though. Looks hopeful at the moment.

Share this post


Link to post
Share on other sites

Try the new ShellExecute function. Realeased in a recent beta :lmao:

Share this post


Link to post
Share on other sites

The online docs have not been updated. However, the beta sticky on this forum notes the existance of a ShellExecute function.


Who else would I be?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0