Sign in to follow this  
Followers 0
Guest bhurtel

folder open close script doesn't worked

8 posts in this topic

For $i = 1 To 2

Run('explorer ' & @WindowsDir & '\Fonts')

Sleep(20000)

WinClose('Fonts')

Next

this is my script to open font folder for abt 20 sec and after then close the windows....

but the script can only open the folder but can close the folder

instead it restores my current displayed font windows.

i.e (it restores my maximized font folder and make it half (just as we click restore button)

Share this post


Link to post
Share on other sites



The title is case sensitive. My window opened with uppercase "FONTS". Try WinClose('FONTS'). Works for me.

Share this post


Link to post
Share on other sites

Or take a look at option WinTitleMatchMode.

in this case just use for instance:

Opt('WinTitleMatchMode', 2)
For $i = 1 To 2
Run('explorer ' & @WindowsDir & '\Fonts')
Sleep(20000)
WinClose('Fonts')
Next

So long...

Share this post


Link to post
Share on other sites

Holger: Actually that still fails for me. It demands the WinClose to have uppercase "FONTS".

Share this post


Link to post
Share on other sites

Holger: Actually that still fails for me. It demands the WinClose to have uppercase "FONTS".

<{POST_SNAPBACK}>

I didn't have the same problem when running mine. However, you could also just do this:

Opt ("WinTitleMatchMode", 2)

For $i = 1 To 2
   Run ("explorer.exe " & @WindowsDir & "\Fonts")
   Sleep(2000)
   WinClose (@WindowsDir)
Next

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Heh, that wouldn't work for me AT ALL, since the ONLY thing in the title bar of the explorer window that opens for me is "FONTS".

*Edit: Although it's odd... if I use explorer to open the folder (like in the script example) the title of the window is all uppercasts (FONTS) if I open the folder from the Run dialog by just typing the path, the title is all lowercase (fonts).

ex:

Start > Run: "c:\windows\fonts\" > Window with "fonts" for title.

Start > Run: "explorer c:\windows\fonts" > Window with "FONTS" for title.

Edited by Saunders

Share this post


Link to post
Share on other sites

Welcome to the forums!

Does your code work correctly if you remove or temporarily disable the For..Next loop? --

Run('explorer ' & @WindowsDir & '\Fonts')
Sleep(20000)
WinClose('Fonts')

Share this post


Link to post
Share on other sites

I certainly do recognize that code :whistle: . I think Holger may have the solution.

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