We appreciate the contributions many of you have been able to make towards repairing the storm damage and keeping a roof over our heads. With your help we’ve been able to complete much of the critical work. There is still work to be done to secure the house and your continued support will be a huge help.
Guests have read-only access to our forums. If you wish to participate you will need to register. Be sure to activate your account from the email sent to you when you register.
Trying to setup a button to copy the hostname to the clipboard without having a popup window. So far via powershell or cmd a window will appear for a second then go away. I'm trying to see if there is a way to prevent the window from showing up.
I did try using the page option, but I'm still new and I've yet to figure out how to get it to flip back to page 1. This method did prevent the popup window. But, now it is stuck on page 2 which is currently blank.
post what you have.Trying to setup a button to copy the hostname to the clipboard without having a popup window. So far via powershell or cmd a window will appear for a second then go away. I'm trying to see if there is a way to prevent the window from showing up.
I did try using the page option, but I'm still new and I've yet to figure out how to get it to flip back to page 1. This method did prevent the popup window. But, now it is stuck on page 2 which is currently blank.
[options]
bottom=30
right=20
height=200
transparency=50
width=300
[items]
set White = #ffffff
set Blue = #00ffff
HOST=set:hostname,hidden:1
COMMENT=xr:20,yb:125,align:r,font-size:150%,fill-color:%black%,display:Computer Name: %hostname%
UPTIME=xr:20,yb:100,align:r,internal:1,set:uptime,font-size:150%,display:Last Boot Time: %1d :%2h :%3m :%4s
BUTTON=xr:20,yb:75,align:r,wide:1,width:100,display:Help Desk,uri: https://redacted
BUTTON=xr:20,yb:40,align:r,wide:1,width:150,display:Get Computer Name,uri:c:\temp\di\gethostname.cmd
Contents of gethosetname.cmd:
# 2> nul & powershell.exe -ExecutionPolicy Bypass -NoProfile -Command "[scriptblock]::Create((Get-Content -LiteralPath '%~f0' -Raw)).Invoke()" #& EXIT /B
# Hides PowerShell Console
Add-Type -Name Window -Namespace Console -MemberDefinition '
[DllImport("Kernel32.dll")]
public static extern IntPtr GetConsoleWindow();
[DllImport("user32.dll")]
public static extern bool ShowWindow(IntPtr hWnd, Int32 nCmdShow);
'
$consolePtr = [Console.Window]::GetConsoleWindow()
[Console.Window]::ShowWindow($consolePtr, 0)
Add-Type -AssemblyName System.Windows.Forms
hostname | set-clipboard
that looks really complicated 🙂
try this:
CMD=id:cmditem,file:cmd.exe, parameters:/c hostname|clip, hidden:1
BUTTON=display:TEST, uri:{item}, args:cmditem
Thanks! Your way is much better!
