Help opening a pdf from a standalone

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9578
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Help opening a pdf from a standalone

Post by dunbarx » Mon Oct 03, 2022 9:33 pm

I work well, I think, while fully inside LC, but always miss things when I go outside even a tiny bit.

In a standalone I want to select a certain pdf ("VL2LO.pdf") from its containing folder ("CutSheet folder"). This folder was attached to a stack via the "Copy Files" pane in the Standalone Settings. I then made a standalone from that stack.

In a button I have:

Code: Select all

on mouseup
   set the defaultFolder to "cutsheet folder"
   put specialfolderpath("engine") & "/VL2LO.pdf" into tFixture
   --answer  tFixture  --IN THE IDE THIS SEEMS TO BE RIGHT
   open file tFixture
end mouseUp
I know this has been discussed widely.

Craig

stam
Posts: 2634
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Help opening a pdf from a standalone

Post by stam » Tue Oct 04, 2022 1:16 am

Hi Craig,
Can clarify your code? Some questions reading your handler:

1. shouldn't defaultFolder be a folder path? And why do you need to use the defaultFolder?

2. Assuming VL2LO.pdf resides within the folder "cutsheet folder", which resides in the same directory as your stack/app, why not use

Code: Select all

put specialFolderPath("resources") & "/cutsheet folder/VL2LO.pdf" into tFixture
instead of
dunbarx wrote:
Mon Oct 03, 2022 9:33 pm

Code: Select all

   set the defaultFolder to "cutsheet folder"
   put specialfolderpath("engine") & "/VL2LO.pdf" into tFixture
3. What is the purpose of this statement:
dunbarx wrote:
Mon Oct 03, 2022 9:33 pm

Code: Select all

open file tFixture
I ask as according to the dictionary:
Dictionary wrote:Use the open file command to create a file or prepare an existing file for use by the read from file or write to file commands.
Is that what you intend to do? Or launch it in the default PDF viewer?

Stam

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9578
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Help opening a pdf from a standalone

Post by dunbarx » Tue Oct 04, 2022 1:51 am

Stam.

Thanks for taking the time...

I threw together a bunch of stuff from perusing old forum posts that were from Klaus and Jacque. That has no bearing on how poorly I mashed together some of their ideas. I probably should not have posted my handler at all; it was a distraction.

All I want to do is, in a standalone with that pdf-filled folder attached, allow the user to select a particular file and have that file appear on the desktop. This sounds much easier than some of the gadgetry I have had to make now and then, but as I said, all those were built fully within LC itself. This business of accessing stuff in external folders is something I never deal with.

Help.

Craig

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Help opening a pdf from a standalone

Post by FourthWorld » Tue Oct 04, 2022 7:29 am

If "appear on the desktop" means copying the file, see revCopyFile.

If that means launching the document in the default application assigned to handle that document type, see "launch URL".
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9578
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Help opening a pdf from a standalone

Post by dunbarx » Wed Oct 05, 2022 5:52 pm

Stam, Richard.

So simple once I know, thanks.

I think I am the least capable LC'er of all of us when it comes to working outside LC itself. The snippets I got from perusing the forum just did not work. Likely my fault. Anyway:

Code: Select all

on mouseup
   put specialFolderPath("resources") & "/cutsheet folder/VL2LO.pdf" into tFixture
   revCopyFile  tFixture,desktop folder
end mouseup
And the pdf appears on the desktop, ready to use.

Oddly, I have no trouble making LC both communicate with and control production machines I build. I just barely know how to print

Craig

stam
Posts: 2634
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Help opening a pdf from a standalone

Post by stam » Wed Oct 05, 2022 6:02 pm

Glad you sorted it…
And if you want to just open the pdf (in the default app for the OS) instead of saving to desktop, just use the launch command as Richard suggested…

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9578
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Help opening a pdf from a standalone

Post by dunbarx » Wed Oct 05, 2022 9:10 pm

Stam.

Right.

What I wanted was to have my user pick up the actual pdf file and run with it. You can see I used one line from you and one line from Richard.

Craig

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”