Bensdb Posted September 25, 2013 Share Posted September 25, 2013 Hello, I'm completely new to scripting, and have bodged together the following script to do the following: Starts a GUI with three input areas. Starts excel and Indesign in the background (I would like both to be hidden). After clicking a button ctrl on the gui all inputted data is taken to excel, where a macro is run to put it into a nice useable format, then saved for use with Indesign. Excel is then Closed, and a template file in Indesign is opened. The temp CSV file I created is then opened within my Indesign template to update the data in the template. These files are then exported as jpeg's for later use, and eventual printing. My main problem at the moment is hiding the Indesign windows. I can put the @SW_HIDE flag within the Run () command when opening Indesign, but the problem is that only hides the main Indesign window. As it's loading there is a startup/splash screen that is not hidden, and then also some tool windows, which for some reason aren't hidden either. Is there a way to hide all subsequent windows that are opened/created by a program? So like- all child windows, so to speak. Also, I am aware that as I am a complete novice, my code is probably a complete mess, and there are probably many things i have done wrong- or could have done in an easier way. If anyone would like to point these out with any suggested modifications and a description of why the changes work (remember I am a complete novice), then I will be very happy + you will help me learn. Many Thanks! Have fun: expandcollapse popup#include <GUIConstantsEx.au3> #include <Excel.au3> #include <DateTimeConstants.au3> Local $Button1, $msg, $NamesListEdit, $array1, $file, $oExcel $page1 = GUICreate("Ben's Program", 400, 460) GUICtrlCreateLabel("Welcome to Ben's Program!", 30, 30) GUICtrlCreateLabel("Enter Guest Names:", 30, 260) GUICtrlCreateLabel("Enter Wedding Date:", 30, 85) GUICtrlCreateLabel("Enter Couple's Name:", 30, 370) $NamesListEdit = GuiCtrlCreateEdit("",150,255,240,100) $DateInput = GUICtrlCreateMonthCal ("Wedding Date", 150, 80, 240, 160, $MCS_NOTODAY) $CoupleNameInput = GUICtrlCreateInput ("", 150,370,240,20) $Button1 = GUICtrlCreateButton("Start!", 305, 415, 80) GUISetState(@SW_SHOW) $file = "C:\Users\User\Desktop\ebay-business\coding\datamergeinfo.xlsm" $oExcel = _ExcelBookOpen($file, 0) $TempExampCSV = "C:\Users\User\Desktop\ebay-business\coding\TemporaryExampleCsv" $oIndesign = Run ("C:\Program Files (x86)\Adobe\Adobe InDesign CS5.5\InDesign.exe C:\Users\User\Desktop\ebay-business\coding\mastertemplate.indd") WinWaitActive ("", "Don't Update Links") Send ("{ENTER}") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button1 $tempeditdata = GUICtrlRead($NamesListEdit) $tempeditdata2 = GUICtrlRead($DateInput) $tempeditdata3 = GUICtrlRead($CoupleNameInput) $array1 = StringSplit("Name"&@CRLF& $tempeditdata, @CRLF,1) $array2 = StringSplit("Date"&@CRLF& $tempeditdata2, @CRLF,1) $array3 = StringSplit("Couple Name"&@CRLF& $tempeditdata3, @CRLF,1) For $i =1 To $array1[0] _ExcelWriteArray($oExcel, 1, 1, $array1, 1) Next For $i =1 To $array2 [0] _ExcelWriteArray($oExcel, 1,2, $array2, 1) Next For $i =1 To $array3 [0] _ExcelWriteArray($oExcel, 1,3,$array3, 1) Next WinActivate ("Microsoft Excel - datamergeinfo") Send ("^y") _ExcelBookSaveAs ($oExcel, $TempExampCSV, "csv", 0, 1) _ExcelBookClose ($oExcel, 0, 0) WinActivate ("mastertemplate.indd") Send ("^u") Send ("^m") Send ("{ENTER}") WinWaitActive ("Adobe InDesign") ControlClick ( "Adobe InDesign", "OK", "[CLASS:Button; INSTANCE:1]", "left") WinActivate ("*mastertemplate-1") Send ("^e") WinWaitActive ("Export") Send("{TAB 2}") Send ("{ENTER}") Send("{TAB 6}") Send ("{ENTER}") WinActivate ("*mastertemplate-1") Send ("^w") WinWaitActive ("Adobe InDesign") Send("{TAB}") Send ("{ENTER}") WinActivate ("*mastertemplate.indd") Send ("^w") WinWaitActive ("Adobe InDesign") Send("{TAB}") Send ("{ENTER}") WinActivate ("Adobe InDesign CS5.5") Send ("^q") EndSelect WEnd Link to comment Share on other sites More sharing options...
Bensdb Posted September 25, 2013 Author Share Posted September 25, 2013 Surely someone knows how this is possible? 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