Sign in to follow this  
Followers 0
danielrdwyer

Script won't run from Startup in Windows 7 32bit

6 posts in this topic

Hi,

New to AutoIt and couldn't possibly have a more simple script.

Run("C:\Program Files\FSA4\FSA4.exe")

WinWaitActive("Untitled - FSA")

Send("{F2}")

If I run the script from the desktop it works fine. If I place it in the Startup folder and re-boot the program launches but the F2 isn't executed. Even pressing F2 on the keyboard doesn't work. Seems that something is getting hung-up with the key functions. I can click the button that the F2 actuates with the mouse but it takes two toggles of the function. It therefore doesn't appear that the application is hung.

I tried adding some Sleep times ahead of all the lines in the script but with no improvement. Again, if I run the same script from the desktop it works every time. Any ideas? Thank you for your time.

Share this post


Link to post
Share on other sites



Hi, danieldwyer, welcome to the forum. What happens if you try a WinWait on the Window, and then call WinActivate, just as a check that it is seeing the window?

Run("C:Program FilesFSA4FSA4.exe")
WinWait("Untitled - FSA")
WinActivate("Untitled - FSA")
Send("{F2}")

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Hi JLogan3o13,

Thank you for the reply. I tried your script with the WinActivate and it too works from the desktop but not from the Startup folder. I also just tried a script with just the Run line. When run from the desktop I can toggle the function in the application with the F2 key. When run from boot-up the F2 key doesn't work. Seems the problem is right from the beginning.

Share this post


Link to post
Share on other sites

Did some more playing and the problem seems to be the window for the FSA program isn't active when the script is run from the Startup folder. I tried using the WinActivate posted above both before and after WinWait. I tried the script with XP SP3 and another Win7 32bit machine and they both work fine regardless of whether run from the desktop or Startup folder. Just doesn't want to work on the machine it needs to...story of my life. I'm perplexed.

Thanks.

Share this post


Link to post
Share on other sites

Found a solution. Added a long Sleep(30000) at the top of the script to give time for the computer to finish booting. Perhaps some hardware or software interaction unique to this machine. Thanks.

Share this post


Link to post
Share on other sites

Just a thought, but you might look in the examples forum for the Windows Service UDF, and turn your application into a service. That allows you to tell it not to run until other services are loaded, and gives you options should the service fail to start correctly.


√-1 2^3 ∑ π, and it was delicious!

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