You need to sign in to do that
Don't have an account?
VN
Uploading files in S-Control
Hi,
I have a requirement to run a batch file from an S-Control.My batch file in turn opens up a text file.
When executed as an HTML page with both the batch file and text file located on the local machine,the code works fine..But while running it as an S-Control in salesforce,it gives me an error..
How can i access the batch file ,once it is uploaded in salesforce?..What will the path with which i refer to it?..Also,i should upload the text file,so that it can be opened by the batch file..
Pls help me to find a solution..
Thanks & Regards,
VN
However, bear in mind that Browsers are generally not able to access files on the local system, execute batch scripts, etc. because if the security issues that would raise. Remember that S-Controls are just Html/Javascript that your local Browser is running.
If your goal is to have a Salesforce S-Control launch a .bat file (or some other executable) that's sitting on your local PC, you're going to find that difficult. Perhaps Microsoft has some sneaky ways around that security restriction if you authorize that domain in your Browser settings, but it would be very specific to IE, and probably not a good way to architect anything.
Best, Steve.
Hi Steve,
I am writing a S-Control which will execute a batch file..The following are the contents of my S-control.
<html>
<title>Home page</title>
<body bgcolor = pink onload="Runbat()">
<center> <h1> <b>Hello test</b></h1></center>
<script type ="text/javascript">
function Runbat()
{
WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("c:/vin.bat");
}
</script>
</body>
</html>
This S-control is executing a batch file,"vin.bat ".The batch file is to open up a text document,"Hello.txt".The following are the contents of the batch file "vin.bat".
start c:/Hello.txt.
When both the .bat file and the .txt file are stored in the local machine(in C drive,as the path specified ..like c:/vin.bat) and the code is executed as an HTML page,it works fine and my batch file opens up the text file.
But when i create an S-Control in salesforce ,the batch file and the .txt file has to be uploaded to salesforce.So the path of the batch file that i should mention in the S-control is the path in which it has been uploaded in salesforce.Also to open my text file,the path of the text file should be mentioned inside the batch file.
What should be the path that i should mention in the S-control to open up my batch file.?
Thanks,
VN
Ok, if you're going to upload both the batch file and the txt file into Salesforce somewhere, then you won't have a Path (because you're not on a filesystem anymore), however you can get a URL for the files.
If you upload the batch file to a Document under a Folder, then you can build the URL for the document. Use:
https://na4.salesforce.com/servlet/servlet.FileDownload?file=01530000000Aps3 where na4.salesforce.com is the appropriate one for your instance, and 0153.... is the id of your Document.
You can either hard code this into the S-Control if you always want the same Document (poor practice), or the S-Control could query the Documents to find the Id of the specific one you want.
Likewise, If you also uploaded the txt file to a Document, then you could build that URL into the batch file that you've previously saved.
As near as I see, the WshShell object is to manipulate files, data, objects, etc. on the local file system, not things retrieved from a remote system via URL. So, I don't think having the URL of the files you've uploaded is going to help.
But, perhaps I'm not understanding what you have in mind. Good luck, Steve.