3

Like this question: Automate GUI tasks?

I'm asking for a way to automate GUI tasks. I understand that those 2 apps are what's used for that sort of stuff, but those 2 apps are hard to use.

OK, here's my script attempt using autoscript writer II:

I first open up the app, then open a file using the app. I believe this part is opening the file and then double clicking on it:

Clicking the open button

MouseClick, left,  63,  100
Sleep, 100
WinWait, Open, 
IfWinNotActive, Open, , WinActivate, Open, 
WinWaitActive, Open, 

Double clicking to select file:

MouseClick, left,  144,  111
MouseClick, left,  144,  111

I need for the above portion of the script to select the next file for each iteration.

Then it does stuff in the app:

WinWait, App Unicode, 
IfWinNotActive, App Unicode, , WinActivate, App Unicode, 
WinWaitActive, App Unicode, 
MouseClick, left,  304,  459
Sleep, 100
MouseClick, left,  405,  467
Sleep, 100
MouseClick, left,  219,  133
Sleep, 100

And then saves it:

WinWait, Save As, 
IfWinNotActive, Save As, , WinActivate, Save As, 
WinWaitActive, Save As, 
MouseClick, left,  527,  366
Sleep, 100

The app open window goes directly to a folder with all my files in it. I just need to open up each file in turn with autohotkey.

Thanks!

Ben
  • 247

3 Answers3

2

Without knowing exactly what you're doing, I can't write any sort of script for it, but assuming it's an explorer window, you could use a loop:

Loop %RepeatCount% {
    ...
}

and use some maths to work out when to go down a row, so on.

Better than that, though, see the "Loop (files & folders)" section of the readme. Looks like you'd make the .ahk inside the directory, then do something like

Loop *.fileWhatIsBoringToManipulate
{
Run p:\ath\to\executable [command line option to load file]
WinWaitActive, Manipulator
//mouseclicks and stuff
}

The latter would be vastly superior, but if your application doesn't support command line input, then you'd be better off putting the files in list view and using a send {down}{return} instead of fancy positional mousing.

Phoshi
  • 23,483
1

If the problem you are having is trying to select the next file, perhaps it would be simpler to always select the first file in the list, operate on it, then move it to a different folder. Then the first file in the folder would be what was the second file previously.

eleven81
  • 16,182
1

Just a thought but after opening the dialog, use some math to figure out how many times to hit the down key or something to select the next file (instead of using mouse clicks). This way at least the scrolling will be sorted out automatically. Except for that and the obvious command line argument option, I'm with eleven81 on actually moving the file after being done with it so the next file is at the same place as the first one...