Jump to content

Non programmer hoping for some help...


Recommended Posts

I used the script recorder to record a macro, and it works quite well. Basically what it does is it opens a program, runs a report, saves a file, then is done. What I want it to do is repeat the sequence for the next file down the line. The only caveat is it doesn't 'open' the file, it uses it (it is an xml document). I will post my current script. If in that folder let's say there are 10 xml documents, I want it to go down the line and do all of them, aka open bill.xml, ted.xml, robert.xml, etc til it is done with all of them. I was thinking maybe have it move all of them to a folder, open the first one, move it out of the folder, then open the 'first' one again, which will be the next one. Any input would be hugely appreciated!

CODE
Opt("WinWaitDelay",100)

Opt("WinTitleMatchMode",4)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

WinWait("Program Manager","FolderView")

If Not WinActive("Program Manager","FolderView") Then WinActivate("Program Manager","FolderView")

WinWaitActive("Program Manager","FolderView")

MouseClick("left",44,564,2)

WinWait("Morningstar Principia - [untitled]","Advisor Palette")

If Not WinActive("Morningstar Principia - [untitled]","Advisor Palette") Then WinActivate("Morningstar Principia - [untitled]","Advisor Palette")

WinWaitActive("Morningstar Principia - [untitled]","Advisor Palette")

MouseMove(55,105)

MouseDown("left")

MouseUp("left")

WinWait("Morningstar Principia - [untitled]","Allocation View")

If Not WinActive("Morningstar Principia - [untitled]","Allocation View") Then WinActivate("Morningstar Principia - [untitled]","Allocation View")

WinWaitActive("Morningstar Principia - [untitled]","Allocation View")

MouseMove(550,73)

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - [New Scenario]","Scenario Profile: Ba")

If Not WinActive("Principia Asset Allocation Module - [New Scenario]","Scenario Profile: Ba") Then WinActivate("Principia Asset Allocation Module - [New Scenario]","Scenario Profile: Ba")

WinWaitActive("Principia Asset Allocation Module - [New Scenario]","Scenario Profile: Ba")

MouseMove(23,40)

MouseDown("left")

MouseUp("left")

MouseMove(44,79)

MouseDown("left")

MouseUp("left")

WinWait("Open","Files of &type:")

If Not WinActive("Open","Files of &type:") Then WinActivate("Open","Files of &type:")

WinWaitActive("Open","Files of &type:")

MouseMove(174,111)

MouseDown("left")

MouseMove(174,112)

MouseUp("left")

MouseMove(369,215)

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Scenario Profile: Ba")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Scenario Profile: Ba") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Scenario Profile: Ba")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Scenario Profile: Ba")

MouseMove(838,666)

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Scenario Profile: Cl")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Scenario Profile: Cl") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Scenario Profile: Cl")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Scenario Profile: Cl")

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Scenario Profile: Ca")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Scenario Profile: Ca") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Scenario Profile: Ca")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Scenario Profile: Ca")

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Asset allocation ana")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Asset allocation ana") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Asset allocation ana")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Asset allocation ana")

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Optimize Asset Alloc")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Optimize Asset Alloc") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Optimize Asset Alloc")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Optimize Asset Alloc")

MouseDown("left")

MouseUp("left")

MouseDown("left")

MouseUp("left")

MouseDown("left")

MouseUp("left")

MouseDown("left")

MouseUp("left")

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Forecast Wealth: Ret")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Forecast Wealth: Ret") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Forecast Wealth: Ret")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Ret")

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Inc")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Inc") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Inc")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Inc")

MouseDown("left")

MouseUp("left")

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Sav")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Sav") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Sav")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Sav")

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Wit")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Wit") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Wit")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Wit")

MouseDown("left")

MouseUp("left")

MouseDown("left")

MouseUp("left")

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Tax")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Tax") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Tax")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Tax")

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: For")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: For") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: For")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: For")

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Propose Portfolio: A")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Propose Portfolio: A") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Propose Portfolio: A")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Propose Portfolio: A")

MouseMove(746,615)

MouseDown("left")

MouseUp("left")

MouseMove(850,672)

MouseDown("left")

MouseUp("left")

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Enter report setting")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Enter report setting") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Enter report setting")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Enter report setting")

MouseMove(245,399)

MouseDown("left")

MouseUp("left")

MouseMove(267,438)

MouseDown("left")

MouseUp("left")

WinWait("Program Manager","FolderView")

If Not WinActive("Program Manager","FolderView") Then WinActivate("Program Manager","FolderView")

WinWaitActive("Program Manager","FolderView")

MouseMove(621,1033)

MouseDown("left")

MouseUp("left")

MouseMove(718,1036)

