Jump to content
Sign in to follow this  
evol

[Solved] Using PHP functions inside AutoIt

Recommended Posts

Skitty

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
evol

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
hannes08

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
evol

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  

  • Similar Content

    • simonc8
      By simonc8
      I have a script which executes sleep for a couple of hours then carries out instructions. Does the running AutoIt script prevent the computer from entering sleep mode during this time? If not, is there something I can add to the AutoIt script to keep the computer awake?
      Grateful for advice.
    • gahhon
      By gahhon
      Hi,
      I have a program that is read data from the .txt file, since the .txt file is only readable, viewable and editable for the admin user.
      But how could I lock it with password, or some other technique that can helps to achieve this?
      Thanks for the advanced information.
    • gahhon
      By gahhon
      Hi,
      How can I the trigger the another button functions without waiting the previous function to finish execute?
      Any advise?
      I couldn't find any relevant topics via google.
      Thanks a lot.
    • SharpDressedMan
      By SharpDressedMan
      Hi all,
      I need to use ControlMove() on some controls of a hidden GUI window.
      This works properly on a GUI window created with default style, but does not work on a GUI window created with style $WS_OVERLAPPEDWINDOW
      func GUItest($bOverlapped) $m = GUICreate("test", 200, 100, -1, -1, $bOverlapped ? $WS_OVERLAPPEDWINDOW : -1) $g = GUICtrlCreateButton("test", 0, 0) ControlMove($m, "", $g, 30, 30) GUISetState() endfunc GuiTest(false) ; button 'test' properly moved to (30,30) GuiTest(true) ; button 'test' not moved and still sitting at (0,0) Any reason for this unexpected behavior ?
      Any workaround to fix this ?
      Thanks for any help
    • 2Toes
      By 2Toes
      Hi all..
      I'm having slight issue that has be a bit puzzled.
      I have an Input control.. After a certain function runs, it Disables that Input control, and sets it to ReadOnly.
      When running another certain function, it re-Enables that Input control, and sets the style back to Default.
      Which does work, however, when typing into the Input control after re-Enabling it, the text appears as a light gray color, rather than its original black color.
      I'm sure there's a simple solution here.. But what that is, appears to be beyond me.
      Here is a simplified example code:
      #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("Form1", 245, 215, 192, 124) Global $disableBTN = GUICtrlCreateButton("Disable", 32, 64, 75, 25) Global $enableBTN = GUICtrlCreateButton("Enable", 128, 64, 75, 25) Global $Input1 = GUICtrlCreateInput("", 32, 120, 169, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $disableBTN disable() Case $enableBTN enable() EndSwitch WEnd Func disable() GUICtrlSetState($Input1, $GUI_DISABLE) GUICtrlSetStyle($Input1, $ES_READONLY) EndFunc Func enable() GUICtrlSetState($Input1, $GUI_ENABLE) GUICtrlSetStyle($Input1, $GUI_SS_DEFAULT_INPUT) EndFunc  
      Any help would be greatly appreciated
      Thank you in advance!
×