2

I am trying to use PowerShell to automate the process of loading files to a website.

The process has four steps. I have automated the first three steps of the process by using getElementByID to fill values of textboxes and click buttons. The fourth step uploads the files. The website uses SWFUpload to upload the files. I cannot figure out how to trigger (fire event) the SWFUpload in PowerShell. I can trigger the other buttons using the .Click() method, but this does not work for the upload button. I suspect it is because it isn't really a button, but an SWFUpload utility (type=application/x-shockwave-flash).

Does anyone know how to trigger this in PowerShell? I can provide the HTML coding and the PowerShell script. I have referenced the website below, but it seems to show how to create the SWFUpload in JavaScript, not PowerShell.

https://www.chem.umn.edu/groups/gladfelter/blade_packs/system_CKeditor/plugins/pgrfilemanager/SWFUpload%20v2.2.0.1%20Core/Documentation/#swfupload

wallpke
  • 21
  • 2

1 Answers1

0

I did not find a way to work with SWFUpload in PowerShell, but I was able to find three work-arounds.

1.) SendKeys 2.) Mouse-click function via power shell : how to send middle mouse click? 3.) WASP https://wasp.codeplex.com/

I chose to use SendKeys because to use a mouse click, you must also move the mouse. This is possible, but it is so easy to nudge the mouse which would re-posisiton the mouse off of the button.

SendKeys allows the user to send keyboard keys to the computer without the user acutally doing anything. I used SendKeys to tab to the "Upload button", click it, navigate thru the Open File dialog box to select the files, and finally click the Open button to complete the upload.

There are some drawbacks to SendKeys, however. SendKeys will send the key(s) only to the window that is in the foreground. So if you are running your script and your computer sends you a pop-up message in the middle of it, SendKeys will send the keystrokes to that pop-up message.

SendKeys syntax: http://blogs.technet.com/b/heyscriptingguy/archive/2011/01/10/provide-input-to-applications-with-powershell.aspx

Community
  • 1
  • 1
wallpke
  • 21
  • 2