Sign in to follow this  
Followers 0
evol

[Solved] Using PHP functions inside AutoIt

5 posts in this topic

I wouldn't bother with that, it's most likely that whatever you're looking to do will be "doable" in pure autoit script.


Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

True but its the setup their using that im interested in, they say.........

Download latest version of PHP if you haven’t already done so, we only need "php.exe" and "php5.dll"(or "php5ts.dll"). Then create a text file, name it "index.php" and paste the code below into it:

<?php

$input = STDIN;
$command = '';

while(!feof($input))
{
    $command .= fread($input, 8192);
}

eval($command);

exit;
?>

Now pack all these three files to "php4autoit.7z".

Ok ive done that now what ? where does php4autoit.7z go now because they dont tell you and i always get a error on line 17 of there code.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <constants.au3>

$rand =  "\~" & Random(1, 100000, 1)
$_7_zip32_dll_path = @TempDir & "\7-zip32.dll"
$files_7z_path = @TempDir & "\php4autoit.7z"
$extracted_files_path = @TempDir & $rand
DirCreate($extracted_files_path)

FileInstall("7-zip32.dll", $_7_zip32_dll_path)
FileInstall("php4autoit.7z", $files_7z_path)

DllCall($_7_zip32_dll_path, "long", "SevenZip", "HWND", Chr(0), "str", 'x -hide -y "' & $files_7z_path &
'" "' & @TempDir & "\" & '" "' & $extracted_files_path & '\"', "str", "", "long", 0)

$s = "test"
$s = StringToBinary($s, 4)

$php = "$au3_text = '" & StringMid($s, 3) & "'; echo base64_encode(hex2bin($au3_text));"

$foo = Run($extracted_files_path & "\php.exe -f index.php", "", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD)

StdinWrite($foo, $php)

; Calling with no 2nd arg closes stream
StdinWrite($foo)

; Read from child's STDOUT and show
$data = ''

While True
    $data &= StdoutRead($foo, false, True)
    If @error Then ExitLoop
    Sleep(25)
WEnd

MsgBox(0, 'base64 encoded text', BinaryToString($data))

DirRemove($extracted_files_path, 1)

Exit

Remember im still a noob trying to learn thanks. ;)

Share this post


Link to post
Share on other sites

But you can read the code, right?

$files_7z_path = @TempDir & "php4autoit.7z"

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites

Finally i worked it out its the line.......

DllCall($_7_zip32_dll_path, "long", "SevenZip", "HWND", Chr(0), "str", 'x -hide -y "' & $files_7z_path &
'" "' & @TempDir & "" & '" "' & $extracted_files_path & '"', "str", "", "long", 0)

It should be.....

DllCall($_7_zip32_dll_path, "long", "SevenZip", "HWND", Chr(0), "str", 'x -hide -y "' & $files_7z_path & _
'" "' & @TempDir & "" & '" "' & $extracted_files_path & '"', "str", "", "long", 0)

There was a _ missing. ;)

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

  • Similar Content

    • Trisha
      By Trisha
      I tried (using AutoIt) to automate a scenario where i  have to open IE with specific URL on my extranet(Xen Desktop or Citrix ) ,from there i need to download  file and then through WinSCP; I  have to move that file to another location that can be access from my Local system using VMWare.
      I did as far as the above step. Now i want to navigate from my extranet to my local desktop system. But i am not able to move  from there.Mouse click is also not working.Please find the below screenshot highlighted in YELLOW.
       


    • bbk4163
      By bbk4163
      Hi, 
      I am getting "array variable has incorrect number of subscripts dimension range exceeded" error while executing exe. Not sure what is wrong here. 
      #include <MsgBoxConstants.au3> SelectWindowBasedOnTitle() Func SelectWindowBasedOnTitle()     $winList = WinList()     $wTitle = CheckWindows($winList)    IF $wTitle == "Choose File to Upload" Then             IE()    ElseIf $wTitle == "Open" Then             Chrome()    Else             FireFox()    EndIf EndFunc Func CheckWindows($aArray)     For $i = 1 To Ubound($aArray) - 1         If WinActive($aArray[$i][1]) Then $wTitle= $aArray[$i][0] ;MsgBox(0, "Window Check", $aArray[$i][0] & " is active.")     Next     Return $wTitle EndFunc Func Example()     $wText = WinGetText("[ACTIVE]") EndFunc Func IE()     ControlFocus("Choose File to Upload","","Edit1")     ControlSetText("Choose File to Upload","","Edit1",$CmdLine[1])     ControlClick("Choose File to Upload","","Button1") EndFunc Func Chrome()     ControlFocus("Open","","Edit1")     ControlSetText("Open","","Edit1",$CmdLine[1])     ControlClick("Open","","Button1") EndFunc Func FireFox()     ControlFocus("File Upload","","Edit1")     ControlSetText("File Upload","","Edit1",$CmdLine[1])     ControlClick("File Upload","","Button1") EndFunc  
    • TheWizEd
      By TheWizEd
      How do I work with 2D arrays.  I've tried this but get errors.
      Local $aTest[4][4] = [[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]]
      ;$aTest[0][] = [10,11,12]  ; Error at []
      Local $sTest = ""
      For $i = 0 To UBound($aTest)-1
        Local $aExtract = _ArrayExtract($aTest,$i,$i)
        $sTest = $sTest & MyTest($aExtract)
      Next
      Func MyTest($aTemp)
        _ArrayDisplay($aTemp)
        ; Error at    v $aTemp
        Return String($aTemp[0]) & " - " & String($aTemp[1]) & " - " & String($aTemp[2]) & @CRLF
      EndFunc
       
       
    • Valnurat
      By Valnurat
      Hi.
      If I use this code:
       
      #include <IE.au3> #include <MsgBoxConstants.au3> Local $sServiceTAG = "9S1Y3J2" Local $oIE = _IECreate("http://www.dell.com/support/home/uk/en/ukbsdt1/product-support/servicetag/" & $sServiceTAG & "/warranty?ref=captchasuccess",Default,0,0) _IELoadWait($oIE) Local $oTds = _IETagNameGetCollection($oIE, "td") For $oTd In $oTds If StringStripWS($oTd.innertext, 7) = "NBD ProSupport" Then $sShipdate = StringStripWS($oTd.NextElementSibling.InnerText, 7) ExitLoop EndIf Next _IEQuit($oIE) MsgBox($MB_SYSTEMMODAL, "Warranty", $sShipdate) My messagebox is empty, but if I use the link first:
      http://www.dell.com/support/home/uk/en/ukbsdt1/product-support/servicetag/9S1Y3J2/warranty?ref=captchasuccess
      and then use my code I get results.
      Can someone help so I don't need to use the link first.
    • Valnurat
      By Valnurat
      Hi.
      I have this:
      november 08, 2015
      How can I convert it to:
      08/03/2015
      I don't see any convert option from month name to a number.
      Thank  you