sathish Posted May 22, 2012 Share Posted May 22, 2012 Hi Forum, I am a perl developer (Medium) and Autoit (Beginner), I wrote a perl script using my $Au3 = Win32::OLE->new("AutoItX3.Control"); My code is below expandcollapse popupuse strict; use warnings; use Win32; use Win32::API; use Win32::OLE; my $Au3 = Win32::OLE->new("AutoItX3.Control"); my ($fname, $Curr, $fname1, $bbox, $bbox1, $file1, $error, $path, $filex, $filexx, $contentopf, $tocncx, $filess, $ebookmetadata1, $filecc, $bbox99, $snocounter); my ($Line, $Variable, $PreMatch, $taglist, $taglist1, $mapfile, $mapbox, $maptext, $find, $replace); my ($foottxt) = (""); my $fpath = $ARGV[0]; my $fpath2 = $ARGV[1]; Win32::MsgBox("SET MATHTYPE TRANSLATIONS IF NOT!!!", MB_ICONSTOP, "SET MATHTYPE TRANSLATIONS IF NOT"); opendir (FF, $fpath) or die Win32::MsgBox("Directory not found!!!", MB_ICONSTOP, "DIRECTORY NOT FOUND"); my @contents3 = grep /(\.eps$)/, readdir FF; foreach $file1 ( @contents3 ) { #print "$file1 processing\n"; $file1=~s/\.eps$//g; open($path, ">$fpath\\$file1\.txt"); close($path); $Au3->run ('C:\Program Files\MathType\MathType.exe'); $Au3->WinWaitActive('MathType - Untitled 1'); $Au3->Sleep (500); $Au3->Send ('^o'); $Au3->WinWaitActive('Open'); $Au3->Sleep (1000); $Au3->send ("$fpath\\$file1\.eps"); $Au3->Sleep (1500); $Au3->Send ('{ENTER}'); $Au3->WinWaitActive('[CLASS:EQNWINCLASS]'); $Au3->Sleep (1000); $Au3->Send ('^a'); $Au3->Sleep (1000); $Au3->Send ('^c'); $Au3->Sleep (1000); $Au3->run ('notepad.exe'); $Au3->WinWaitActive('Untitled - Notepad'); $Au3->Sleep (500); $Au3->Send ('^o'); $Au3->WinWaitActive('Open'); $Au3->send ("$fpath\\$file1\.txt"); $Au3->Sleep (500); $Au3->Send ('{ENTER}'); $Au3->WinWaitActive("$file1\.txt"); $Au3->Send ('^v'); $Au3->Sleep (1500); $Au3->Send ('!fx'); $Au3->WinWaitActive('Notepad'); $Au3->Send ('!y'); $Au3->ProcessClose('mathtype.exe'); $Au3->Sleep (1000); print "$file1 completed\n"; } After packing this script it works fine in my pc, but when i execute this exe in the computer which doesn't have autoit, it throws the error that, Autoitx3 cannot found, how to overcome this, The objective is i want to execute this script in which autoit is not installed Please suggest, Thanks & Regards Sathish V. Link to comment Share on other sites More sharing options...
water Posted May 22, 2012 Share Posted May 22, 2012 The AutoItX3.dll is needed and has to be registered on the computer where you want to run your skript. Pleas see the AutoItX.chm file in the AutoItX directory. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
sathish Posted May 22, 2012 Author Share Posted May 22, 2012 The AutoItX3.dll is needed and has to be registered on the computer where you want to run your skript.Pleas see the AutoItX.chm file in the AutoItX directory.Thanks for your reply,I tried regestering the autoitX3.dll and it worked,But my problem is I cant able to register this dll on all systems (say 100), because the user running the tool will be having guest rights only in their systems,The script will be in a common server, the user will use this from the server, so is there any possibility to use the AutoitX3.dll from server or any other way to overcome this,Thanks & RegardsSathish V. Link to comment Share on other sites More sharing options...
water Posted May 22, 2012 Share Posted May 22, 2012 Your script doesn't look too complex. So why not translate the whole script to AutoIt? Then you can run the exe from whereever you like. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
sathish Posted May 23, 2012 Author Share Posted May 23, 2012 Your script doesn't look too complex. So why not translate the whole script to AutoIt? Then you can run the exe from whereever you like.Thanks for your reply,I just pasted a sample script in the forum,There a lot more scripts, In my Work place, all scripts should be in perl scripts, so that it will be easier for them to modify or edit the script in future (If i resigned)So i should use the autoit as a module in perl Link to comment Share on other sites More sharing options...
water Posted May 23, 2012 Share Posted May 23, 2012 I think a mixture of perl + AutoIt (COM) is more complex to maintain than a simple AutoIt script. As the code already contains AutoIt the guy/girl who has to maintain the scripts later already has to learn AutoIt. I think taking out complexity from your scripts is what I would like to see as a future maintainer. But as you are talking about a lot of scripts you will have to register the DLL on every PC for now (maybe you can use the login script or something similar). My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now