Jump to content

Convert Autoit To VB


Recommended Posts

Hi everyone

I have a list of files in an excel worksheet and i wand to open thoses files. They are in different directories so I wrote this script to find and open the files via the XP's search engine.

Send("{LWIN}")

uparrow(4)

Send("{RIGHT}")

Send("{ENTER}")

WinWaitActive ("Résultats de la recherche")

sleep(2000)

Send("{DOWN}")

Send("{ENTER}")

Sleep(100)

send("{TAB}")

Send("^v")

Send("r*.pdf")

send("{TAB}")

Send("{ENTER}")

tab(4)

send("I:")

Send("{ENTER}")

Sleep(500)

WinWaitactive ("Résultats de la recherche","Oui, cette recherche a été fructueuse")

tab(6)

sleep(50)

send("{DOWN}")

sleep(50)

send( "{UP}" )

Sleep(50)

Send("{ENTER}")

Sleep(50)

WinClose("Résultats de la recherche")

Func uparrow( $number )

For $i = 1 to $number step 1

send( "{UP}" )

Sleep(50)

Next

EndFunc

Func tab( $number )

For $i = 1 to $number step 1

send( "{TAB}" )

Sleep(50)

Next

EndFunc

I would like it to me more automatised inside excel. My problen is that i do not know VB. Can someone help me translating it to VB.

Link to comment
Share on other sites

You might look into the _Excel* functions in the help file. All that Send() stuff is really not required and would be much less reliable.

Also, the Tab() function is not required since Send("{TAB 4}") will send four tabs for example (see help file).

You might be interested to know there is an active French AutoIt site where you might get more help.

:blink:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

You might look into the _Excel* functions in the help file.

[...]

You might be interested to know there is an active French AutoIt site where you might get more help.

I'm actually looking at it but I do not find the equivalence for WinWaitactive and Sleep.

Concerning the french forrum, Thank you for the link. But since the english community is much larger, I prefer to use the English forrum.

Link to comment
Share on other sites

Do you mean in VBA (Visual Basic for Applictions), the scripting language used inside Excel? That is only intended for Excel to operate on itself (or other Office applications), so I doubt there are any functions intended to manipulate or monitor external windows, like WinWaitActive().

AutoIt gets its ability to do things like that from the C++ code compiled into the AutoIt Interpreter Binary. If you learn enough VBA to call external ActiveX, you might call AutoItX for that, but the fact that you are bouncing around the cells with tabs and Send() tells me you haven't learned much yet.

:blink:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...