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

Comments

  • 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.
    • Thanks, you don't know of any script method to take the copy data to an application window though?
Please log in to comment

Answers

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.

Answered 09/07/2013 by: VBScab
Red Belt

  • 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.
  • 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.
Please log in to comment
Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja

Share