Posted by baoputzi in SWF Studio V3 on Jan 15 2008, 09:26 am

the following command gives an error:
unknown verb or verb not registered for the specified document or extension

var r = ssCore.Shell.invoke({path:"./"+file, width:contentW, height:contentH, x:appX,y:appY, waitForWindow:true, forceChild:true});

ist works perfectly for the pps extension. Doubleclick on the file in Vista does launch PowerPoint 2007 whichis correct.

THX for any help with that issue.

How can I get verbs for an application?


Posted by mbd in SWF Studio V3 on Jan 15 2008, 10:01 am

The verbs can be found in the registry (that's where SWF Studio looks them up). If you just want to see what the default verb is, right-click on the file in Windows explorer. The default verb should be in bold - the action taken when you double-click the file. For PPS files it's play. If you don't specify a verb, SWF Studio will use open, which probably won't work for PPS or PPSX files.

There is also a problem with your path. You are specifying ./ in the path, which might work on your system, but isn't guaranteed to work at all.

We seem to be preaching this a lot on the forums lately, but the / character is not a valid character in a Windows path. The \ character is the proper folder separator.

Your path should be: path:"startdir://"+file. Assuming "file" contains the proper characters as well.


Posted by baoputzi in SWF Studio V3 on Jan 15 2008, 10:58 am


QUOTE: from mbd;42633
The verbs can be found in the registry (that's where SWF Studio looks them up). If you just want to see what the default verb is, right-click on the file in Windows explorer. The default verb should be in bold - the action taken when you double-click the file. For PPS files it's play. If you don't specify a verb, SWF Studio will use open, which probably won't work for PPS or PPSX files.

There is also a problem with your path. You are specifying ./ in the path, which might work on your system, but isn't guaranteed to work at all.

We seem to be preaching this a lot on the forums lately, but the / character is not a valid character in a Windows path. The \ character is the proper folder separator.

Your path should be: path:"startdir://"+file. Assuming "file" contains the proper characters as well.


thank you - yesI checked the paths and changed to for example "contentA\\ChartsA.pps" in the xml file and also the "./" is changed to "startdir://" . On Issue I have with paths is taht the path to an flv for example

myVideoPlayer.contentPath = "startdir://" + "videos\\videoA.flv" does not work whereas "videos/videoA.flv" works. This will lead to some missuse by custoers filling the XML. But I saw your filesys plugin and will try to write some code to detect the contents in a folder and then load them into the swf, recognize the extension and start the appropriate application which will be much easier for the user as he has not to deal with different file paths in the xml. But first of all I have to get this powerpoint, and wmv stuff to work correct and reproducable.


Posted by mbd in SWF Studio V3 on Jan 15 2008, 11:45 am


QUOTE:
yesI checked the paths and changed to for example "contentA\\ChartsA.pps" in the xml file
Don't change content from an XML file. Check this blog post about the difference between string literals vs. string values.

For FLV files you don't have to change the path separators. The \ and / issue is for SWF Studio commands, since paths are passed along to Windows without changes (except for file monikers like startdir://). With Flash commands the Flash Player takes care of resolving paths.

You also shouldn't have a problem with the path you specified for playing FLVs. While the Flash Player has no idea what startdir:// is, the SWF Studio API overwrites some base ActionScript commands (like NetStream.play, which contentPath eventually calls) and resolves file monikers. It also alters paths, so the / in your contentPath is really becoming \ by the time the Flash Player sees it. It's possible that the above string literal/value issue is to blame.

The exceptions to the above are when you load a SWF remotely and if you're using AS3. In AS3 we can't overwrite the base classes and remotely loaded SWFs don't share _global (where the API is located).

What version of SWF Studio are you using?


Posted by baoputzi in SWF Studio V3 on Jan 15 2008, 12:57 pm


QUOTE: from mbd;42644
Don't change content from an XML file. Check this blog post about the difference between string literals vs. string values.

For FLV files you don't have to change the path separators. The \ and / issue is for SWF Studio commands, since paths are passed along to Windows without changes (except for file monikers like startdir://). With Flash commands the Flash Player takes care of resolving paths.

You also shouldn't have a problem with the path you specified for playing FLVs. While the Flash Player has no idea what startdir:// is, the SWF Studio API overwrites some base ActionScript commands (like NetStream.play, which contentPath eventually calls) and resolves file monikers. It also alters paths, so the / in your contentPath is really becoming \ by the time the Flash Player sees it. It's possible that the above string literal/value issue is to blame.

The exceptions to the above are when you load a SWF remotely and if you're using AS3. In AS3 we can't overwrite the base classes and remotely loaded SWFs don't share _global (where the API is located).

What version of SWF Studio are you using?


now I use V3.5 and in the xml the value isfor example:
PPSTitle

that worked equaly to

PPSTitle

in the fla with AS2 I added "startdir://" + filePath to the ssCore stuff and nothing to the swf stuff.

I hope you are d'accord with that


Posted by baoputzi in SWF Studio V3 on Jan 15 2008, 01:41 pm


QUOTE: from baoputzi;42645
now I use V3.5 and in the xml the value isfor example:
PPSTitle

that worked equaly to

PPSTitle

in the fla with AS2 I added "startdir://" + filePath to the ssCore stuff and nothing to the swf stuff.

I hope you are d'accord with that


How can I find the right verb. for example on my german system if I right click on a pps or ppsx the firts bold entry say "Einblenden" which is german for fade in :) . Using that as verb does bring up an error. So does verb:"open" verb:"show" verb:"play"

next I tried the example with the jsscript but I did not came further as opening Powerpoint without loading the file. Stuck a little.
this is th jscript function
function main()
{
var app = new ActiveXObject("PowerPoint.Application");
app.visible = true;
app.Presentations.Open("Inhalte_RednerA\charts.ppt",false, false, false);
app.Presentations.SlideShowSettings.ShowType = ppShowTypeWindow;
app.Presentations.SlideShowSettings.Left = 656;
app.Presentations.SlideShowSettings.Top = 150;
app.Presentations.SlideShowSettings.Width = 1024;
app.Presentations.SlideShowSettings.Height = 768;

}


Posted by northcode in SWF Studio V3 on Jan 15 2008, 02:17 pm

If you leave out the verb for Shell.open, Windows will choose the default verb. That should work, but it won't give you the control you need over the size of the window.

If you leave out the verb for Shell.invoke, SWF Studio tries to determine the default (bold) verb but it doesn't get the correct verb for PPS files. It should get "show" but it gets "open" instead. I have to take a closer look at this.

The default verb for PPSX files is open, so leaving the verb blank for PPSX should be okay.

If you're interested, Verbs and File Associations describes how the Windows shell invokes verbs.


Posted by baoputzi in SWF Studio V3 on Jan 15 2008, 05:15 pm


QUOTE: from northcode;42656
If you leave out the verb for Shell.open, Windows will choose the default verb. That should work, but it won't give you the control you need over the size of the window.

If you leave out the verb for Shell.invoke, SWF Studio tries to determine the default (bold) verb but it doesn't get the correct verb for PPS files. It should get "show" but it gets "open" instead. I have to take a closer look at this.

The default verb for PPSX files is open, so leaving the verb blank for PPSX should be okay.

If you're interested, Verbs and File Associations describes how the Windows shell invokes verbs.


Ok Thank you I will have a look for these verbs. For now Shell.invoke opens the pps and positiones it nicely but you always see the undelaying ppt opening. And ppsx are not opend at all.


Posted by baoputzi in SWF Studio V3 on Jan 16 2008, 06:43 am

On Vista 32 with powerpoint 2007 installed a pps loads via Shell.invoke which I use as I need to set w,h,x,y parameters.
On Vista64 when loading the pps ->Powerpoint 2007 crashes and nothing is loaded.

ppsx are not loaded at all. Nor in Vista32 nor in Vista64
As this is essential for my customer does anybody know how to handle pps && || ppsx -files I checked the verbs but open, show, run did not work. right click on the files give me a "Einblenden" for the German OS if I pass this verb nothing happens at all except the error trace for wrong verb...

thx for any help


Posted by mbd in SWF Studio V3 on Jan 16 2008, 09:33 am

I know Tim and Dan both mentioned this in another thread, so just to be consistent:

This line in your JScript code:
app.Presentations.Open("Inhalte_RednerA\charts.ppt",false, false, false);

should be:
app.Presentations.Open("C:\\Inhalte_RednerA\\charts.ppt",false, false, false);

Note the \\ and full path. You are opening the control from your application, but the control probably doesn't know where your application started from. You probably need to give the ActiveX control a full path.

If you are building an AS1/AS2 project (as opposed to an AS3 project), then in JScript you can use this to get ssGlobals.ssStartDir to use for the path:

var startdir = Flash.getVar({variable:"global.ssGlobals.ssStartDir"});

app.Presentations.Open(startdir+"\\Inhalte_RednerA\\charts.ppt",false, false, false);

Note: it's not a typo that I used global instead of _global. When you want to reference _global from one of our JScript methods use "global" instead.

And in your XML:
PPSTitle

should be:
PPSTitle

A couple of simple rules:

1. When you type \ between quotes double it. When you type \ in an external file don't double it.

2. You can use / for Flash's native commands (MovieClip.loadMovie, XML.load, etc.), but for SWF Studio API commands, use \ and absolute paths.

Try a simple FLA that just has a button and the code to open the PPS/PPSX files. Simplify the approach and get that to work. If Shell.invoke doesn't work with verb:"show", then try using ssCore.Shell.open. Let us know if that works for you or not.


Posted by baoputzi in SWF Studio V3 on Jan 16 2008, 10:47 am


QUOTE: from mbd;42682
I know Tim and Dan both mentioned this in another thread, so just to be consistent:

This line in your JScript code:
app.Presentations.Open("Inhalte_RednerA\charts.ppt",false, false, false);

should be:
app.Presentations.Open("C:\\Inhalte_RednerA\\charts.ppt",false, false, false);

Note the \\ and full path. You are opening the control from your application, but the control probably doesn't know where your application started from. You probably need to give the ActiveX control a full path.

If you are building an AS1/AS2 project (as opposed to an AS3 project), then in JScript you can use this to get ssGlobals.ssStartDir to use for the path:

var startdir = Flash.getVar({variable:"global.ssGlobals.ssStartDir"});

app.Presentations.Open(startdir+"\\Inhalte_RednerA\\charts.ppt",false, false, false);

Note: it's not a typo that I used global instead of _global. When you want to reference _global from one of our JScript methods use "global" instead.

And in your XML:
PPSTitle

should be:
PPSTitle

A couple of simple rules:

1. When you type \ between quotes double it. When you type \ in an external file don't double it.

2. You can use / for Flash's native commands (MovieClip.loadMovie, XML.load, etc.), but for SWF Studio API commands, use \ and absolute paths.

Try a simple FLA that just has a button and the code to open the PPS/PPSX files. Simplify the approach and get that to work. If Shell.invoke doesn't work with verb:"show", then try using ssCore.Shell.open. Let us know if that works for you or not.


Dear Derek

thank you again for beeig patient I will follow up. But I dont think it is a path problem as for example pps is loaded in a 32bit Vista and I use the path rules but I will follow up again.


Posted by baoputzi in SWF Studio V3 on Jan 16 2008, 11:15 am


QUOTE: from mbd;42682
I know Tim and Dan both mentioned this in another thread, so just to be consistent:

This line in your JScript code:
app.Presentations.Open("Inhalte_RednerA\charts.ppt",false, false, false);

should be:
app.Presentations.Open("C:\\Inhalte_RednerA\\charts.ppt",false, false, false);

Note the \\ and full path. You are opening the control from your application, but the control probably doesn't know where your application started from. You probably need to give the ActiveX control a full path.

If you are building an AS1/AS2 project (as opposed to an AS3 project), then in JScript you can use this to get ssGlobals.ssStartDir to use for the path:

var startdir = Flash.getVar({variable:"global.ssGlobals.ssStartDir"});

app.Presentations.Open(startdir+"\\Inhalte_RednerA\\charts.ppt",false, false, false);

Note: it's not a typo that I used global instead of _global. When you want to reference _global from one of our JScript methods use "global" instead.

And in your XML:
PPSTitle

should be:
PPSTitle

A couple of simple rules:

1. When you type \ between quotes double it. When you type \ in an external file don't double it.

2. You can use / for Flash's native commands (MovieClip.loadMovie, XML.load, etc.), but for SWF Studio API commands, use \ and absolute paths.

Try a simple FLA that just has a button and the code to open the PPS/PPSX files. Simplify the approach and get that to work. If Shell.invoke doesn't work with verb:"show", then try using ssCore.Shell.open. Let us know if that works for you or not.


Dear Derek

thank you again for beeig patient .
But I dont think it is a path problem for the xml it doesnt matter if it is \ or / as these are loaded and parsed via flash.

for the pps

this is opened with Shell.invoke and and Shell.open and handels without problem on 32bit System I only have issues on Vist64bit but this is not really thus important. Also forceChild works well.

for the ppsx

this opens only with Shell.open and not providing a verb. Shell.invoke does always result in an unknown verb error whatever I use ("open","show","run","open7". But I need the Shell invoke in order to use the forceChild and x,y, w,h arguments on that files.

next I will try to check that jscript stuff

thx again


Posted by mbd in SWF Studio V3 on Jan 16 2008, 11:19 am

Hi baoputzi,

QUOTE:
But I dont think it is a path problem for the xml it doesnt matter if it is \ or / as these are loaded and parsed via flash.
You're misunderstanding how this works. Yes Flash will load the XML file, but it doesn't change \\ to \. If you enter / or \ or \\ in the XML file, that is EXACTLY what will be used in your path. Flash will not convert anything in the XML.load process. The problem then is that if you use / or \\ in the path and pass that to a SWF Studio command, SWF Studio will pass that along to the Windows commands and it could possibly fail.

Please look at the two simple rules for entering the \ versus / characters I posted above. And please follow that advice. We really do know what we're talking about.

On a side note, you don't need to use the quote button when you reply to posts. If you want to quote a particular part of a post to answer it or point something out that's fine, but the entire posts history is directly above yours. When you want to reply click the Reply button in the bottom left instead of the Quote button in the bottom right. It will make reading your replies a bit easier. Thanks.


Posted by baoputzi in SWF Studio V3 on Jan 17 2008, 10:41 am

The only way to open and control pps and ppsx and ppt alike which I found is via the ssCore.script. Maybe there are other ways but to this point I am happy to get so far as it is a customers request to position and size any given ppt, pps, ppsx embedded within the application.

here is the AS2 which I use to run a vbScript handling Powerpoint:


ssCore.init();
ssDefaults.synchronousCommands = true;

var pptAPI = ssCore.Script.create({module:'pptAPI', language:'vbscript'});

if (pptAPI.success)
   {
   var pptAPILoaded = ssCore.Script.loadCode({module:'pptAPI', path:'startdir://pptConvert.vbs'});
      if (pptAPILoaded.success)
      {        
         ssDebug.trace("ok"); 
         
      }
      else
      {        
      ssDebug.trace('ERROR('+pptAPILoaded.Error.code + '): ' + pptAPILoaded.Error.description);
         if (pptAPILoaded.scriptError)
         { 
            ssDebug.trace('scriptError: '+pptAPILoaded.scriptError);
         }
      }
   }


Here is the VBScript:


Set objPPT = CreateObject("PowerPoint.Application")
objPPT.Visible = True

Set objPresentation = objPPT.Presentations.Open("C:\pptTest\Charts.ppt")

With objPPT.ActivePresentation.SlideShowSettings
   
    .ShowType = ppShowTypeWindow
    With .Run
        .Left = 0
        .Top = 0
        .Width = 1024
        .Height = 768
    End With
End With


This opens the powerpoint and creates, sizes positions and runs a ppt/pps/ppsx but in a different Window.

My Questions:

1.) How can I embed the opened pps Window into my Application. Such as with Shell.Invoke forceChild which works on opening pps

2.) How can I pass variables to the VBScript such as the file Path and the size and pos values

