Jump to content
Sign in to follow this  
gcue

preventing duplicate child windows

Recommended Posts

gcue

im trying to prevent duplicate child windows...

(unfortunately they do not have unique titles)

i know theres prob different ways to do this - the way i know how to would involve flags (lame i know)

a better way would involve the use of if winexists,@gui_winhandle, & wingethandle but im not sure what that would look like (bc the winhandle for every child changes everytime u open the script)

also, how will i get the win handle of the child before i create it? (to compare it with pre-existing ones)

hope im making sense.

Edited by gcue

Share this post


Link to post
Share on other sites
flyingboz

hope im making sense.

sadly, not.

Provide a [small] code snippet demonstrating your issue. You may wish to examine your running processes w/ pslist or procexp (sysinternals utilities) -- or do you mean child windows instead of processes....


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites
gcue

child windows.

i htink im gonna just go the route of naming every single one of them uniquely ;-)

*sigh*

thanks tho

Share this post


Link to post
Share on other sites
gcue

i have a script that has several child windows..

i am trying to prevent duplicate child windows from being created..

currently this is how i am doing this:

If WinExists("PC Migrator") Then
        MsgBox(262144, @ScriptName, "Already running PC Migrator.")
        Return
    EndIf

Is there a better way to do this? i dont like this way because if there's a document that has the same heading it prevents me from running the function that opens that child window.

Share this post


Link to post
Share on other sites
Melba23

gcue,

How do you create these child windows within your script? If it is by user interaction with a GUI, then you could disable the control that creates the child while the child is active - that would prevent duplicates. :mellow:

Without some code it is difficult to offer much more.....

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
martin

Or maybe, but guessing what you need, you could do something like

If WinExists("SomeTitle" then
 WinActivate"SomeTitle")
Else
 ;create it
EndIf

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
gcue

heeey martin!!!

i like your idea martin but if the title matches an excel document, then that excel document gets activated...

melba, the control that runs them is part of a toolbar menu.. tough to disable that no?

thanks guys

Share this post


Link to post
Share on other sites
Melba23

gcue,

the control that runs them is part of a toolbar menu.. tough to disable that no?

_GUICtrlToolbar_EnableButton - Enables or disables the specified button

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
martin

heeey martin!!!

i like your idea martin but if the title matches an excel document, then that excel document gets activated...

[/quote

Hi gcue!

Yes but maybe you could do something like this

Func IsTitleFree($hParent, $st)
$var = WinList($st)

For $i = 1 to $var[0][0]
 
 If _WinAPI_GetParent($var[$i][1]) = $hParent "" then return False
 
Next

Return True
EndFunc
Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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  

×