Jump to content

WinActivate


 Share

Recommended Posts

Hi

new to AutoIt ,

using WinActivate on a program called Pdf merge,

it does not appear to focus on that window ?

thanks in advance for help

Are you sure you got the title right in the script?

maybe post the section so we can see where it goes wrong?

Link to comment
Share on other sites

Hello omegadave,

First, Welcome to the AutoIt Forums :graduated:

dave, it's really difficult to help you if you don't show what code you have written. There could be a multitude of problems that is causing your script to not do what you expect. A general rule of thumb when asking for help in the forums, is to explain what errors or problems you are having, what results you expect from your script, and ultimately show your script, or at the least an example of it.

I don't believe in crystal balls, or I'd guess your problem is on line 1,362,412.

Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

sorry guys,

here is code so far (early days for me )

;select PDF Merge window
WinActivate("PdfMerge", "")

;select Add files
ControlClick("PdfMerge", "", "[NAME:buttonPickFile]")

;click pull down menu
ControlClick("PdfMerge", "", "[CLASS:ComboBox]")

attached pic of program.

dsicovered the use of AutoIt Window Info

need help now to select the pull down menu, select a folder from desktop, select all files in that folder ?

thanks for help in advance

post-61453-0-96839800-1290676276_thumb.j

Link to comment
Share on other sites

omegadave,

Try

ControlCommand('Title','','ClassnameNN','SelectString', 'string')

Just Change 'Title' to the Window Title, 'ClassnameNN' to the control ID, and 'string' to the item you wish to select.

Realm

Edit: Sorry I just realized your trying to automate a File Dialog. If your going to select everything in the chosen folder you might be better off using FileList() to get all the files into an array, then converting into a single string to input to the edit for files. I have not personally attempted to drop multiple files into the edit but in most cases it can be done. I do believe you will have to seperate each file with a string break '|', before dropping into the the edit control.

Edited by Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

;select PDF Merge window
WinActivate("PdfMerge", "")



;select Add files
ControlClick("PdfMerge", "", "[NAME:buttonPickFile]")

Sleep(1200)

;click pull down menu
ControlClick("Add PDF Files", "Look &in", "[Class:ComboBox]")


Sleep(3000)

;select PDF Merge folder
ControlCommand("Add PDF Files", "Look &in", "[Class:ComboBox]", "SelectString", "PDF Merge") 

Sleep(1000)

ControlClick("Add PDF Files", "Look &in", "[Class:ComboBox]")

Sleep(1000)

;select Listview window
ControlClick("Add PDF Files", "Look &in", "[Class:SysListView32]")

Sleep(2000)


;select Files
Send("^a")

Sleep(1000)

;select open button
ControlClick("Add PDF Files", "&Open", "Button2")


Sleep(5000)

;select merger button
ControlClick("PdfMerge", "Merge / Split", "WindowsForms10.BUTTON.app.0.378734a7")

above code now activates PDF Merger window. Opens the Add Files window, selects the PDF Merge folder on my desktop, selects pdf files. Then finally, clicks on Merge buttton.

thanks for help

Link to comment
Share on other sites

@Rofellos,

Here is a little function I like to use:

_WinWaitActivate($title,$text="",$timeout=0) ; checks if window is active, if not will activate it.

$window_Handle = _WinWaitActivate($title,$text="",$timeout=0) ;This will also return the window handle for later calls or uses.

Func _WinWaitActivate($title,$text="",$timeout=0)
    WinWait($title,$text,$timeout)
    If Not WinActive($title,$text) Then WinActivate($title,$text)
    WinWaitActive($title,$text,$timeout)
    Return WinGetHandle($title,$text)
EndFunc

Just my two cents :graduated:

Realm

Edit: Fixed some cut n paste typos

Edited by Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

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