Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: FrontCall shellexec Print  (Read 14590 times)
Reuben B.
Four Js
Posts: 1119


« on: August 28, 2008, 08:07:08 am »

I see that somewhere between 1.3 and 2.0, the shellexec frontcall was amended to add a second argument that allowed you to specify the action to perform on the file e.g.

CALL ui.Interface.FrontCall("standard","shellexec",[filename,"Print"],ok)

... and the file would print.  Thats very useful, was it ever documented in the New Features?  What other options are available other than Print, is it simply the Windows ShellExecute methods of edit,explore,find,open,print, NULL.

Is it possible to force it to prompt for a printer, rather than printing immediately?

Reuben

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
.
Four Js
Posts: 115


« Reply #1 on: August 29, 2008, 02:21:24 pm »

This has been introduced with GDC 2.00.

from the release notes:

Quote
Extensions:
-----------
* ShellExec now accept an 'action' parameter (for instance "open") to allow using something else than default Windows behavior.
* ShellExec now works under MacOS X and KDE environment.

Different values for this parameter depends on your configuration (registry), as well as right clicking on the file in Windows Explorer. Using no parameter simply uses the default behavior.

We're doing nothing else than calling Microsoft ShellExec function:

http://msdn.microsoft.com/en-us/library/bb762153(VS.85).aspx

From msdn:

Quote
A pointer to a null-terminated string, referred to in this case as a verb, that specifies the action to be performed. The set of available verbs depends on the particular file or folder. Generally, the actions available from an object's shortcut menu are available verbs. The following verbs are commonly used:

edit
    Launches an editor and opens the document for editing. If lpFile is not a document file, the function will fail.
explore
    Explores a folder specified by lpFile.
find
    Initiates a search beginning in the directory specified by lpDirectory.
open
    Opens the item specified by the lpFile parameter. The item can be a file or folder.
print
    Prints the file specified by lpFile. If lpFile is not a document file, the function fails.
NULL

    In systems prior to Microsoft Windows 2000, the default verb is used if it is valid and available in the registry. If not, the "open" verb is used.

    In Windows 2000 and later, the default verb is used if available. If not, the "open" verb is used. If neither verb is available, the system uses the first verb listed in the registry.

Regards,
Reuben B.
Four Js
Posts: 1119


« Reply #2 on: September 01, 2008, 01:56:46 am »

Pierre-Nicolas,

Thanks, a reminder for me to read release/readme.txt for each release, instead of just relying on https://4js.com/techdocs/genero/fgl/devel/DocRoot/User/NewFeatures.html to tell me of new features.

A google of shellexecute led me to examples using PrintTo as well as Print, and passing the printer name in using the lpParameters argument.

So I tried ...

CALL ui.Interface.FrontCall("standard","shellexec",[filename,"PrintTo"],ok)

... this runs OK without returning an error.  However trying to pass a printer in as the 3rd argument returned a stack error.

What I was really trying to do was control wether the Printer Dialog box appeared.  It looks like that it depends on the application that is invoked.  For instance with a .html file, the printer dialog box appears, for .pdf, .txt., .csv, the printer dialog box does not appear.  I guess that is not something we have control over.  Certainly Google showed a number of other developers trying to do the same thing without an obvious solution.

Thanks,

Reuben 

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines