Posted by ananthforu in SWF Studio V3 on Dec 19 2008, 01:26 am

I am trying to load a file from desktop using "ssCore.Shell.execute".

Say for example
ssCore.Shell.execute({path:"C://Program Files//Microsoft Office//Office12//WINWORD.EXE", arguments:"startdir://Check.docx"});
I am running the exe from my desktop. The 'startdir://' takes the relative path of my file (C:\Documents and Settings\Administrator\Desktop) if I display the path using "ssCore.App.showMsgBox" command.

The problem: -
1. Execute command opens the Microsoft word correctly.
2. But it not taking the spaces in between the file path (Documents and Settings).
3. It displays "This file could not be found (C:\Documents.doc)" and so on. This error is repeating for number of spaces available.

The Actual code
//***********************************************
ssCore.init();
ssDefaults.synchronousCommands = true;
ssCore.Shell.execute({path:"C://Program Files//Microsoft Office//Office12//WINWORD.EXE", arguments:"startdir://Check.docx"});
//Both the exe and Check.docx are placed in my Desktop
//***********************************************

Please let me know, how I can solve this issue. I am facing the same issue for other application file opening using the same method.

I have attached some of the error screenshots.

Thanks in advance.

attachments: ErrorLoadingDesktop.zip  


Posted by AGo in SWF Studio V3 on Dec 19 2008, 05:51 am

try this


ssCore.Shell.execute({path:"C:\\Program Files\\Microsoft Office\\Office12\\WINWORD.EXE", arguments:' "startdir://Check.docx" '});


However if you only want to use the default application registered with the file type you better use Shell.invoke instead


Posted by ananthforu in SWF Studio V3 on Dec 19 2008, 08:26 am

Thanks a lot AGo.

Its perfectly working.
Thanks for your timely Help.


Posted by ananthforu in SWF Studio V3 on Jan 19 2009, 12:35 am

Hi AGo,

Sorry to distrub you again.
I have one more doubt. I want ot open the files dynamically. The file naem is coming from variable.
See the example line
The Actual code
//***********************************************
ssCore.init();
ssDefaults.synchronousCommands = true;
ssCore.Shell.execute({path:"C://Program Files//Microsoft Office//Office12//WINWORD.EXE", arguments"startdir://"+fileName});
//***********************************************

This code is working if the exe and supporting file are placed other than Desktop.
How will I add Single Quotes(') in that dynamic link. Then only I can open from desktop.

Thanks in advance
Ananth


Posted by northcode in SWF Studio V3 on Jan 19 2009, 01:21 am

In AGo's example, the ' goes around the ActionScript strings and the " are used to quote the actual argument passed to Shell.execute. If you want to break up the string you're quoting then you can do it like this.


ssCore.init();
ssDefaults.synchronousCommands = true;
ssCore.Shell.execute({path:"C:\\Program Files\\Microsoft Office\\Office12\\WINWORD.EXE", arguments:'"startdir://'+fileName+'"'});
You were missing the colon (:) after arguments in your example.


Posted by mbd in SWF Studio V3 on Jan 19 2009, 10:11 am

You should also be using the path separators as in AGo's code: \ instead of /. The / is not a valid Windows path separator. And you use two \ in a string literal because the \ character is an escape character in Flash string literals. More info here.


Posted by ananthforu in SWF Studio V3 on Jan 20 2009, 06:32 am

Thanks a lot. It works perfect.