MouseDown("left")

MouseUp("left")

WinWait("Foxit Reader 3.0")

If Not WinActive("Foxit Reader 3.0") Then WinActivate("Foxit Reader 3.0")

WinWaitActive("Foxit Reader 3.0")

MouseMove(40,39)

MouseDown("left")

MouseUp("left")

MouseMove(85,149)

MouseDown("left")

MouseUp("left")

WinWait("Save As","Save whole document")

If Not WinActive("Save As","Save whole document") Then WinActivate("Save As","Save whole document")

WinWaitActive("Save As","Save whole document")

Send("{SHIFTDOWN}e{SHIFTUP}rnie.pdf")

MouseMove(370,250)

MouseDown("left")

MouseUp("left")

WinWait("Ernie.pdf - Foxit Reader 3.0 - [Ernie.pdf]","This document contai")

If Not WinActive("Ernie.pdf - Foxit Reader 3.0 - [Ernie.pdf]","This document contai") Then WinActivate("Ernie.pdf - Foxit Reader 3.0 - [Ernie.pdf]","This document contai")

WinWaitActive("Ernie.pdf - Foxit Reader 3.0 - [Ernie.pdf]","This document contai")

MouseMove(29,33)

MouseDown("left")

MouseUp("left")

MouseMove(70,416)

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Enter report setting")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Enter report setting") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Enter report setting")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Enter report setting")

MouseMove(16,32)

MouseDown("left")

MouseUp("left")

MouseMove(68,234)

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module","Do you wish to save ")

If Not WinActive("Principia Asset Allocation Module","Do you wish to save ") Then WinActivate("Principia Asset Allocation Module","Do you wish to save ")

WinWaitActive("Principia Asset Allocation Module","Do you wish to save ")

MouseMove(63,98)

MouseDown("left")

MouseUp("left")

WinWait("Morningstar Principia","Allocation View")

If Not WinActive("Morningstar Principia","Allocation View") Then WinActivate("Morningstar Principia","Allocation View")

WinWaitActive("Morningstar Principia","Allocation View")

MouseMove(20,52)

MouseDown("left")

MouseUp("left")

MouseMove(77,672)

MouseDown("left")

MouseUp("left")

Link to comment
Share on other sites

I used the script recorder to record a macro, and it works quite well. Basically what it does is it opens a program, runs a report, saves a file, then is done. What I want it to do is repeat the sequence for the next file down the line. The only caveat is it doesn't 'open' the file, it uses it (it is an xml document). I will post my current script. If in that folder let's say there are 10 xml documents, I want it to go down the line and do all of them, aka open bill.xml, ted.xml, robert.xml, etc til it is done with all of them. I was thinking maybe have it move all of them to a folder, open the first one, move it out of the folder, then open the 'first' one again, which will be the next one. Any input would be hugely appreciated!

CODE
Opt("WinWaitDelay",100)

Opt("WinTitleMatchMode",4)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

WinWait("Program Manager","FolderView")

If Not WinActive("Program Manager","FolderView") Then WinActivate("Program Manager","FolderView")

WinWaitActive("Program Manager","FolderView")

MouseClick("left",44,564,2)

WinWait("Morningstar Principia - [untitled]","Advisor Palette")

If Not WinActive("Morningstar Principia - [untitled]","Advisor Palette") Then WinActivate("Morningstar Principia - [untitled]","Advisor Palette")

WinWaitActive("Morningstar Principia - [untitled]","Advisor Palette")

MouseMove(55,105)

MouseDown("left")

MouseUp("left")

WinWait("Morningstar Principia - [untitled]","Allocation View")

If Not WinActive("Morningstar Principia - [untitled]","Allocation View") Then WinActivate("Morningstar Principia - [untitled]","Allocation View")

WinWaitActive("Morningstar Principia - [untitled]","Allocation View")

MouseMove(550,73)

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - [New Scenario]","Scenario Profile: Ba")

If Not WinActive("Principia Asset Allocation Module - [New Scenario]","Scenario Profile: Ba") Then WinActivate("Principia Asset Allocation Module - [New Scenario]","Scenario Profile: Ba")

WinWaitActive("Principia Asset Allocation Module - [New Scenario]","Scenario Profile: Ba")

MouseMove(23,40)

MouseDown("left")

MouseUp("left")

MouseMove(44,79)

MouseDown("left")

MouseUp("left")

WinWait("Open","Files of &type:")

If Not WinActive("Open","Files of &type:") Then WinActivate("Open","Files of &type:")

WinWaitActive("Open","Files of &type:")

MouseMove(174,111)

MouseDown("left")

MouseMove(174,112)

MouseUp("left")

