Not able to set data in guacamole clipboard - guacamole

I am using Apache Guacamole library in our project for rendering Windows VM in web browser.
For Clipboard integration I need to transfer clipboard content from Local System to remote VM (guacamole Clipboard) and vice versa.
I am able to get the clipboard content of remote VM using the guacamole onclipboard event. But I am unable to send Local System clipboard content to remote VM (Guacamole clipboard).I am using createClipboardStream() API for setting data to guacamole clipboard but I am not getting any data in remote VM clipboard.
Please find the code snippet as below -
Guacamole API reference -
https://guacamole.apache.org/doc/0.9.2/guacamole-common-js/symbols/Guacamole.Client.html#createClipboardStream
// sending Local System Clipboard content to Remote VM (Guacamole Clipboard)
function setGuacamoleClipboard(data) {
var stream = guac.createClipboardStream("text/plain");
var writer = new Guacamole.StringWriter(stream);
for (var i=0; i<data.length; i += 4096){
writer.sendText(data.substring(i, i+4096));
}
writer.sendEnd();
}
I have also tried below Java code for setting guacamole clipboard using writeInstruction().This approach also did not work for me
tunnel.getSocket().getWriter().writeInstruction(new GuacamoleInstruction("clipboard","text/plain","Welcome Guacamole clipboard"));
Am I missing anything ?

Related

CopyFile() copy from network drive to local drive in windows 10

I'm using Rad Studio for running C++ in window 10.
I've been trying to copy a file from network drive to local drive.
When I tried to copy a file from local to local, it worked!
But when I tried to copy a file from server or mapped driver(Z:),
there are no error, not copied.
So it's hard to find the problem.
I guess that most do need some sort of authentication.
but I'm still stuck with it.
Here is my code.
String source = L"\\\\sever1\\Data\\program1.exe"; // Server to Local : result==> Not copied, no error.
// What I tried to test.
// String source = L"E:\\file1\\083\\program1.exe"; //Local to Local : result==> It works!
// String source = L"Z:\\program1.exe"; //mapped driver : result==> Not copied, no error.
String destination = L"C:\\Our Programs\\program1.exe";
result = CopyFile( source.w_str(), destination.w_str(), true);

how to open local html file with MS edge

I have local html files that my program produce.
How can i open these local html files from command line with MS Edge?
For MS InterbetExplorer I have (working) command like (%f is path to html):
{pathToExplorerExecutable}"file:///%f"
For MS Edge I found executable in C:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe, but when I try same command, that I use for IE, nothing happens.
I also tried command: start microsoft-edge:file///%f still did not work.
Is there any way to open local file in MS Edge from command line?
In case of Edge Browser it is:
start shell:AppsFolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge file:///C:/test.html
Where is that Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge value from?
That value is in format [PackageFamilyName]![ApplicationID].
It can be found in the AppManifest.xml of Edge browser or via regitry (if Edge is set as the default webbrowser):
Get default webbrowser from the ProgId value of registry key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html\UserChoice
The value will be AppX4hxtad77fbk3jkkeerkrm0ze94wjf3s9 in case of Edge.
Take that ProgId value to open the following key:
HKEY_CLASSES_ROOT\[ProgId]\Application
or
HKEY_USERS\[CurrentUserID]_Classes\[ProgId]\Application
So in case of Edge, open HKEY_CLASSES_ROOT\AppX4hxtad77fbk3jkkeerkrm0ze94wjf3s9\Application.
Read the value of AppUserModelID.

How can I locate a file to use with the system/child_process API within a Firefox add-on?

I would like to write a Firefox add-on that communicates with a locally installed program to exchange data. It looks like this can be done using either js-ctypes or the low-level system/child_process API, with the latter being the recommended solution.
The child_process API appeals because it sends and receives data abstractly over a pipe rather than directly at the C interface level. However, to use it you need (it seems) to supply the full path to the executable within your code:
var child_process = require("sdk/system/child_process");
var ls = child_process.spawn('/bin/ls', ['-lh', '/usr']);
In my case, the executable is installed by another application and we don't know it's exact location - it will differ according to OS, the user's drives, and possibly the user's preference. I imagine this problem will be common to most executables that are not built in to the OS. So my question is: what means do I have to locate the full path of the executable I want to use? I will need to support multiple OSes but presumably could have different solutions for each if needed.
Thanks!
Here's the code I used on Windows - the key was being able to read an environment variable to find the location of the appropriate application folder. After that I assume that my application is stored under a well-known subpath (we don't allow customization of it).
var system = require("sdk/system");
var iofile = require('sdk/io/file');
var child_process = require('sdk/system/child_process');
var progFilesFolder = system.env["programfiles(x86)"],
targetFile = iofile.join(progFilesFolder, 'FolderName', 'Program.exe');
targetFileExists = iofile.exists(targetFile);
if (targetFileExists) {
var p = child_process.spawn(targetFile);
}
I haven't written the code for Mac yet but I expect it to be similar, with the difference being that there are no drive letters to worry about and the system folders in OS X have standard names (even on localized systems).

Upload document from local machine to server without using file input type

We are trying to upload a document from our local machine to server. We know that .NET browse control can be used for this but our requirement is to just have a button and call that as "Save Document". On click we know the path and also the document name, all we need to do is search the document in local machine (inside temp folder) and if the document is available then pick it and save it to our APP data folder on the server.
it's easy to achieve this using .NET borwse control but not sure how to do that same using normal button?
To find a file in a folder:
FileInfo file = Directory.GetFiles(#"c:\folder")
.FirstOrDefault(f => f.name = whatever);
To copy file:
File.Copy(file.FullName, targetPath, true);

Copying file from local to SharePoint server location

Now on my PC I can use explorer to open a location on our SP server (location eg http://sp.myhost.com/site/Documents/). And from there I can copy/paste a file from eg my C:\ drive.
I need to replicate the copy process progmatically. FileCopy() doesn't do it - seems to be the http:// bit that's causing problems!
Does the server allow WebDAV access? If yes, there are WebDAV clients for Delphi available, including Indy 10.
In case if you are not using BLOB storage all SharePoint files are stored in the database as BLOB objects.
When you access your files with explorer you are using windows service which is reading files from SharePoiont and render it to you. This way you can copy and paste as soon as donwload them from an to SharePoint manually.
To be able to do this automatically you should achive this using the next SP API code:
using (SPSite site = new SPSite("http://testsite.dev"))
{
using (SPWeb web = site.OpenWeb())
{
using (FileStream fs = File.OpenRead(#"C:\Debug.txt"))
{
byte[] buffer = new byte[fs.Length];
fs.Read(buffer, 0, (int) fs.Length);
SPList list = web.GetList("Lists/Test AAD");
SPFile f = list.RootFolder.Files.Add("/Shared Documents/"+Path.GetFileName(fs.Name), buffer);
}
}
}
This will add new "Debug.txt" file to the "Shared Documents" library read from the disk C. To do this for each file just loop through each file in the folder. You can open web only once and do the loop each time when you add file...
Hope it helps,
Andrew

Resources