How to save an alias of a file in a stack?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
How to save an alias of a file in a stack?
I know that each file in a disk has a path, and I can store it in a LiveCode container (for example a customer property), is there also the possibility to store in a LiveCode container a sort of alias of a given file (not an alias) on disk? I need this because I want to keep track of a document on the disc that could be moved or renamed by the user.
Last edited by Mag on Fri Nov 25, 2016 4:26 pm, edited 1 time in total.
Re: How to save a file in a stack?
Hi Mag,
store an "alias" (= just the pathname!):
...
set the cAlias2File of this stack to "/Users/klaus/Desktop/fingers.jpg"
...
Store an actual file:
...
set the cActualFile of this stack to url("binfile:" & specialfolderpath("desktop") & "/fingers.jpg")
...
"Spit" it out again:
...
put the cActualFile of this stack into url("binfile:" & specialfolderpath("desktop") & "/fingers_copy.jpg")
...
Best
Klaus
store an "alias" (= just the pathname!):
...
set the cAlias2File of this stack to "/Users/klaus/Desktop/fingers.jpg"
...
Store an actual file:
...
set the cActualFile of this stack to url("binfile:" & specialfolderpath("desktop") & "/fingers.jpg")
...
"Spit" it out again:
...
put the cActualFile of this stack into url("binfile:" & specialfolderpath("desktop") & "/fingers_copy.jpg")
...
Best
Klaus
Re: How to save a file in a stack?
But if the user moves the file to another location the path doesn't work. I seem to recall that in Supercard there was a way to store a "sort of" alias that refer to the actual file regardless its location or its name.
Re: How to save a file in a stack?
Hi Mag,
Best
Klaus
yes, but that is not my fault!Mag wrote:But if the user moves the file to another location the path doesn't work.
Sorry, no idea how this could be done.Mag wrote:I seem to recall that in Supercard there was a way to store a "sort of" alias that refer to the actual file regardless its location or its name.
Best
Klaus
Re: How to save a file in a stack?
Thank you Klaus.
Maybe I have to create a disk alias on the fly and store it to some hidden and super secret location on the disk...
Maybe I have to create a disk alias on the fly and store it to some hidden and super secret location on the disk...
-
- VIP Livecode Opensource Backer
- Posts: 9578
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: How to save a file in a stack?
Mag.
You may, each time, have to explicitly ask for the pathname with the "answer file" command. A pain, but at least the user is burdened with that task, and not you.
Perhaps you can ease that burden by pre-determining if the file exists in the expected location, using the "there is a" operator?
Craig
You may, each time, have to explicitly ask for the pathname with the "answer file" command. A pain, but at least the user is burdened with that task, and not you.
Perhaps you can ease that burden by pre-determining if the file exists in the expected location, using the "there is a" operator?
Craig
Re: How to save a file in a stack?
Thank you so much Craig, I will go with the use of "there is a" operator
Re: How to save a file in a stack?
Sorry Klaus, I just realized that the title of the thread was wrong, now I corrected. I meant an alias ...Klaus wrote:Hi Mag,
store an "alias" (= just the pathname!):
...
set the cAlias2File of this stack to "/Users/klaus/Desktop/fingers.jpg"
...
Store an actual file:
...
set the cActualFile of this stack to url("binfile:" & specialfolderpath("desktop") & "/fingers.jpg")
...
"Spit" it out again:
...
put the cActualFile of this stack into url("binfile:" & specialfolderpath("desktop") & "/fingers_copy.jpg")
...
Best
Klaus