![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Paste data on clipboard into Internet Explorer form field I have the code to launch a specific webpage with one field. I have the code to store the required data on the clipboard. What I don't have is an effective way to paste the data into the form field. Example: --------------------------------- $ie = New-Object -com InternetExplorer.Application $ie.navigate(<URL>) $ie.visible = $true ## Code here that reads a text file and parses data # The following command stops me cold. $ie.ExecWB(13,2) #should paste clipboard data into field. If I walk my program line by line (ie: enter by hand), then the data gets pasted. As part of a function, an error is thrown. Thanks Extech |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Paste data on clipboard into Internet Explorer form field eXtech wrote: Quote: > I have the code to launch a specific webpage with one field. > I have the code to store the required data on the clipboard. > > What I don't have is an effective way to paste the data into the form field. > > Example: > --------------------------------- > $ie = New-Object -com InternetExplorer.Application > $ie.navigate(<URL>) > $ie.visible = $true > > ## Code here that reads a text file and parses data > > # The following command stops me cold. > $ie.ExecWB(13,2) #should paste clipboard data into field. > > If I walk my program line by line (ie: enter by hand), then the data gets > pasted. As part of a function, an error is thrown. > > Thanks > Extech http://scriptolog.blogspot.com/2007/...web-forms.html Marco -- Microsoft MVP - Windows PowerShell http://www.microsoft.com/mvp PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Paste data on clipboard into Internet Explorer form field On Dec 10, 12:23 pm, "Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com> wrote: Quote: > eXtech wrote: Quote: > > I have the code to launch a specific webpage with one field. > > I have the code to store the required data on the clipboard. Quote: > > What I don't have is an effective way to paste the data into the form field. Quote: > > Example: > > --------------------------------- > > $ie = New-Object -com InternetExplorer.Application > > $ie.navigate(<URL>) > > $ie.visible = $true Quote: > > ## Code here that reads a text file and parses data Quote: > > # The following command stops me cold. > > $ie.ExecWB(13,2) #should paste clipboard data into field. Quote: > > If I walk my program line by line (ie: enter by hand), then the data gets > > pasted. As part of a function, an error is thrown. Quote: > > Thanks > > Extech > This *might* help:http://scriptolog.blogspot.com/2007/...web-forms.html > > Marco > > -- > Microsoft MVP - Windows PowerShellhttp://www.microsoft.com/mvp > > PowerGadgets MVPhttp://www.powergadgets.com/mvp > > Blog:http://marcoshaw.blogspot.com- Hide quoted text - > > - Show quoted text - $ie = New-Object -ComObject InternetExplorer.Application $ie.visible=$true $ie.navigate("www.Google.com") ($ie.Document.GetElementByID("q")).Value='Blah Blah Blah' Check your explorer and you will see the text pasted into the search field. If you wonder where the "q" came from just view source on the web page and search for <input type="text" Within the INPUT tag look for the ID="" filed and use that ID. Hope that helps. |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Paste data on clipboard into Internet Explorer form field On Dec 10, 3:08 pm, Kuma <kumasa...@xxxxxx> wrote: Quote: > On Dec 10, 12:23 pm, "Marco Shaw [MVP]" > > > > > > <marco.shaw@_NO_SPAM_gmail.com> wrote: Quote: > > eXtech wrote: Quote: > > > I have the code to launch a specific webpage with one field. > > > I have the code to store the required data on the clipboard. Quote: Quote: > > > What I don't have is an effective way to paste the data into the form field. Quote: Quote: > > > Example: > > > --------------------------------- > > > $ie = New-Object -com InternetExplorer.Application > > > $ie.navigate(<URL>) > > > $ie.visible = $true Quote: Quote: > > > ## Code here that reads a text file and parses data Quote: Quote: > > > # The following command stops me cold. > > > $ie.ExecWB(13,2) #should paste clipboard data into field. Quote: Quote: > > > If I walk my program line by line (ie: enter by hand), then the data gets > > > pasted. As part of a function, an error is thrown. Quote: Quote: > > > Thanks > > > Extech Quote: > > This *might* help:http://scriptolog.blogspot.com/2007/...web-forms.html Quote: > > Marco Quote: > > -- > > Microsoft MVP - Windows PowerShellhttp://www.microsoft.com/mvp Quote: > > PowerGadgets MVPhttp://www.powergadgets.com/mvp Quote: > > Blog:http://marcoshaw.blogspot.com-Hide quoted text - Quote: > > - Show quoted text - > Quick example. > > $ie = New-Object -ComObject InternetExplorer.Application > $ie.visible=$true > $ie.navigate("www.Google.com") > ($ie.Document.GetElementByID("q")).Value='Blah Blah Blah' > > Check your explorer and you will see the text pasted into the search > field. If you wonder where the "q" came from just view source on the > web page and search for <input type="text" Within the INPUT tag look > for the ID="" filed and use that ID. Hope that helps.- Hide quoted text - > > - Show quoted text - Clipboard cmdlet. $text = Get-Clipboard ($ie.Document.GetElementByID("q")).Value=$text Sorry about that. |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Paste data on clipboard into Internet Explorer form field "Kuma" wrote: Quote: > Quick example. > > $ie = New-Object -ComObject InternetExplorer.Application > $ie.visible=$true > $ie.navigate("www.Google.com") > ($ie.Document.GetElementByID("q")).Value='Blah Blah Blah' > > Check your explorer and you will see the text pasted into the search > field. If you wonder where the "q" came from just view source on the > web page and search for <input type="text" Within the INPUT tag look > for the ID="" filed and use that ID. Hope that helps. This is the error I get: You cannot call a method on a null-valued expression. At $profile:61 char:30 + ($ie.Document.GetElementByID( <<<< "H1")).Value=$bc |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Paste data on clipboard into Internet Explorer form field Extech, The page elements might not be available because the didn't load already. Use $ie.busy (or ReadyState) to detect if the page finished loading and then try to set the element value: $ie.navigate(<URL>) #while($ie.ReadyState -ne 4) {sleep 1} while($ie.busy) {sleep 1} $ie.Document.GetElementByID("H1").Value=$bc ----- Shay Levi $cript Fanatic http://scriptolog.blogspot.com Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic Quote: > I have the code to launch a specific webpage with one field. I have > the code to store the required data on the clipboard. > > What I don't have is an effective way to paste the data into the form > field. > > Example: > --------------------------------- > $ie = New-Object -com InternetExplorer.Application > $ie.navigate(<URL>) > $ie.visible = $true > ## Code here that reads a text file and parses data > > # The following command stops me cold. > $ie.ExecWB(13,2) #should paste clipboard data into field. > If I walk my program line by line (ie: enter by hand), then the data > gets pasted. As part of a function, an error is thrown. > > Thanks > Extech |
My System Specs![]() |
| | #7 (permalink) |
| | Re: Paste data on clipboard into Internet Explorer form field I figured it out. It has to do with the ReadyState. ReadyState must be equal to 4 before pasting any data to form elements. Thanks |
My System Specs![]() |
| | #8 (permalink) |
| | Re: Paste data on clipboard into Internet Explorer form field eXtech;1428273 Wrote: Quote: > I figured it out. It has to do with the ReadyState. ReadyState must > be > equal to 4 before pasting any data to form elements. > > Thanks I am trying almost the same. while($ie.ReadyState -ne 4) {start-sleep -Milliseconds 100} but the execution repeats here, $ie.ReadyState never becomes ready. Running Vista .NET 3.5. running it in the PowerShell Plus. What would be the cause ? pjo -- pjo http://www.techtalkz.com - Technology and Computer Troubleshooting Forums |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Data Execution Prevention Error in Internet Explorer | Vista security | |||
| Clipboard Vitual PC 2007 Can't paste | Virtual PC | |||
| When I try to paste into internet explorer-stops working | Vista performance & maintenance | |||
| internet explorer blocks printing form | Vista security | |||
| Internet Explorer form fill-in setting? | Vista General | |||