Jump to content
Sign in to follow this  
jfcby

Window Want Activate!

Recommended Posts

jfcby

Hi,

In the following script the DWG TrueView Window will not Activate. I've tried the code: WinActivate("DWG TrueView", "") by itself and it activates the window.

How can I get DWG TrueView to Activate in the following code:

#include <GUIConstantsEx.au3>
#Include <WinAPI.au3>

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode
$mainwindow = GUICreate("DWG TrueView Print", 250, 100, 675, 50)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit");"CLOSEClicked")
GUICtrlCreateLabel("Print DWG TrueView Active window.", 30, 10)
$printbutton = GUICtrlCreateButton("Print", 90, 50, 75, 25)
GUICtrlSetOnEvent($printbutton, "PrintButton")
GUISetState(@SW_SHOW)

  
While 1
  Sleep(1000) ; Idle around
WEnd

Func PrintButton()  
    WinActivate("DWG TrueView", "") 
EndFunc

Func _Quit();CLOSEClicked()
 ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE, 
 ;and @GUI_WINHANDLE would equal $mainwindow 
  MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...")
  Exit
EndFunc

Thanks for your help,

jfcby


Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****

Share this post


Link to post
Share on other sites
youknowwho4eva

Try putting a sleep just before the winactivate.


Giggity

Share this post


Link to post
Share on other sites
jfcby

Hi,

In the following script the DWG TrueView Window will not Activate. I've tried the code: WinActivate("DWG TrueView", "") by itself and it activates the window.

How can I get DWG TrueView to Activate in the following code:

#include <GUIConstantsEx.au3>
#Include <WinAPI.au3>

Opt("GUIOnEventMode", 1); Change to OnEvent mode
$mainwindow = GUICreate("DWG TrueView Print", 250, 100, 675, 50)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit");"CLOSEClicked")
GUICtrlCreateLabel("Print DWG TrueView Active window.", 30, 10)
$printbutton = GUICtrlCreateButton("Print", 90, 50, 75, 25)
GUICtrlSetOnEvent($printbutton, "PrintButton")
GUISetState(@SW_SHOW)

  
While 1
  Sleep(1000); Idle around
WEnd

Func PrintButton()  
    WinActivate("DWG TrueView", "") 
EndFunc

Func _Quit();CLOSEClicked()
;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE, 
;and @GUI_WINHANDLE would equal $mainwindow 
  MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...")
  Exit
EndFunc

Thanks for your help,

jfcby

Problem Sloved with the following code: WinActivate("DWG TrueView", "z:\")

Thanks for your help,

jfcby


Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.