Copy and Paste to remote machine \\hostname\c$
Copy and Paste to remote machine \\hostname\c$
Hi guys, i quite new here.
Would kindly need you guys for help regarding the task im working on it daily
I have to access to the hostname \\hostname\c$
with the hostname based on what i copied and automatically open file explorer and go to the \\hostname\c$
I've tried a few of ways but seems it doesnt work
Thanks for the help guys
Would kindly need you guys for help regarding the task im working on it daily
I have to access to the hostname \\hostname\c$
with the hostname based on what i copied and automatically open file explorer and go to the \\hostname\c$
I've tried a few of ways but seems it doesnt work
Thanks for the help guys
Re: Copy and Paste to remote machine \\hostname\c$
Welcome.
Not sure if these paths gets resolved. Can't test it ATM (iOS). Good luck
Code: Select all
F12:: ; press F12 to run
clipboard := "" ; clearing the clipboard
Send ^c ; sending CTRL+C to copy
ClipWait ; waiting for clipboard to receive content
Run % "explorer.exe " . clipboard ; run explorer with content from clipboard
Return ; reset the Hotkey
Re: Copy and Paste to remote machine \\hostname\c$
Hello, Your codes works but maybe is because of my explanation is not that accurate
Example i have to access to
Hostname : \\PC001\c$
The Text only shown "PC001
is there a way if i copied "PC001" and hit F12
It will automatically open \\PC001\c$ on the windows explorer?
Example i have to access to
Hostname : \\PC001\c$
The Text only shown "PC001
is there a way if i copied "PC001" and hit F12
It will automatically open \\PC001\c$ on the windows explorer?
Re: Copy and Paste to remote machine \\hostname\c$
Perhaps:
Or:
Code: Select all
F12::Run, explorer.exe \\%Clipboard%\c$
Code: Select all
F12::
If Instr(FileExist(dir := "\\" Clipboard "\c$"), "D")
Run, explorer.exe %dir%
Else MsgBox, 48, Error, Directory not found.`n`n%dir%
Return
Re: Copy and Paste to remote machine \\hostname\c$
@seannsp - a quite common way to describe variable parts of a string is to use <>-characters. So \\<hostname>\c$ would indicate that 'hostname' is variable, and in your case should be replaced with the clipboard's content. HTH
Re: Copy and Paste to remote machine \\hostname\c$
The script does open the file explorer but doesnt automatically go the hostname
Is there a way for the clipboards to works?
Is there a way for the clipboards to works?
Re: Copy and Paste to remote machine \\hostname\c$
You can use MsgBox to display the clipboard's contents, so that you know what it is. That can help with troubleshooting.
Re: Copy and Paste to remote machine \\hostname\c$
@mikeyww - Maybe the OP expects that the ^c(opy) - event is/should be part of your script as well, and therefore pressing F12 without having copied anything beforehand…?
Re: Copy and Paste to remote machine \\hostname\c$
Thank you, BoBo, though I noticed:
Leading or trailing white space could also cause problems, easily fixed with a trim.
andbased on what i copied
If the Clipboard is "wrong" or invalid (not a valid path), then it could explain the findings-- hence the suggestion to check & confirm the clipboard.if i copied "PC001" and hit F12
Leading or trailing white space could also cause problems, easily fixed with a trim.
Re: Copy and Paste to remote machine \\hostname\c$
Code: Select all
#12::
Send ^c
run, "file explorer"
sleep 1000
Send ^v
Send {enter}
return
i mean like attach "\\" and "\c$" in between what i copied
Thanks
Re: Copy and Paste to remote machine \\hostname\c$
Code: Select all
F3::
Clipboard =
Send ^c
ClipWait, 0
If ErrorLevel
MsgBox, 48, Error, An error occurred while waiting for the clipboard.
Else Run, % "explorer.exe \\" Trim(Clipboard) "\c$"
Return
Re: Copy and Paste to remote machine \\hostname\c$
Hi Mikey
Thanks for your help all this while
I try ctrl+c and hit F3
it just open file explorer but doesnt go to the hostname\c$
Any idea?
Thanks for your help all this while
I try ctrl+c and hit F3
it just open file explorer but doesnt go to the hostname\c$
Any idea?
Re: Copy and Paste to remote machine \\hostname\c$
The hotkey routine does the clipping for you, so you can skip Ctrl+C.
Re: Copy and Paste to remote machine \\hostname\c$
it just run explorer.exe without inserting \\hostname\c$
Re: Copy and Paste to remote machine \\hostname\c$
How do you know what it is inserting? How do you know what is on your Clipboard? You can add a MsgBox to find out. Post your revised script below.
Re: Copy and Paste to remote machine \\hostname\c$
How do you know what it is inserting? How do you know what is on your Clipboard? You can add a MsgBox to find out. Post your revised script below.
i highlighted the text of the hostname
How to add a msgbox?
[Mod edit: [code][/code] tags added.]
i highlighted the text of the hostname
How to add a msgbox?
Code: Select all
F3::
Clipboard =
Send ^c
ClipWait, 0
If ErrorLevel
MsgBox, 48, Error, An error occurred while waiting for the clipboard.
Else Run, % "explorer.exe \\" Trim(Clipboard) "\c$"
Return
Re: Copy and Paste to remote machine \\hostname\c$
Code: Select all
suffix = \c$
F3::
Clipboard =
Send ^c
ClipWait, 0
If !ErrorLevel ; Clipboard succeeded
If FileExist(netPath := "\\" Trim(Clipboard) suffix) {
MsgBox, 64, Command line, % cLine := "explorer.exe " netPath
Run, %cLine%
} Else MsgBox, 48, Error, Path not found.`n`n%netPath%
Else MsgBox, 48, Error, An error occurred while waiting for the clipboard.
Return