/build/static/layout/Breadcrumb_cap_w.png

Copy text from a .TXT file and paste it into an active application.

I have a script that will pull the machine name and place it into a text file on a specified directory on the C:\ drive of a computer. I was wondering is there a way to have that computer name within that text file "copied" and "pasted" into an open application. For example copy "COMPUTERNAME123" to installing program blank entry field. I am trying to avoid using sendkeys.


1 Comment   [ + ] Show comment
  • If you type clip /? at the command prompt it shows how to copy the contents of a file to the clipboard. But I don't know of an auto paste command. - flip1001 11 years ago
    • Thanks, you don't know of any script method to take the copy data to an application window though? - 56kGhost 11 years ago

Answers (1)

Posted by: anonymous_9363 11 years ago
Red Belt
0

You can use the Internet Explorer object to access the clipboard. Why bother though, when you can get the machine's name from the environment or WMI? Both are available to VBScript and Powershell (your tags feature both, so we have no clue which it is you're actually going to use).

How you get the text into the application is another question, since we cannot know how the application is "driven". If it has its own object model, there may be a way to get it into a text box (or selected froma  drop-down...whatever) but, if not, SendKeys (or PS equivalent) is the only alternative.


Comments:
  • Well I tagged both because I know I can accomplish the task with either PowerShell or VB, I already can grab the station name the issue is taking that information and inserting it into a field within the install.exe, the exe does not support any sort of INI commands based on what I have and I am not able to do a repack on this one, I need the station name to automatically go from the text file I have the script create into the installing application, it is the standard type windows (COMPANY NAME: abc123) sort of deal. - 56kGhost 11 years ago
  • Why can't you re-package? That route will be considerably shorter - and more reliable - than trying to figure out how to get the installer to play ball. Youwill also then be able to avoid the pain of creating the text file and extracting the computername from it. - anonymous_9363 11 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