;- Uses ClipboardAll to save (theoretically) any type of valid clipboard ;- data to a shared folder on a local area network. Any station on the ;- LAN may then retrieve the data to it's clipboard. ;- ;- I am finding it quite useful, mostly because I have two boxes connected, ;- and often tend to forget that I can't COPY on one and PASTE on the ohter. ;- Now, I can. ;- ;- This works, but is very much incomplete. Mainly, it should not be used ;- in this form on any LAN where security is an issue. ; ;- And, the main exception to types of data, are actual files. I have moved ;- raw image data, etc. ; ; 01/07/2006 #SingleInstance force Main: If FileExist("netclip.ini") IniRead, FilePath, netclip.ini, Main, filepath Else { FilePath := ChooseFolder() If ! FilePath { MsgBox, Unexpected Error ExitApp } IniWrite,% FilePath, netclip.ini, Main, filepath MsgBox, Thank You. } return ^+9:: fileappend, %ClipBoardAll%, %FilePath%\tmp.clip SoundMsg( ErrorLevel ) return ^+0:: FileRead, Clipboard, *c %FilePath%\tmp.clip SoundMsg( ErrorLevel ) return ChooseFolder() { If filepath return, %filepath% MsgBox, 4131, NetClip Setup, ( Initialization file not found.`n This file tells NetClip which shared folder to use for passing clipboard data.`n This must be the same folder, on the same computer, for any installation on the network which is to be allowed to store and retrieve data.`n To pass data from one station to another, copy the data to the clipboard, then press 'Ctrl-('. The receiving station may then retrieve the data to it's clipboard by pressing 'Ctrl-)'.`n Would you like to select a folder now? Otherwise, NetClip will close.`n ) IfMsgBox, No ExitApp IfMsgBox, Cancel ExitApp FileSelectFolder, filepath, *C:\Documents and Settings\All Users\Documents, 1, If filepath { StringRight, lastchar, filepath, 1 If lastchar = \ StringTrimRight, filepath, filepath, 1 return, %filepath% } Else { If ! ChooseFolder() { MsgBox, 4144, , Exiting..., 3 ExitApp } Else return, %filepath% } } SoundMsg( status ) { If status SoundPlay, *16 Else SoundPlay, *64 return }
LAN Clipboard sharing
Started by
Terrapin
, Jan 07 2006 11:21 AM
7 replies to this topic
This really is some very simple code which does something I've been meaning to get around to, for my own use. Any feedback is appreciated. I have no idea whether there are already free utilities which serve this purpose. Thanks, Bob
#1
-
Posted 07 January 2006 - 11:21 AM
When it comes to Binary, there are 10 types of people. Those who get it and those who don't.
I like the idea. I may use it as well.
I modified it to my style, since your code had some unneccessary lines
- Main:
- to check for an ini file is not need, you can read the key and check the key.
- the first if in the ChooseFolder function will never be true, since the filepath variable is not global and will not be set anyway, since the the functions is only called when the filepath doesn't exist.
- I prefer to use IfMsgBox for the options selected
- If the user doesn't select a correct folder the first time I like to exit the script instead of going recursivly deeper.
I hope you don't mind this critic.
I modified it to my style, since your code had some unneccessary lines
- Main:
- to check for an ini file is not need, you can read the key and check the key.
- the first if in the ChooseFolder function will never be true, since the filepath variable is not global and will not be set anyway, since the the functions is only called when the filepath doesn't exist.
- I prefer to use IfMsgBox for the options selected
- If the user doesn't select a correct folder the first time I like to exit the script instead of going recursivly deeper.
I hope you don't mind this critic.
#SingleInstance force IniRead, FilePath, netclip.ini, Main, filepath If (FilePath <> "ERROR" or FileExist(FilePath) = "") FilePath := ChooseFolder() If FileExist(FilePath) IniWrite, %FilePath%, netclip.ini, Main, filepath Else { MsgBox, You didn't selected`nor the Ini-file didn't contain`nan existing folder.`nScript will exit. ExitApp } return ChooseFolder() { MsgBox, 4131, NetClip Setup, (LTrim Initialization file not found.`n This file tells NetClip which shared folder to use for passing clipboard data.`n This must be the same folder, on the same computer, for any installation on the network which is to be allowed to store and retrieve data.`n To pass data from one station to another, copy the data to the clipboard, then press 'Ctrl-('. The receiving station may then retrieve the data to it's clipboard by pressing 'Ctrl-)'.`n Would you like to select a folder now? Otherwise, NetClip will close.`n ) IfMsgBox, Yes FileSelectFolder, filepath, *C:\Documents and Settings\All Users\Documents, 1, StringRight, lastchar, filepath, 1 If lastchar = \ StringTrimRight, filepath, filepath, 1 Return, %filepath% } ^+9:: fileappend, %ClipBoardAll%, %FilePath%\tmp.clip SoundMsg( ErrorLevel ) return ^+0:: FileRead, Clipboard, *c %FilePath%\tmp.clip SoundMsg( ErrorLevel ) return SoundMsg( status ) { If status SoundPlay, *16 Else SoundPlay, *64 return }
#2
-
Posted 07 January 2006 - 03:40 PM
Ciao
toralf
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.
toralf
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.
I like the idea. I may use it as well.
........
I hope you don't mind this critic.
Thanks Toralf. I meant to thank both you and Chris on thehelp system comments as well, but it got later and later... :oops:
And I don't mind constructive criticism at all. I have been programming on and off for years, but the only real class I ever took was plain old C many years ago. My coding isn't elegant, and I keep switching styles, in spite of trying to get a set style.
Yes, I did know that there was part of the code which never executes, but I didn't notice that first 'if filepath' mistake. I wondered too, about the recursion and whether using it (potentially endlessly) is poor practice.
I guess the real reason I like to check for the existence of the ini file, is simply that it seems to me to make the intent clearer in the code.
I wasn't quite sure what you meant with the IfMsgBox, because I do use that. Ahh, I see you reversed the logic. Probably makes more sense.
The 'Unexpected Error' is more a failsafe than anything, it should never occur, of course.
I wish I knew more about dealing with the network and sharing and privileges, as to how to do it programitcally, but that is not that important. I need to emphasize to whomever may use it, that both the computer and folder used for the clipboard data file must be the same. I would like to set some options as well, such as automatically saving the clipboard each time it changes, deleting the tmp file once it is of no more use, etc. I know I had a bunch of things I wanted to add.
Thanks again!
Bob
#3
-
Posted 07 January 2006 - 04:58 PM
When it comes to Binary, there are 10 types of people. Those who get it and those who don't.
looks real nice..
I wanted to do some thing like that but lack on knowlege and time
however, theres a program That i found usefull :
http://synergy2.sour....net/index.html
its servers the purpose that you a can controll 2 pc's with 1 mouse and kb.
also allows clipbord sharing.
havn't used it yet cuz i only got 1 pc ATM, howeve lots of people liked it.
but perhaps you could write some thing like that as well? which would get Mouse pos and save em in the ini..?
I wanted to do some thing like that but lack on knowlege and time
however, theres a program That i found usefull :
http://synergy2.sour....net/index.html
its servers the purpose that you a can controll 2 pc's with 1 mouse and kb.
also allows clipbord sharing.
havn't used it yet cuz i only got 1 pc ATM, howeve lots of people liked it.
but perhaps you could write some thing like that as well? which would get Mouse pos and save em in the ini..?
#4
-
Posted 11 January 2006 - 08:21 AM
I find this script keeps on not finding the netclip.ini file.
I've placed both the script and the compiled version and the netclip.ini into a directory called c:\extras
But on each time I run the script or the compiled version it keeps asking me to create a new netclip.ini
Perhaps because the script has an error?
should be
One tip I can make is on making the share hidden.
if you add a $ to the end of a share name its invisible.
ie \\server\clipshare$
So you can manually set this up easily enough.
Remember to set the security permissions of this network share to only the people concerned. ie remove the everyone permission!
I've placed both the script and the compiled version and the netclip.ini into a directory called c:\extras
But on each time I run the script or the compiled version it keeps asking me to create a new netclip.ini
Perhaps because the script has an error?
If (FilePath <> "ERROR" or FileExist(FilePath) = "")
should be
If (FilePath = "ERROR" or FileExist(FilePath) = "")
One tip I can make is on making the share hidden.
if you add a $ to the end of a share name its invisible.
ie \\server\clipshare$
So you can manually set this up easily enough.
Remember to set the security permissions of this network share to only the people concerned. ie remove the everyone permission!
#5
-
Posted 25 September 2006 - 03:40 PM
Stuart Halliday
@quatermass:
Good practices for a shared network. I am not that network savvy... I only have my two boxes connected.
@Guest:
Synergy ... I have tried it actually, and find it amazing. But I have a KVM switch also. (Hardware) And, it is far beyond my capabilities.
..and to anyone who cares... I did a similar thing to control winamp without activating the KVM switch, but have no idea where it is now. Just create an empty folder with the name of the key you want to press, and have the client side monitor it, then send %foldername%.
Bob
Good practices for a shared network. I am not that network savvy... I only have my two boxes connected.
@Guest:
Synergy ... I have tried it actually, and find it amazing. But I have a KVM switch also. (Hardware) And, it is far beyond my capabilities.
..and to anyone who cares... I did a similar thing to control winamp without activating the KVM switch, but have no idea where it is now. Just create an empty folder with the name of the key you want to press, and have the client side monitor it, then send %foldername%.
Bob
#6
-
Posted 26 September 2006 - 02:50 AM
For this, I usually use synergy
http://synergy2.sourceforge.net/
does copy stuff across, except images and files..
http://synergy2.sourceforge.net/
does copy stuff across, except images and files..
#7
-
Posted 04 April 2010 - 10:03 AM
::
I Have Spoken
::
I Have Spoken
::
For this, I usually use synergy
http://synergy2.sourceforge.net/
does copy stuff across, except images and files..
Current version of Synergy copies images via the clipboard seamlessly. The latest versions can also drag and drop files across, although last time I checked this was somewhat buggy.
#8
-
Posted 23 December 2013 - 12:01 AM
RegJump() - Jump to registry path in Regedit
HoverScroll() - HoverScroll() - Scroll controls without focus