jfcby Posted August 25, 2008 Posted August 25, 2008 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 ****
youknowwho4eva Posted August 25, 2008 Posted August 25, 2008 Try putting a sleep just before the winactivate. Giggity
jfcby Posted August 25, 2008 Author Posted August 25, 2008 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 ****
Recommended Posts
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