MSF Posted March 16, 2009 Share Posted March 16, 2009 I'm not experienced with AutoIT v3 or scripting in general for that matter. I know a little C but that's about it. I need to pass a pseudo random alpha-numeric string (representing customer info) as an argument to the built in Send() function. How do I use the built in Random() function to do this? Alternatively, would it be possible to call a C function from within AutoIt v3? Thanks in advance! CODE $STRINGLENGTH=10 run("putty.exe") WinWaitActive("PuTTY Configuration") Send("linuxtest") Send("{TAB 8}") Send("{ENTER}") WinWaitActive("linuxtest.company.com - PuTTY") Sleep(2000) Send("UserName") Send("{ENTER}") Sleep(2000) Send("paswd") Sleep(2000) Send("{ENTER}") Sleep(2000) Send(3) ; menu option Sleep(1000) Send("{ENTER}") Send(2) ; menu option Send("{ENTER}") Send("a") ; menu option Send("{ENTER}") Send("{ENTER}") Send("Y") ; menu option Send("{ENTER}") Send("Random Customer Name") ; need to pass name + random number Send("{ENTER}") Send("Random Customer Number") ; need to pass random customer number Send("{ENTER}") Link to comment Share on other sites More sharing options...
Authenticity Posted March 16, 2009 Share Posted March 16, 2009 Calling AU3 functions from C code is possible, just link to the AutoItX.dll (.lib) and use the include AutoItX.h to see functions declaration. Apart from it, you need to randomly define the string length as you might want to do so with the characters. You can for example use Random(0x41, 0x61, 1) and repeat it random times and concatenating each character. By the way, random numbers can get concatenated as well in this case: $sStr &= Random(0, 9, 1) will be converted to it's counterpart string representation. 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