nidquival Posted December 11, 2015 Posted December 11, 2015 Good day,I would like to ask for help in saving text from clipboard to variables and using values from different variables and pasting them into a text box. I am trying to save text from clipboard and saving them as variables multiple times and then later combining the string values from those variables to use as file names. In the script below whenever I try to save the file as PDF, the values from the variables are not displayed. The supposed objective of the script is toCopy text from excel filesSave the text from excel to a variableCopy the text to TableauRepeatCombine the two variables into one variableSave the Tableau output as PDFUse the variable as filename to save the PDFRepeat Whenever I run the script, however, the filenames are only dashes, or blanks, or at times the name of the business. Also, is there a way that the script can also detect if the cells in microsoft excel have text?Many thanks,Nicoexpandcollapse popupLocal $tableaufile = "Tableau - Output" Local $cityfile = "City - Excel" Local $businessfile = "Business - Excel" Global $city, $business, $combined Local $repeatcity = 5 Local $repeatbusiness = 5 Local $i=0, $j=0,$x=0, $y=0 Func CopyExcel ($file) WinActivate($file) Send("{DOWN}") Send("^c") $parameter=ClipGet() Sleep(500) Return $parameter EndFunc Func CopyTableau($x,$y,$tableaufile) WinActivate($tableaufile); Activate Tableau WinWaitActive($tableaufile); Wait for Tableau window to show up MouseClick("Left",$x,$y); Click the parameter window (you need to change mouse cursor location) Send("{BACKSPACE 3}"); Delete existing content Sleep(500); Wait for 0.5 second Send("^v"); paste in new code from the Excel file Send("{ENTER}"); Send enter key EndFunc Func PrintToPDF($combined) Do sleep(3000) until WinExists("Computing visualization of ")= 0 ; wait until tableau finishes processing Send("^p"); print out current dashboard WinWaitActive("Print"); wait for print window to show up sleep(1000); wait for 1 second Send("{ENTER}");send enter to select CUTEPDF printer WinWaitActive("Save As"); wait for window to prompt for file name MouseClick("Left"); to make the PDF printer prompt appear MouseClick("Left",1036,620); Send("{BACKSPACE 30}") Mouseclick("Left",835,618) Send("^v");send City and Business name as file name Send("{Enter}"); print Sleep(3000); wait until CutePDF finishes printing EndFunc For $i= 1 to $repeatcity $city = CopyExcel($cityfile) CopyTableau(442,218,$tableaufile) For $j=1 to $repeatbusiness $business = CopyExcel($businessfile) CopyTableau(338,262,$tableaufile) $combined = ($city &" - "& $business) ClipPut($combined) PrintToPDF($combined) Next Next msgbox(0,"Finish","Run in finish!")
jdelaney Posted December 11, 2015 Posted December 11, 2015 Use the _Excel functions, and capture the data to variables...not the clipboard.When you have the variables, then you can easily concatenate them into whatever you want. 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.
nidquival Posted December 11, 2015 Author Posted December 11, 2015 Thanks jdelaney, I'll look into those.
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