3.) How can I close the once opened pps I tried the script.destroy which did not work (ssCore.Script.destroy({module:"pptAPI"});

As VB is not my world maybe there are some better ways

thx for any help I am really stuck with that powerpoint stuff


Posted by mbd in SWF Studio V3 on Jan 17 2008, 11:36 am

VBScript can be used in V3 but it doesn't have the kind of support that JScript has. JScript is similar to JavaScript/ECMAScript, which ActionScript is based off of.

Many of the things you can do in VBScript can be done in JScript as well. JScript modules in SWF Studio also have functions and objects that are specific to SWF Studio and Flash.

If you really want to use VBScript check out this thread about how data is received by your VBScript function:
http://www.northcode.com/forums/showthread.php?t=7749

You could directly convert the VBScript code to JScript:

function open(obj)
{
   var ppShowTypeWindow = 2;

   var objPPT = new ActiveXObject('PowerPoint.Application');
   objPPT.Visible = true;

   var objPresentation = objPPT.Presentations.Open(obj.path);

   with (objPPT.ActivePresentation.SlideShowSettings)
   {
      .ShowType = ppShowTypeWindow;

      with (.Run)
      {
         .Left = obj.x;
         .Top = obj.y;
         .Width = obj.width;
         .Height = obj.height;
      }
   }
}


Then from ActionScript:

ssCore.pptAPI.open({path:ssGlobals.ssStartDir+'\\file.ppt', escapeBackslashes:true, x:0, y:0, width:1024, height:768});

Note: For more information about the escapeBackslashes parameter check ssCore.Script Overview (3rd paragraph).

The only option in SWF Studio to force an application to become a child of your application is with ssCore.Shell.execute. There might be a way through JScript, but none that I know of.


Posted by mbd in SWF Studio V3 on Jan 17 2008, 11:42 am

I missed one of your questions about closing PowerPoint. You should be able to close it via JScript/VBScript. From my code above, instead of making the variable scoped to the function, scope it outside of the function so it can be referenced from other functions. You can then add a close function that calls the Close method:

var objPresentation;

function open(obj)
{
   var ppShowTypeWindow = 2;

   var objPPT = new ActiveXObject('PowerPoint.Application');
   objPPT.Visible = true;

   objPresentation = objPPT.Presentations.Open(obj.path);

   with (objPPT.ActivePresentation.SlideShowSettings)
   {
      .ShowType = ppShowTypeWindow;

      with (.Run)
      {
         .Left = obj.x;
         .Top = obj.y;
         .Width = obj.width;
         .Height = obj.height;
      }
   }
}

function close(obj)
{
   objPresentation.Close();
}

Then from AS you could call ssCore.pptAPI.close().


Posted by northcode in SWF Studio V3 on Jan 17 2008, 11:47 am

How can I embed the opened pps Window into my Application. Such as with Shell.Invoke forceChild which works on opening pps

The SetParent API in Windows is how the forceChild option is implemented. You can call it for any applicatioon but there's no way to do this from SWF Studio right now unless you create a plugin to let you do it.

How can I close the once opened pps I tried the script.destroy which did not work (ssCore.Script.destroy({module:"pptAPI"});

You already know how to do this, you just don't know it. You have to destroy the PPT object you created. I haven't looked it up, but I'm guessing it will be objPPT.Presentations.Close or something similar. You might also want to destroy the objects you created before you clean up the script module.


Posted by baoputzi in SWF Studio V3 on Jan 17 2008, 03:32 pm

Thank you for the above.

I will try to bring it to work.


Posted by baoputzi in SWF Studio V3 on Jan 19 2008, 08:41 am

Flash side:


ssCore.init();
ssDefaults.synchronousCommands = true;

ssCore.App.updateGlobals();

var pptAPI = ssCore.Script.create({module:"pptAPI", language:"jscript"});

if (pptAPI.success)
{
   ssDebug.trace("Yep pptAPI created");
}
else
{
   ssDebug.trace("module creation error -> " + pptAPI.error.code + ", " + pptAPI.error.description);
}

ssCore.Script.loadCode({module:"pptAPI", path:"startdir://pptscript.js"});
      
var pptAPILoaded = ssCore.pptAPI.openPPT({path:ssGlobals.ssStartDir + "\\Charts.ppt", escapeBackslashes:true, x:0, y:0, width:1024, height:768});

if (pptAPILoaded.success)
{        
   ssDebug.trace("ok - yep loaded"); 
}
else
{        
   ssDebug.trace("LoadError: "+ pptAPILoaded.Error.code + "-> " + pptAPILoaded.Error.description + " the path: " + pptAPILoaded.path);

   if (pptAPILoaded.scriptError)
   { 
      ssDebug.trace("ScriptError: ->"+ pptAPILoaded.scriptError);
   }


JScript side:


function openPPT(obj)
{
    var ppShowTypeWindow = 2;

   var objPPT = new ActiveXObject("PowerPoint.Application");
   objPPT.Visible = true;

   var objPresentation = opjPPT.Presentations.Open(obj.path);
  
   with (objPPT.ActivePresentation.SlideShowSettings)
   {
      .ShowType = ppShowTypeWindow;

      with (.Run)
      {
         .Left = obj.x;
         .Top = obj.y;
         .Width = obj.width;
         .Height = obj.height;
      }
   }
}


                        
function closePPT(obj)
{
   objPresentation.Close();
}                  


Error code

Yep pptAPI created
LoadError: 7-> SCRIPT_ERROR_RUNTIME_ERROR the path: C:\pptTest\Charts.ppt
ScriptError: ->description: Objekt erwartet (5007)
error: Laufzeitfehler in Microsoft JScript
line: 1
column: 0
source:

thx for the help.

This part did run yesterday but since today not anymore??? Installed newest build of 3.5 but this was not the matter


Posted by northcode in SWF Studio V3 on Jan 20 2008, 02:13 am

The object expected error means that somewhere, your attempt to create or use an object failed. You should check the objects before you use them (to make sure they exist) to try and narrow down where the error is happening.

My first guess would be that the PPT file doesn't exist anymore but that would be too easy ;)


Posted by baoputzi in SWF Studio V3 on Jan 20 2008, 02:48 am

I will fix that ->its obviously my interpretation of the object model . Mea Culpa