Jump to content

FOR loop counter seems to go down too fast


JonM
 Share

Recommended Posts

My script:

For $i = 90 to 1 Step -1

WinWaitActive("JPEG Option")

SEND("8{ENTER}")

Next

Needs a counter at least twice as big as the number of times I want it to run. In above example this script only runs on 43 files and not all 90.

If it is meaningful this script is when I am running a photoshop automate action.

Tried a few searches of forum but probably using wrong keywords as didn't find anything.

Any help appreciated.

Link to comment
Share on other sites

My script:

For $i = 90 to 1 Step -1

WinWaitActive("JPEG Option")

SEND("8{ENTER}")

Next

Needs a counter at least twice as big as the number of times I want it to run. In above example this script only runs on 43 files and not all 90.

If it is meaningful this script is when I am running a photoshop automate action.

Tried a few searches of forum but probably using wrong keywords as didn't find anything.

Any help appreciated.

Is that your whole script? I'm thinking its the program that is having a problem.
Link to comment
Share on other sites

I would guess that perhaps the window does not disappear or become inactive fast enough after the Send, so what's happening is it loops twice before the window disappears.

Try adding something to check if the window has closed, or changed somehow before continuing the loop. Maybe something like

For $i = 90 to 1 Step -1
  WinWaitActive("JPEG Option") 
  SEND("8{ENTER}")
  WinWaitClose("JPEG Option")
Next
Link to comment
Share on other sites

I would guess that perhaps the window does not disappear or become inactive fast enough after the Send, so what's happening is it loops twice before the window disappears.

Try adding something to check if the window has closed, or changed somehow before continuing the loop. Maybe something like

For $i = 90 to 1 Step -1
  WinWaitActive("JPEG Option") 
  SEND("8{ENTER}")
  WinWaitClose("JPEG Option")
Next
Many thanks, the WinWaitClose has solved my problem. I had assumed the WinWaitActive needed a new instance.
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...