nick2price Posted September 24, 2015 Share Posted September 24, 2015 (edited) Hi, this is my first time using autoit so not too sure what it can do. I have searched around but I am unable to find a solution. I have a simple php script which should execute my autoit file<?php $output = shell_exec('autoit test2.au3'); echo "<pre>$output</pre>";The file this should execute contains the followingGlobal $Process = ('Firefox.exe') While 1 If ProcessExists ($Process) Then Return "EXIST" Else Return "DOESNT EXIST" ExitLoop EndIfWhen I visit test.php in the browser I was hoping it would execute my autoit file and then display either EXIST or DOESNT EXIST on the screen. At the moment, nothing happens, just a blank screen.Is there any way to execute my autoit script via php, and have this script return something for my php to display?Many thanksNick Edited September 24, 2015 by nick2price Link to comment Share on other sites More sharing options...
guinness Posted September 24, 2015 Share Posted September 24, 2015 Why do you need AutoIt for this? UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
nick2price Posted September 24, 2015 Author Share Posted September 24, 2015 I dont specifically need autoit for this part, but further down the line I need to execute commands in a program like Ctrl + P which I think I need autoit for. Link to comment Share on other sites More sharing options...
TheDcoder Posted September 24, 2015 Share Posted September 24, 2015 (edited) Try this:<?php $output = exec('C:\Program Files (x86)\AutoIt3\AutoIt3.exe test2.au3'); echo "<pre>$output</pre>"; TD Edited September 24, 2015 by TheDcoder Wrong syntax highlighting nick2price 1 EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
nick2price Posted September 24, 2015 Author Share Posted September 24, 2015 I actually got it working by compiling the script to an exe. I imagine you normally convert scripts to exe when they are complete? Link to comment Share on other sites More sharing options...
TheDcoder Posted September 24, 2015 Share Posted September 24, 2015 @nick2price Yep, That's what you do EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
nick2price Posted September 24, 2015 Author Share Posted September 24, 2015 Thanks One last thing I just wanted to clarify. So I have this partIf ProcessExists ($Process) Then ConsoleWrite ("1")I dont intend for the ConsoleWrite to be there, I have it for testing purposes. Instead, if the process exists, I need to make sure it is the active window so I can perform things like CTRL + C within this application. I see from the docs this functionWinActivate($hWnd)So is it simply a case of doing something like this?If ProcessExists ($Process) Then ConsoleWrite ("1") WinActivate($Process) Send("^v") Link to comment Share on other sites More sharing options...
TheDcoder Posted September 24, 2015 Share Posted September 24, 2015 (edited) @nick2price UseSend('^c')^v means Ctrl + V not Ctrl+ C (as you would see in command prompt) TD Edit: WinActivate won't work, You need the title/hWnd/class of the window to activate the windows, Read the documentation for more info Edited September 24, 2015 by TheDcoder nick2price 1 EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
nick2price Posted September 24, 2015 Author Share Posted September 24, 2015 Thanks, looking at the docs now. I understand how I can get the title and hWnd of a window. What would the CLASS be? Link to comment Share on other sites More sharing options...
TheDcoder Posted September 24, 2015 Share Posted September 24, 2015 (edited) @nick2price You can use the AU3Info tool (Tools -> AU3Info in Full Installation of SciTE) to know the class of the window P.S You only need one of these: title/hWnd/class, Not all of them Edited September 24, 2015 by TheDcoder nick2price 1 EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion 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