Jump to content

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


Recommended Posts

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.

Link to comment
Share on other sites

  • Moderators

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}")

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
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.

Link to comment
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.

Link to comment
Share on other sites

  • Moderators

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.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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...