Jump to content

Script worked once, but never before or since...no idea why


Recommended Posts

Hi

This script randomly worked once, but I have never been able to get it to work again...
I can't see what the possible problem is. The path is most certainly correct.
Any help would be greatly appreciated. Otherwise I have to install 100+ files individually.

------------------------------------------

#include <File.au3>
#include <Array.au3>
 
AutoItSetOption ("WinTitleMatchMode", 1)
AutoItSetOption ("WinTextMatchMode", 2)
AutoItSetOption ("TrayIconDebug", 1)
 
$folder = "F:MUSIC SOFTWAREBIABTRACKSREALTRACKS"
 
Local $files = _FileListToArray($folder, "*")
 
For $i = 1 to UBound($files)
   install($files[$i])
Next
 
Func install($file)
   $pid = Run($file)
   WinWait("Setup - RealTracks", "Welcome to the RealTracks")
   Send("!n")
   WinWait("Setup - RealTracks", "Please read")
   Send("!a")
   Send("!n")
   WinWait("Setup - RealTracks", "When you are ready")
   Send("!n")
   WinWait("Setup - RealTracks", "Where should")
   Send("!n")
   WinWait("Setup - RealTracks", "Setup is now ready")
   Send("!i")
   WinWait("Setup - RealTracks", "Completing")
   Send("!f")
   ProcessWaitClose($pid)
EndFunc
 
------------------------
Link to comment
Share on other sites

Hello, welcome to the forum.

It will probably only work correctly if the program you are starting has focus the whole time the script is running. This is because you are using Send instead of ControlSend. Refer to the Help file about these two functions, the AU3 Window Info Tool, and other Control functions that you may be able to use. As long as you are reading these particular segments, you might as well read the whole thing two or a hundred times, and become more familiar with the AutoIt language.

Also, when you post code, it is best to enclose it in autoit code tags. That is the little blue button with the A in it, or just use [ autoit ] at the top of your code, and [ /autoit ] at the end. I added the spaces and bold to make this text more visible to you. Neither spaces or boldness is needed in use, I just used them to make it more visible to you.

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

How do you know it's 'hanging' on the first WinWait, and not the Send after it? Use the MsgBox or ConsoleWrite functions thru out your code to display 'where it's at'. Like this:

WinWait("Setup - RealTracks", "Welcome to the RealTracks")
MsgBox(0, '', 'first Winwait done..')
Send("!n")
MsgBox(0, '', 'first Send done..')

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

It doesn't Run the first file...
I checked with
 

$msg = ''
 
For $i = 1 to UBound($files) -1
   $msg &= String($files[$i])
   $msg &= '    '
Next

MsgBox(0, '', $msg)

And all the files are correct...so why does it not start the Run?

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