sbrady Posted November 9, 2012 Share Posted November 9, 2012 here is a GUI with 7 buttons. Very simply, most of the buttons open a window and places it. If you just look at the 'case' for button 3................it does NOT move the window to the numbers in the script. No matter what numbers I put in.........the window opens to the same place everytime. expandcollapse popup; GUI create #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> ;#include <Array.au3> Example() Func Example() Local $Button_1, $Button_2, $Button_3, $Button_4,$Button_5,$Button_6,$Button_7, $msg GUICreate("DAW1 Scripts", 220,320) ; will create a dialog box that when displayed is centered ;$textbox_input = GUICtrlCreateInput("AR123 Smith, Bob", 10, 35, 350, 20) ; will not accept drag&drop files ;$new_project_name = GUICtrlRead($textbox_input) Opt("GUICoordMode", 2) $Button_1 = GUICtrlCreateButton(" 1. Full Promo Prep", 20, 30, 180,30, $BS_LEFT) $Button_2 = GUICtrlCreateButton(" 2. Open NPR Promo folder", -180, 10, 180,30, $BS_LEFT) $Button_3 = GUICtrlCreateButton(" 3. Open Promo AM Folder", -180, 10, 180,30, $BS_LEFT) $Button_4 = GUICtrlCreateButton(" 4. Open 1030View", -180, 10, 180,30, $BS_LEFT) $Button_5 = GUICtrlCreateButton(" 5. Make NPR Promo folder", -180, 10, 180,30, $BS_LEFT) $Button_6 = GUICtrlCreateButton(" 6. NEXTDAY to DMG", -180, 10, 180,30, $BS_LEFT) $Button_7 = GUICtrlCreateButton(" 7. Rename Mixes", -180, 10, 180,30, $BS_LEFT) GUISetState() ; will display an dialog box with 2 button ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop ;BUTTON 1 Promo Prep Case $msg = $Button_1 ;open each promo window ;MsgBox(8192, "Test", "you pushed button 1", 5) ; format the date $the_month = @MON ; get the month 11 $the_day = @mday ;get the day 09 $the_year = @YEAR ;get the year 12 $the_year2 = StringTrimLeft ($the_year,2) $todays_promo1 = $the_month & "-" & $the_day & "-" & $the_year2 & " Promos NPR" ;10-15-12 Promos NPR $todays_promo2 = $the_month & "-" & $the_day & "-" & $the_year2 & " Promos" ;10-15-12 Promos ; set the path for the NPR Promo folder $NPR_PROMO_FOLDER = "C:\Documents and Settings\sebrad\Desktop\shawn\Nuendo Projects\NPR Promo\" & $todays_promo1 ; make the NPR folder at the usual location DirCreate($NPR_PROMO_FOLDER) ; 10-15-12 Promo NPR ; open Promo AM folder ShellExecute("C:\Documents and Settings\sebrad\Desktop\shawn\Promo AM") $iCurrentMode = Opt("WinTitleMatchMode", 2) WinMove("C:\Documents and Settings\sebrad\Desktop\shawn\Promo AM","",200,200,400,400) ;Opt("WinTitleMatchMode", $iCurrentMode) ; open 1030View folder ShellExecute("C:\Documents and Settings\sebrad\Desktop\shawn\1030Viewfolder") $iCurrentMode = Opt("WinTitleMatchMode", 2) WinMove("C:\Documents and Settings\sebrad\Desktop\shawn\1030Viewfolder","",200,400,400,400) ;Opt("WinTitleMatchMode", $iCurrentMode) ;open todays NPR promo folder ShellExecute("C:\Documents and Settings\sebrad\Desktop\shawn\Nuendo Projects\NPR Promo\" & $todays_promo1) $iCurrentMode = Opt("WinTitleMatchMode", 2) WinMove("C:\Documents and Settings\sebrad\Desktop\shawn\Nuendo Projects\NPR Promo\" & $todays_promo1,"",400,400,400,400) ;Opt("WinTitleMatchMode", $iCurrentMode) ; end button 1 ;BUTTON 2 Open NPR Promo folder Case $msg = $Button_2 MsgBox(8192, "Test", "you pushed button 2", 5) ; get the month 11 $the_month = @MON ;get the day 09 $the_day = @mday ;get the year 12 $the_year = @YEAR $the_year2 = StringTrimLeft ($the_year,2) $todays_promo1 = $the_month & "-" & $the_day & "-" & $the_year2 & " Promos NPR" ;10-15-12 Promos NPR $todays_promo2 = $the_month & "-" & $the_day & "-" & $the_year2 & " Promos" ;10-15-12 Promos ; set the path for the NPR Promo folder $NPR_PROMO_FOLDER = "C:\Documents and Settings\sebrad\Desktop\shawn\" & $todays_promo1 ; make the folder at the usual location DirCreate($NPR_PROMO_FOLDER) ; 10-15-12 Promo NPR ; put the Promo title on the clipboard ;ClipPut($todays_promo2) ; 10-15-12 Promo ; end button 2 ;open todays NPR promo folder ShellExecute("C:\Documents and Settings\sebrad\Desktop\shawn\Nuendo Projects\NPR Promo") $iCurrentMode = Opt("WinTitleMatchMode", 2) WinMove("C:\Documents and Settings\sebrad\Desktop\shawn\Nuendo Projects\NPR Promo","",400,120,800,700) Opt("WinTitleMatchMode", $iCurrentMode) ;Button 3 Open Promo AM Folder Case $msg = $Button_3 ;MsgBox(8192, "Test", "you pushed button 3", 5) ShellExecute("C:\Documents and Settings\sebrad\Desktop\shawn\Promo AM") ;$iCurrentMode = Opt("WinTitleMatchMode", 2) ;WinWait("C:\Documents and Settings\sebrad\Desktop\shawn\Promo AM", "", 1) WinMove("C:\Documents and Settings\sebrad\Desktop\shawn\Promo AM","",50,20,800,700) ;Opt("WinTitleMatchMode", $iCurrentMode) ;end button 3 ; BUTTON 4 Open 1030view Folder Case $msg = $Button_4 MsgBox(8192, "Test", "you pushed button 5", 5) ShellExecute("C:\Documents and Settings\sebrad\Desktop\shawn\1030Viewfolder") $iCurrentMode = Opt("WinTitleMatchMode", 2) WinMove("C:\Documents and Settings\sebrad\Desktop\shawn\1030Viewfolder","",400,120,800,700) Opt("WinTitleMatchMode", $iCurrentMode) ; end button 4 ; BUTTON 5 Make NPR Promo folder Case $msg = $Button_5 MsgBox(8192, "Test", "you pushed button 5", 5) ; month $the_month = @MON ;the day $the_day = @mday ;the year $the_year = @YEAR $the_year2 = StringTrimLeft ($the_year,2) ; set the name for DMG (Digital Media Group) $todays_promo_NPR = $the_month & "-" & $the_day & "-" & $the_year2 & " Promos NPR";NEXTDAY 10-15-12 ; end button 5 Local $todays_NPR_promo_folder = "C:\Documents and Settings\sebrad\Desktop\shawn\Nuendo Projects\" & $todays_promo_NPR DirCreate($todays_NPR_promo_folder) ; BUTTON 6 NEXTDAY to DMG Case $msg = $Button_6 MsgBox(8192, "Test", "you pushed button 6", 5) ; month $the_month = @MON ;the day $the_day = @mday ;the year $the_year = @YEAR $the_year2 = StringTrimLeft ($the_year,2) ; set the name for DMG (Digital Media Group) $todays_promo_DMG = "NEXTDAY " & $the_month & "-" & $the_day & "-" & $the_year2 ;NEXTDAY 10-15-12 ShellExecute("\\10.100.20.40\DMG Drop Off\Streaming\PROMOS") ; open DMG folder WinWait("PROMOS") ; wait till the drive exists WinMove("PROMOS","",50,800,200,300) ; open the drive in lower left of the screen $NDP_SRC = "D:\Promos\NEXTDAY.mxf" $DEST = "\\10.100.20.40\DMG Drop Off\Streaming\PROMOS\" & $todays_promo_DMG FileCopy ($NDP_SRC,$DEST) ;move NEXTDAY and rename to DMG ; end button 6 ShellExecute("C:\Documents and Settings\sebrad\Desktop\shawn\DMG") $iCurrentMode = Opt("WinTitleMatchMode", 2) WinMove("C:\Documents and Settings\sebrad\Desktop\shawn\DMG","",400,120,800,700) Opt("WinTitleMatchMode", $iCurrentMode) ; BUTTON 7 Rename Mixes Case $msg = $Button_7 MsgBox(8192, "Test", "you pushed button 7", 5) ; end button 7 EndSelect WEnd EndFunc ;==>Example Link to comment Share on other sites More sharing options...
jdelaney Posted November 9, 2012 Share Posted November 9, 2012 Why do you have the winwait commented out?Add some debugging:$hWin = WinMove("C:Documents and SettingssebradDesktopshawnPromo AM","",50,20,800,700) If IsHwnd($hWin) Then consolewrite ("able to find window" & @crlf) Else consolewrite ("UNable to find window" & @crlf) EndIfwinmove returns: Return Value Success: Returns handle to the window. Failure: Returns 0 if window is not found. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
sbrady Posted November 9, 2012 Author Share Posted November 9, 2012 (edited) i uncommented winwait...........still returns UNable to find window.........how can that be, the window is open........aarrrgghhhh Edited November 9, 2012 by sbrady Link to comment Share on other sites More sharing options...
jdelaney Posted November 9, 2012 Share Posted November 9, 2012 post the output of the window info pulled from the AutoIT Window Info tool IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
sbrady Posted November 9, 2012 Author Share Posted November 9, 2012 new code ShellExecute("C:Documents and SettingssebradDesktopshawnPromo AM2") $iCurrentMode = Opt("WinTitleMatchMode", 2) WinMove("C:Documents and SettingssebradDesktopshawnPromo AM2","",50,20,800,700) Opt("WinTitleMatchMode", $iCurrentMode) sleep (200) WinActive ( "Promo AM2" ) window output:: >"C:Program FilesAutoIt3SciTE..autoit3.exe" /ErrorStdOut "C:Documents and SettingssebradMy DocumentsSB AutoITDAW1 Scriptsopen folder and place.au3" >Exit code: 0 Time: 1.647 Link to comment Share on other sites More sharing options...
sbrady Posted November 9, 2012 Author Share Posted November 9, 2012 this machine is running XP if that makes a difference. Link to comment Share on other sites More sharing options...
jdelaney Posted November 9, 2012 Share Posted November 9, 2012 oh, not the console output. AutoIT comes with an exe = auto it window info tool launch that, and drag the cursor over the window you are trying to attach to...copy the tool's info to the forum IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
sbrady Posted November 9, 2012 Author Share Posted November 9, 2012 DUHP.........know what ya mean......hold on. Link to comment Share on other sites More sharing options...
sbrady Posted November 9, 2012 Author Share Posted November 9, 2012 >>>> Window <<<< Title: Promo AM2 Class: CabinetWClass Position: 55, 76 Size: 576, 517 Style: 0x16CF0000 ExStyle: 0x00000100 Handle: 0x005802E4 >>>> Control <<<< Class: SysListView32 Instance: 1 ClassnameNN: SysListView321 Name: Advanced (Class): [CLASS:SysListView32; INSTANCE:1] ID: 1 Text: FolderView Position: 263, 91 Size: 305, 386 ControlClick Coords: 137, 112 Style: 0x56100248 ExStyle: 0x00000000 Handle: 0x0099051C >>>> Mouse <<<< Position: 459, 315 Cursor ID: 2 Color: 0xF7F7F7 >>>> StatusBar <<<< 1: 3 objects 2: 0 bytes 3: My Computer >>>> ToolsBar <<<< >>>> Visible Text <<<< C:Documents and SettingssebradDesktopshawnPromo AM2 C:Documents and SettingssebradDesktopshawnPromo AM2 FolderView >>>> Hidden Text <<<< 3 objects Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 9, 2012 Moderators Share Posted November 9, 2012 (edited) sbrady,On my Vista system the path of an Explorer window is only visible in the "text" tab of the Window Info Tool. So you have the wrong parameters in WinWait and WinMove - which is why AutoIt does not find the window. If you do something like this it should work - it certainly does for me:ShellExecute("Your_Path") $hHandle = WinWait("", "Your_Path") ; Look for the path in the text and get the handle of the window WinMove($hHandle, "", 100, 120, 400, 400) ; use the handle hereAll clear? M23Edit: I see from the above that your XP system does the same so it should work for you too. Edited November 9, 2012 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
jdelaney Posted November 9, 2012 Share Posted November 9, 2012 maybe, to narrow down the search, you should include the window class to search for: ShellExecute("Your_Path") $hHandle = WinWait("[CLASS:CabinetWClass]", "Your_Path") ; Look for the path in the text and get the handle of the window WinMove($hHandle, "", 100, 120, 400, 400) ; use the handle here just in case some other window exists with the text (doubtful, but why not) IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
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