Jump to content

Simultaneous Functions?


Lanturn
 Share

Recommended Posts

Hey all,

Was wondering if anyone could help or provide an alternative solution...

Say I want a script that would show the current time in a couple of timezones and when a certain time is met, open a webpage, say http://www.autoitscript.com/forum/index.php and peform the login procedure.

Perhaps,

Func Login()
RunWait(@COMSPEC & " /c Start http://www.autoitscript.com/forum/index.php")
WinWaitActive("AutoIt Forums - Microsoft Internet Explorer", "http://www.autoitscript.com/forum/index.php")
Send("{TAB 12}");Gets to the username field
Send("username")
Send("{TAB}");Gets to the password field
Send("password")
Send("{TAB}");Gets to the Go button
Send("{ENTER}")
EndFunc

Because the login function would take a while to execute, pausing the GUI, the time would cease to update every second...

Anyone has any idea on how to workaround this?

Thanks

Matt

Link to comment
Share on other sites

AdlibEnable("timezone")

<insert the guts of your program here>

Func Login()
   RunWait(@ComSpec & " /c Start http://www.autoitscript.com/forum/index.php")
   WinWaitActive("AutoIt Forums - Microsoft Internet Explorer", "http://www.autoitscript.com/forum/index.php")
   Send("{TAB 12}");Gets to the username field
   Send("username")
   Send("{TAB}");Gets to the password field
   Send("password")
   Send("{TAB}");Gets to the Go button
   Send("{ENTER}")
EndFunc ;==>Login

Func timezone()
    BlahBlahBlahBlah("blah","blah",9,3,23,2)
EndFunc

Edited by Alterego
Link to comment
Share on other sites

AdlibEnable("timezone")

<insert the guts of your program here>

Func Login()
   RunWait(@ComSpec & " /c Start http://www.autoitscript.com/forum/index.php")
   WinWaitActive("AutoIt Forums - Microsoft Internet Explorer", "http://www.autoitscript.com/forum/index.php")
   Send("{TAB 12}");Gets to the username field
   Send("username")
   Send("{TAB}");Gets to the password field
   Send("password")
   Send("{TAB}");Gets to the Go button
   Send("{ENTER}")
EndFunc;==>Login

Func timezone()
    BlahBlahBlahBlah("blah","blah",9,3,23,2)
EndFunc

<{POST_SNAPBACK}>

I don't quite get you...

How can I execute both Login() and timezone() at the same time... i.e. When login() is running, update the time on the GUI...

Edit: Opps sorry.. missed the AdlibEnable function =/

One more thing... during the execution of Login(), you cannot close the program by clicking the close button at the top right of the GUI...

Edited by Lanturn
Link to comment
Share on other sites

Lanturn,

I asked a similar question a while back. Here's the response I got from Jon.

The link will take you to the thread. But's here's Jon's comment on my question:

It doesn't happen at the same time. Its just a loop that is done so quickly it seems to be at the same time. Do you have a Multi CPU machine? Probably not, so how come your email is downloading in the background as your read this? All the tasks get split into small slices that each take turns to receive processing time.

Hope this helps,

Ian

"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Link to comment
Share on other sites

One of the AutoIt members offers a script which permits concurrent processes. I have not used it:

http://www.autoitscript.com/fileman/users/public/Guidosoft/

J

If I am too verbose, just say so. You don't need to run on and on.

Link to comment
Share on other sites

concurrent processes isn't going to offer a performance boost over multiple functions with AdlibEnable. they are fighting for the same cycles...you could run them both at belownormal processor priority but running two things at 50% is just the same as running each thing at 100% for half the time...

Edited by Alterego
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...