MouseMove(369,215)

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Scenario Profile: Ba")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Scenario Profile: Ba") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Scenario Profile: Ba")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Scenario Profile: Ba")

MouseMove(838,666)

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Scenario Profile: Cl")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Scenario Profile: Cl") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Scenario Profile: Cl")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Scenario Profile: Cl")

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Scenario Profile: Ca")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Scenario Profile: Ca") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Scenario Profile: Ca")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Scenario Profile: Ca")

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Asset allocation ana")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Asset allocation ana") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Asset allocation ana")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Asset allocation ana")

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Optimize Asset Alloc")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Optimize Asset Alloc") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Optimize Asset Alloc")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Optimize Asset Alloc")

MouseDown("left")

MouseUp("left")

MouseDown("left")

MouseUp("left")

MouseDown("left")

MouseUp("left")

MouseDown("left")

MouseUp("left")

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Forecast Wealth: Ret")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Forecast Wealth: Ret") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie).xml","Forecast Wealth: Ret")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Ret")

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Inc")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Inc") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Inc")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Inc")

MouseDown("left")

MouseUp("left")

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Sav")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Sav") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Sav")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Sav")

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Wit")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Wit") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Wit")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Wit")

MouseDown("left")

MouseUp("left")

MouseDown("left")

MouseUp("left")

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Tax")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Tax") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Tax")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: Tax")

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: For")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: For") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: For")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Forecast Wealth: For")

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Propose Portfolio: A")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Propose Portfolio: A") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Propose Portfolio: A")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Propose Portfolio: A")

MouseMove(746,615)

MouseDown("left")

MouseUp("left")

MouseMove(850,672)

MouseDown("left")

MouseUp("left")

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Enter report setting")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Enter report setting") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Enter report setting")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Enter report setting")

MouseMove(245,399)

MouseDown("left")

MouseUp("left")

MouseMove(267,438)

MouseDown("left")

MouseUp("left")

WinWait("Program Manager","FolderView")

If Not WinActive("Program Manager","FolderView") Then WinActivate("Program Manager","FolderView")

WinWaitActive("Program Manager","FolderView")

MouseMove(621,1033)

MouseDown("left")

MouseUp("left")

MouseMove(718,1036)

MouseDown("left")

MouseUp("left")

WinWait("Foxit Reader 3.0")

If Not WinActive("Foxit Reader 3.0") Then WinActivate("Foxit Reader 3.0")

WinWaitActive("Foxit Reader 3.0")

MouseMove(40,39)

MouseDown("left")

MouseUp("left")

MouseMove(85,149)

MouseDown("left")

MouseUp("left")

WinWait("Save As","Save whole document")

If Not WinActive("Save As","Save whole document") Then WinActivate("Save As","Save whole document")

WinWaitActive("Save As","Save whole document")

Send("{SHIFTDOWN}e{SHIFTUP}rnie.pdf")

MouseMove(370,250)

MouseDown("left")

MouseUp("left")

WinWait("Ernie.pdf - Foxit Reader 3.0 - [Ernie.pdf]","This document contai")

If Not WinActive("Ernie.pdf - Foxit Reader 3.0 - [Ernie.pdf]","This document contai") Then WinActivate("Ernie.pdf - Foxit Reader 3.0 - [Ernie.pdf]","This document contai")

WinWaitActive("Ernie.pdf - Foxit Reader 3.0 - [Ernie.pdf]","This document contai")

MouseMove(29,33)

MouseDown("left")

MouseUp("left")

MouseMove(70,416)

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Enter report setting")

If Not WinActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Enter report setting") Then WinActivate("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Enter report setting")

WinWaitActive("Principia Asset Allocation Module - 401K Optimizer (Ernie ).xml","Enter report setting")

MouseMove(16,32)

MouseDown("left")

MouseUp("left")

MouseMove(68,234)

MouseDown("left")

MouseUp("left")

WinWait("Principia Asset Allocation Module","Do you wish to save ")

If Not WinActive("Principia Asset Allocation Module","Do you wish to save ") Then WinActivate("Principia Asset Allocation Module","Do you wish to save ")

WinWaitActive("Principia Asset Allocation Module","Do you wish to save ")

MouseMove(63,98)

MouseDown("left")

MouseUp("left")

WinWait("Morningstar Principia","Allocation View")

If Not WinActive("Morningstar Principia","Allocation View") Then WinActivate("Morningstar Principia","Allocation View")

WinWaitActive("Morningstar Principia","Allocation View")

MouseMove(20,52)

MouseDown("left")

MouseUp("left")

MouseMove(77,672)

MouseDown("left")

MouseUp("left")

Without being able to run your script using the program you use and the folder structure etc that you have I cannot tell what is happening and I would be very impressed if anyone could.

