HOW TO: Run an AppleScript (and shell script)

admin:
on mac you can use the open command to achieve the same

Only from the Finder…

Not only from finder, open is a command line application that you can also execute from within servoy. For example

open file.pdf

wil automatically open the application configured to open pdf files

I want to take a PDF file stored in the database in binary form and print it in an automated fashion, without any printer dialogue?

Is it possible to write the PDF to a file on the hardrive and then use the application.executeProgram to print the file? If this won’t work do you know of any other options to get a PDF stored in the database to print, without any user interaction?

John McCann

Servoy Developer
Version R2 2.0 rc11-build 270
Java version 1.4.2_04-b05 (Windows XP)

/p /h /t

acrobat.exe can be a reader or full adobe. You can either hardcode the path to acrobat or add it to the system path.

How do I execute a visual basic command like:

.Documents.Add
.Selection.Paste

I want to copy a global to the clipboard, then launch Word, and paste the clipboard into the new Word document. Here’s my formula:

if(utils.stringMiddle(application.getOSName(),1,7) == “Windows”)
{
application.executeProgram(‘C:/Program Files/Microsoft Office/Office/WINWORD.EXE’);
}

However, I get an error:

CreateProcess: “C:Program FilesMicrosoft OfficeOfficeWINWORD.EXE” full_address error=2

even though it launches Word!

Thanks in advance for any advice you have!

Providence

I’d write out an RTF of the text you want to transfer and then use

if(utils.stringMiddle(application.getOSName(),1,7) == "Windows")
{
   application.executeProgram('rundll32', 'url.dll,FileProtocolHandler','C:/out.pdf')
}

to open the document in Word.

david:
In OS X terminal, this command opens a pdf in Preview:

open -a preview /Users/admin/Desktop/93260403.pdf

The parameters for executeProgram would look like this then:

application.executeProgram(‘open’,‘-a’,‘preview’,‘/Users/admin/Desktop/93260403.pdf’);

Combine this with the applescript from the first post, you could return a list of all the jpg files in a directory and then open them in preview. All without leaving Servoy.

  • david

A nice feature in the file plugin would be something like: plugins.file.fileApplicationName(filepath) ! That way we would be able to open ANY file ! :D