Relative path and printing do not work for me in 3.5.0-rc-1

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
user#606
Posts: 217
Joined: Sun Jan 27, 2008 12:25 pm
Contact:

Relative path and printing do not work for me in 3.5.0-rc-1

Post by user#606 » Mon Apr 06, 2009 8:24 am

I wasted a day yesterday trying to solve these issues and I hope someone can help. Yes, I did read the documentation and even used the print example in resorces.
I understand that if the file to be read is in the same folder as the exe or development environment the relative path to the file should work, but it does not do so for me.
C:/Program Files/Revolution Enterprise/3.5.0-rc-1/Introduction.mht
is the full path.
I have tried ..Introduction.mht also ../Introduction.mht or ..\Introduction.mht and no luck. what would you use?

The printing item is simply to print a card in landscape mode to A4.
the card size is 1024 width x 768 height.
I can get a print to pdf perfectly, but is off the page if directed to a printer.
What would you use for consistant results?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10049
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Post by FourthWorld » Mon Apr 06, 2009 2:35 pm

What does your script look like?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Post by BvG » Mon Apr 06, 2009 9:32 pm

i see that you prepend dots to your path. This is not necessary. Just check the defaultfolder is correct, and if your file is in there, you can use a relative reference to access it:

Code: Select all

on mouseUp
put url "file:introduction.txt"
end mouseUp
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

user#606
Posts: 217
Joined: Sun Jan 27, 2008 12:25 pm
Contact:

Post by user#606 » Thu Apr 09, 2009 11:43 am

Sorry for the delay in reply FourthWorld, the script from resource centre is this:-

on printThisCard thePaperSize,theMargin
-- set up defaults if no size and margin provided:
if thePaperSize is empty then put the printPaperSize into thePaperSize
if theMargin is empty then put 72 into theMargin
-- get the page area:
set the printMargins to \
theMargin,theMargin,theMargin,theMargin
put theMargin,theMargin, \
item 1 of thePaperSize - theMargin, \
item 2 of thePaperSize - theMargin \
into destinationRect
-- print into that rectangle:
print this card into destinationRect
end printThisCard

By including Landscape in the code, the result is the card squeezed to a portrait A4 width on the left side of the landscape A4 page. The bottom of the card is cut off as well.

In reply to BvG, the ideal would be to discover the path to the exe when the exe first starts and use this to set the path for the data file.

Can you help?

Post Reply