You need to isolate the part which specifies the xml file. Then put the whole script in a loop using FileFindFirst and FileFindNext. Something like this.

$search = FileFindFirstFile(@ScriptDir & "\*.xml")  

; Check if the search was successful
If $search = -1 Then
    MsgBox(0, "Error", "No xml files found in " & @ScriptDir)
    Exit
EndIf

While 1
    $file = FileFindNextFile($search) 
    If @error Then ExitLoop;there are no more xml files so quit
    
   AutogenThing($file);deal with the next xml file
WEnd

; Close the search handle
FileClose($search)

Func AutogenThing($agf)
   ;this is your original script but the part which specifies the xml file has to be isolated
   ;...
   ;...
    
   ;now the part which specifies the xml file to use
   ;do something with $agf
    
   ;now the rest of your original script
    
EndFunc
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Thanks Martin! Yeah I guess it is quite confusing with all the mouse movement. All I am doing is pressing the 'next' button on a prompt screen as it steps through calculations on a portfolio. I guess I could do that with the keyboard to make it more effective. I will trial and error with this code you gave me (I have ZERO programming experience). I am a logical guy so I can 'see' what is happening, but creating it is impossible since I have no programming experience. I liken it to knowing how to use a microwave, but couldn't in a million years build one... =p

Link to comment
Share on other sites

Martin, as you see I save the output report (pdf) as name.pdf, so when it finds an xml file, can it save the name (w/o .xml) and put it in where you see :

WinWaitActive("Save As","Save whole document")

Send("{SHIFTDOWN}e{SHIFTUP}rnie.pdf"

on lines 150 and 151, so instead it could say something like:

WinWaitActive("Save As","Save whole document")

Send("The name of the XML file it is currently working on.pdf" <------ obviously not literally that, but a relative reference to the name. As I do not want it to overwrite the first one.

Thank you for your time Martin!!

Link to comment
Share on other sites

Martin, as you see I save the output report (pdf) as name.pdf, so when it finds an xml file, can it save the name (w/o .xml) and put it in where you see :

WinWaitActive("Save As","Save whole document")

Send("{SHIFTDOWN}e{SHIFTUP}rnie.pdf"

on lines 150 and 151, so instead it could say something like:

WinWaitActive("Save As","Save whole document")

Send("The name of the XML file it is currently working on.pdf" <------ obviously not literally that, but a relative reference to the name. As I do not want it to overwrite the first one.

Thank you for your time Martin!!

Send is basically a blind function, it doesn't know where it is sending the string to.

Try

ControlSend("Save As", "Save whole document", "Edit1", $file & ".pdf");Edit1 will only work if it is the first Edit control you want to send the string to

Also instead of mouse down/up try

ControlClick("Save As", "Save whole document", "Button1");again Button1 will only work if it is the first button you want to click

Search for ControlSend and ControlClick in the help file

Edit-Also check out _PathSplit in the help file.

Edited by KenNichols
[topic="21048"]New to AutoIt? Check out AutoIt 1-2-3![/topic] Need to make a GUI? You NEED KODA FormDesigner!
Link to comment
Share on other sites

Send is basically a blind function, it doesn't know where it is sending the string to.

Try

ControlSend("Save As", "Save whole document", "Edit1", $file & ".pdf");Edit1 will only work if it is the first Edit control you want to send the string to

Also instead of mouse down/up try

ControlClick("Save As", "Save whole document", "Button1");again Button1 will only work if it is the first button you want to click

Search for ControlSend and ControlClick in the help file

Edit-Also check out _PathSplit in the help file.

Thanks Ken! I will try and pretty up the script tonight using your suggestions! Then maybe you could critique round 2! Will $file output 'xyz.xml' or just 'xyz'? It will not matter as it will additionally append .pdf, so it will still work. If it has .xml, I guess I could send 4 backspaces.

Link to comment
Share on other sites

Thanks Ken! I will try and pretty up the script tonight using your suggestions! Then maybe you could critique round 2! Will $file output 'xyz.xml' or just 'xyz'? It will not matter as it will additionally append .pdf, so it will still work. If it has .xml, I guess I could send 4 backspaces.

I am kinda new at this too, only about 6 months or so.

There are serveral ways to remove the .xml but I found _PathSplit to work the best for "me".

Check out _PathSplit in the help file.

_PathSplit($file, $Drive, $Dir, $FileName, $Extention)
ControlSend("Save As", "Save whole document", "Edit1", $FileName & ".pdf")
[topic="21048"]New to AutoIt? Check out AutoIt 1-2-3![/topic] Need to make a GUI? You NEED KODA FormDesigner!
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...