Page 1 of 1
Help opening a pdf from a standalone
Posted: Mon Oct 03, 2022 9:33 pm
by dunbarx
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
Re: Help opening a pdf from a standalone
Posted: Tue Oct 04, 2022 1:16 am
by stam
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
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
Re: Help opening a pdf from a standalone
Posted: Tue Oct 04, 2022 1:51 am
by dunbarx
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
Re: Help opening a pdf from a standalone
Posted: Tue Oct 04, 2022 7:29 am
by FourthWorld
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".
Re: Help opening a pdf from a standalone
Posted: Wed Oct 05, 2022 5:52 pm
by dunbarx
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
Re: Help opening a pdf from a standalone
Posted: Wed Oct 05, 2022 6:02 pm
by stam
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…
Re: Help opening a pdf from a standalone
Posted: Wed Oct 05, 2022 9:10 pm
by dunbarx
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