Tyra Posted December 12, 2007 Posted December 12, 2007 (edited) Trying to produce a system the shows me each step of an automated script and how long it has been running the particular script. But can't figure out why my test script is'nt working. If you run the script over and over it should not produce more than one of each window. Windows_Test.zip Edited December 12, 2007 by Guest
comment Posted December 12, 2007 Posted December 12, 2007 This part makes no sense: Select Window [ Name: (PatternCount ( WindowNames ;"Export")); Current file ] The PatternCount() function returns a number, 1 in your case. If you had a window named "1", it would get selected.
Tyra Posted December 12, 2007 Author Posted December 12, 2007 Yea, I can see that now. More sleep would probably help. Was trying to use that statement to make that window active so that the next statement would re-title the right one. Finding out if a window is open or not seems to be pretty easy, but trying to select that window out of the bunch, when it does not have a set name seems to be a little harder.
David Jondreau Posted December 12, 2007 Posted December 12, 2007 Try... Set Variable[$win; WindowNames(Filename)] Set Variable[$counter ; 1] # Loop # # Select Window [GetValue($win;$counter)] # Exit Loop If[PatternCount(Get(WindowName); "Export")] # Exit Loop If [$counter = ValueCount($win) # Set Variable[$counter; $counter +1] # # End Loop #
Fitch Posted December 12, 2007 Posted December 12, 2007 Nice one, DJ. I'm thinking it might be more efficient to loop through the $win variable and when you find a value that contains "Export," you then select the window (not tested) Set Variable[$win; WindowNames(Get(FileName))] Set Variable[$counter ; 0] # Loop Set Variable[$counter; $counter +1] Set Variable[$name; GetValue($win;$counter)] # Exit Loop If[PatternCount($name; "Export")] Exit Loop If [$counter >= ValueCount($win) # End Loop # If[PatternCount($name; "Export") Select Window [ $name ] End If
David Jondreau Posted December 12, 2007 Posted December 12, 2007 That makes more sense. One more change came to mind...a dialog if no Export window is found. # Set Variable[$win; WindowNames(Get(FileName) )] Set Variable[$counter ; 0] # Loop Set Variable[$counter; $counter +1] Set Variable[$name; GetValue($win;$counter)] # Exit Loop If[PatternCount($name; "Export")] # If[[$counter >= ValueCount($win)] Show Custom Dialog ["No Export window found."] Exit Loop If [1] End If # End Loop # If[PatternCount($name; "Export") Select Window [ $name ] End If #
Tyra Posted December 12, 2007 Author Posted December 12, 2007 Wow..cool. Will play with that DJ. Man, seems like there should be easier way like being able to search for the window name based on a partial name and wild card characters.
comment Posted December 12, 2007 Posted December 12, 2007 You can check if you have a window name that begins with "xyz" by setting a $variable to: Let ( [ pos = Position ( ¶ & WindowNames ; ¶ & "xyz" ; 1 ; 1 ) ; shortList = Right ( WindowNames ; Length ( WindowNames ) - pos + 1 ) ] ; Case ( pos ; GetValue ( shortList ; 1 ) ) ) Then, if the $variable is not empty, you can Select Window [Name: $variable], else open a new one. BTW, as a user I would find it very distracting to see a timestamp appended to the window name. I believe windows names are there for the users' benefit - not for the developer's convenience. If you need this information for some purpose, you should store it somewhere out of the users' sight.
Tyra Posted December 13, 2007 Author Posted December 13, 2007 Thanks Comment, I would agree with you, but this is for insertion into a timed loop script calls other scripts (Mostly exports/import scripts)that is running on the server. No one sees it but me. The windows serve no other purpose other then to mark where in the script it currently is, and how long it has taken to process the particular script. I know, seems like a wierd way of doing it, but was trying to produce something that would require no fields.
Recommended Posts
This topic is 6192 days old. Please don't post here. Open a new topic instead.
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 accountSign in
Already have an account? Sign in here.
Sign In Now