Jump to content

Check Active Window?


Recommended Posts

I know how to check if a window's active at a time, but I don't know how to check if a window's active while the program's in progress.

Is there a way to do it? Here's my script:

;Get File Count and Folder Name
    $FolderName=FileSelectFolder ("Choose the folder","",0)
  if $FolderName = 1 then
     exit
  endif
    Run("explorer " & $FolderName)
    sleep (1000)
    $title=wingettitle ("")
    winactivate ($title)
    sleep (1000)
    $NumberofFiles=-2
    $search = FileFindFirstFile($FolderName & "\*.*")
    While 1
     $file = FileFindNextFile($search)
     If @error = 1 Then ExitLoop
     $NumberofFiles=$NumberofFiles + 1
    WEnd
    FileClose($search)
    
;Start adding the number's
    $i=2
    send ("!vd{Space}{F2}{Home}01-{Enter}")
    if $NumberofFiles = 1 then
  sleep (1000)
  send ("!vn")
  msgbox (0, "Finished", "Finished")
  exit
    endif
    
    do  
  send ("{Down}{Space}{F2}{Home}")
  
  if $i <= 9 then
     send ("0" & $i & "-{enter}")
  endif
  if $i >=10 then
     send ($i, 1)
     send ("-{Enter}")
  endif
  
  $i=$i+1
    until $i = $NumberofFiles + 1
    
    sleep (1000)
    send ("{!vn}")
    msgbox (0, "Finished", "Finished")
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...