HOW TO: Run an AppleScript (and shell script)

Find out how to get things done with Servoy. Post how YOU get things done with Servoy

Postby wim » Wed Nov 26, 2003 12:14 am

See if you can run any other VBscript. If not your virus scanner might be set up to block VBS files. I believe Norton does.
wim
 
Posts: 4
Joined: Wed Jul 02, 2003 1:13 am
Location: Toronto, ON

Postby Harjo » Wed Nov 26, 2003 12:31 am

Its very strange. from the 10 times that I doubleclick the script is started once.
the other times I'll get runtime error.
(if I start with cscript test.vbs //x : debugger mode)
virusscanner is not the issue. (is off!)
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Postby david » Wed Nov 26, 2003 3:35 am

set SH = wscript.createobject("WScript.Shell")
SH.run "c:\whateverFile.pdf", 0, false

- david
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Postby Harjo » Fri Nov 28, 2003 10:17 am

Here is the code for Windows to start/launch a file with the associated program.
The vbscript does not allways run, because of security issues (virusscanner etc..)

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

In this example the file: C:/out.pdf is launched.

Jan Blok pointed me in the right direction. Thanks Jan.
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Postby admin » Sun Dec 07, 2003 12:56 pm

on mac you can use the open command to achieve the same
admin
Site Admin
 
Posts: 72
Joined: Wed Apr 23, 2003 4:29 pm

Postby Bert » Sun Dec 07, 2003 1:18 pm

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

Only from the Finder...
Bert de Graaff
ATB Software Servoy Developer manage your business anywhere
User avatar
Bert
 
Posts: 201
Joined: Tue May 20, 2003 11:16 am
Location: Stramproy - NL

Postby Jan Aleman » Tue Dec 16, 2003 11:41 pm

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
Jan Aleman
Servoy
Jan Aleman
 
Posts: 2083
Joined: Wed Apr 23, 2003 9:49 pm
Location: Planet Earth

Printing a file from servoy

Postby idoctor » Sun Apr 18, 2004 5:13 pm

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)
idoctor
 
Posts: 254
Joined: Sun Sep 28, 2003 6:37 pm

Postby Jan Aleman » Sun Apr 18, 2004 7:08 pm

<path to acrobat.exe> /p /h /t <filename> <printername>

acrobat.exe can be a reader or full adobe. You can either hardcode the path to acrobat or add it to the system path.
Jan Aleman
Servoy
Jan Aleman
 
Posts: 2083
Joined: Wed Apr 23, 2003 9:49 pm
Location: Planet Earth

Postby Providence1 » Wed Sep 08, 2004 10:57 pm

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
Providence1
 
Posts: 456
Joined: Tue Aug 17, 2004 2:36 am
Location: New York, NY

Postby Jan Aleman » Tue Oct 12, 2004 9:49 am

I'd write out an RTF of the text you want to transfer and then use
Code: Select all
if(utils.stringMiddle(application.getOSName(),1,7) == "Windows")
{
   application.executeProgram('rundll32', 'url.dll,FileProtocolHandler','C:/out.pdf')
}

to open the document in Word.
Jan Aleman
Servoy
Jan Aleman
 
Posts: 2083
Joined: Wed Apr 23, 2003 9:49 pm
Location: Planet Earth

Re: HOW TO: Run an AppleScript (and shell script)

Postby Karel Broer » Fri Mar 18, 2005 10:33 pm

david wrote: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
Karel Broer
ServoyCamp - http://www.servoycamp.com
User avatar
Karel Broer
 
Posts: 779
Joined: Mon May 03, 2004 12:49 am
Location: Doetinchem

Previous

Return to How To

Who is online

Users browsing this forum: No registered users and 12 guests

cron