New topic: 

WEB APP CGI Save webfile/file on client side

<http://forums.realsoftware.com/viewtopic.php?t=43915>

         Page 1 of 1
   [ 3 posts ]                 Previous topic | Next topic          Author  
Message        HONOLULU          Post subject: WEB APP CGI Save webfile/file on 
client sidePosted: Mon May 07, 2012 1:34 pm                         
Joined: Sat May 05, 2012 7:44 pm
Posts: 2
Location: Sweden / MALMÖ                Hello  
I wonder if it is possible to run a webfile on client side, i mean to save it 
automaticly on the harddrive of the client and then call it, i made a dynamic 
file.vbs script but it runs on the server side. The WE app save it on the 
server desktop and then call it by the Shell function. it realy works fine but 
the problem is to run it on each client visit the App. I have the 
administration rights on all clients who will visit the app.
My solution now is to download the file but the browser ask the user want to 
save or open it. if open the the script runs. This is not good. i do not want 
the user to se what happens on the backgroud.
Sorry for my bad english. 
Thanks for help!   
                             Top                HONOLULU          Post subject: 
Re: WEB APP CGI Save webfile/file on client sidePosted: Mon May 07, 2012 1:53 
pm                         
Joined: Sat May 05, 2012 7:44 pm
Posts: 2
Location: Sweden / MALMÖ                Here is the code.

'This solution save the file on the desktop of the server and then call it buy 
the SHELL.

  
 
  Dim f as FolderItem = SpecialFolder.Desktop.Child("File.vbs")
  
  
  If f <> nil then
  Try
    'The VBS-File contents.
    Dim t as TextOutputStream = TextOutputStream.Create(f)
    t.WriteLine ConvertEncoding("set WshShell = 
WScript.CreateObject(""WScript.Shell"")", Encodings.WindowsANSI)
    t.WriteLine ConvertEncoding("WshShell.run ""runas xxxxxxxSomething to 
runxxxxx""""""", Encodings.WindowsANSI)
    t.WriteLine ConvertEncoding("wscript.sleep 1000", Encodings.WindowsANSI)
    t.WriteLine ConvertEncoding("WshShell.SendKeys ""Password""", 
Encodings.WindowsANSI)
    t.WriteLine ConvertEncoding("WshShell.SendKeys ""{ENTER}""", 
Encodings.WindowsANSI)
    t.WriteLine ConvertEncoding("wscript.sleep 1000", Encodings.WindowsANSI)
    t.WriteLine ConvertEncoding("set wshell = nothing", Encodings.WindowsANSI)
    
    ' Delete the VBS file after runing
    t.WriteLine ConvertEncoding("Set objFSO = 
CreateObject(""Scripting.FileSystemObject"")", Encodings.WindowsANSI)
    t.WriteLine ConvertEncoding("strScript = Wscript.ScriptFullName", 
Encodings.WindowsANSI)
    t.WriteLine ConvertEncoding("objFSO.DeleteFile(strScript)", 
Encodings.WindowsANSI)
    
    t = nil
    sleep (2000)
    cmd = f.AbsolutePath
    s.Execute cmd
    
    'Catch err as IOException
    
    //handle
  End try
  End if

******************************************

  
'Here is the solution for download.

If textfile = nil then

   textfile = new webfile
   textfile.mimetype = "text/plain"
   textfile.forcedownload =true
   textfile.filename = "file.vbs"
  
  'Here i will fill the content of the vbs file.
   textfile.data = "msgbox ""hello """
  
  
  textfile.ondownloaded = WeakAddressOf FileDownloaded
 
  end
  
ShowURL(TextFile.URL)   
                             Top                Bob Keeney          Post 
subject: Re: WEB APP CGI Save webfile/file on client sidePosted: Mon May 07, 
2012 1:56 pm                                 
Joined: Fri Sep 30, 2005 11:48 am
Posts: 2993
Location: Lenexa, KS                You are limited by what the browser lets 
you do.  You can download a file using WebFile but after that (once it gets on 
their machine) the user has to initiate the action.  Now, if you were to 
download a small (relative to RB that is) executable and have the user start it 
you could do that but nothing automatically that I'm aware of.

I suppose there is some JavaScript that could run on the client but, again, 
it's not built-in to Real Studio Web Edition.      
_________________
Bob K.

30+ hours of Real Studio Video Training (including over 6 hours of Web Edition) 
at http://www.bkeeney.com/
Real Studio Consulting http://www.bkeeney.com/consulting/real-studio-consulting 
     
BKeeney Briefs Blog For Real Studio Developers http://www.bkeeneybriefs.com/  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 3 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to