Sign in to follow this  
Followers 0
danisam

Manipulating Executables

9 posts in this topic

#1 ·  Posted (edited)

Hello,

I have a problem :

I have a windows executables (program.exe). When i run this program, i have an GUI were i can put 3 numericals variables and when i push the boton "calculate" a result appears in a textbox (i don´t know the function behind this button and i don´t have the source code of this executable) .

I need to perform this action a thousand times with variables in 3 columns of an excel spreadSheet.

I make a VBA script to perform that automaticly, but is a visual execution and it takes too long time to finish.

There is some way to do that with autoIt. Using only the pointer reference of the objects (textbox, buttons) to make a Autoit script who transform my .exe in a DLL library.

I mean to make an script who take the vars in excell and put them into the GUI textbox of my program but no graphicaly otherwise by reference .... and perform calculation and retrieve the result to put into a excel Cel.

thanks for your help.

Edited by danisam

Share this post


Link to post
Share on other sites



Can you give me an orientation to began my researchs ?

Thanks

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Can you give me an orientation to began my researchs ?

>>> C:\PROGRA~1\AUTOIT3\AU3INFO.EXE &

C:\PROGRA~1\AUTOIT3\AUTOIT3.CHM

Generic sample to Hide Shwow send to hiden controls & retrieve text

from hiden controls

Run("notepad.exe")
run("calc.exe")

sleep(500)
   AutoItSetOption("WinTitleMatchMode", 4)
   WinSetState ( "Calculator", "", @SW_HIDE  )
ControlSend ( "Untitled - Notepad", "","Edit1", "Test sending while minimized"&@LF)
ControlClick ( "Calculator", "","Button9", "right",9)
sleep(2000)

;$a = WinGetText ( "Calculator")

$a = ControlGetText ( "Calculator", "", "Static1")


;MsgBox(262144, "", $a)
;WinSetState ( "Calculator", "", @SW_MINIMIZE  )
WinSetState ( "Untitled - Notepad", "", @SW_MINIMIZE  )

ControlSend ( "Untitled - Notepad", "","Edit1", $a)

sleep(500)
WinSetState ( "Untitled - Notepad", "",@SW_RESTORE  )
WinActivate("Untitled - Notepad")

  sleep(1500)
$a =  ControlCommand ( "Untitled - Notepad", "","Edit1","GetCurrentLine", "")
;MsgBox(262144, "","Current lines  " & $a)
  sleep(1500)
$a1 =  ControlCommand ( "Untitled - Notepad", "","Edit1","GetLine", 1)
;MsgBox(262144, "","line1  " &$a)
$a2 =  ControlCommand ( "Untitled - Notepad", "","Edit1","GetLine", 2)
MsgBox(262144, "","Current lines  " & $a & @CRLF & "line1  " &$a1  & "   line2  " &$a2)
ControlClick ( "Untitled - Notepad", "" , "Edit1","left" )
ControlSend ( "Untitled - Notepad", "","Edit1", "{left 2}")
sleep(1000)
$a =  ControlCommand ( "Untitled - Notepad", "","Edit1","EditPaste","   EditPaste  ")
sleep(1000)
ControlSetText ("Untitled - Notepad", "","Edit1","Disabling Control" )
sleep(1000)
ControlDisable ("Untitled - Notepad", "","Edit1")
sleep(1000)
ControlSetText ("Untitled - Notepad", "","Edit1","EnabingControl" )

ControlEnable ("Untitled - Notepad", "","Edit1")
ControlSetText ("Untitled - Notepad", "","Edit1","HideControl" )
sleep(1000)
ControlHide("Untitled - Notepad", "", "Edit1")
sleep(3000)
ControlShow("Untitled - Notepad", "", "Edit1")
ControlSetText ("Untitled - Notepad", "","Edit1","THE END" )
sleep(2000)
ControlSetText ("Untitled - Notepad", "","Edit1","Ciao" )
sleep(1000)
WinClose("Untitled - Notepad")

WinSetState ( "Calculator", "", @SW_SHOW  )
Edited by Lapo

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thanks,

That helps me a lot.

I have an other question ?

can i convert my autoit Script in a command line program like this.

>autoitexcample.exe var1 var2 var3

>result

Command line in autoit help doesn´t appear to me, the page is missing !!

thanks

Edited by danisam

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Command Line Parameters seems like what you want.

Example:

If $CMDLINE[0] Then
    MsgBox(0, 'This is the 1st switch passed', $CMDLINE[1])
EndIf

:)

Edit:

Cmd Prompt use:

Script.exe "1st Switch"
Edited by MHz

Share this post


Link to post
Share on other sites

Wonderfull, thanks

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

run("model.exe")

Sleep(60)

AutoItSetOption("WinTitleMatchMode", 4)

WinSetState ( "Model", "", @SW_HIDE )

If i run this script without the sleep, my windows model appears, and if i run this script

like this, it works......

how can i do, because i don´t want to view the windows even a miliseconds.

I think the windows is not open when i arrive to my winsetState Statement.

can i perform a run with a winstate ?

thanks

Edited by danisam

Share this post


Link to post
Share on other sites

If i run this script without the sleep, my windows model appears, and if i run this script

like this, it works......

how can i do, because i don´t want to view the windows even a miliseconds.

I think the windows is not open when i arrive to my winsetState Statement.

can i perform a run with a winstate ?

thanks

why not use just one line?

run("model.exe","",@sw_hide)

---"Educate the Mind, Make Savage the Body" -Mao Tse Tung

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Yes sorry,

I only need that.....

a last question ,

I running my script by commad line with parameters, but how can i write the results or retrieve my result in the command line

I think i need to use the Stdinwrite ? but i don´t know how.

i need to retrieve this result like the result of a function.

thanks

Edited by danisam

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