Sign in to follow this  
Followers 0
areola

Check Active Window?

2 posts in this topic

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

Share this post


Link to post
Share on other sites



Look at WinActive in the doc. :D

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