How to transfer folder references to standalone ?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

kresten
Posts: 152
Joined: Tue Sep 30, 2008 3:01 pm
Location: Copenhagen
Contact:

How to transfer folder references to standalone ?

Post by kresten » Wed Jun 14, 2017 10:44 am

In original (sub) stack user is given an option to parse accumulated cards for occurence of a specified word, create ( and view) a labeled file and place it in a thus updated folder.:

..................
..................
put "Parsed for" && cue && phenodate & ".html" into filename
put the effective filename of this stack into destination
set the itemdelimiter to "/"
delete last item of destination
delete last item of destination
delete last item of destination
open file destination &"/"& parsings &"/"& filename
..................
..................

I omit the further references to the folder.
As I see it I need an entirely new way to handle the relation to this folder
( + another folder + a html-file)
Maybe a combination of externals, folders, start using ?
The solution should be implemented both for testing in the original and be working in the standalone

Hopefully from Kresten

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7227
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: How to transfer folder references to standalone ?

Post by jacque » Thu Jun 15, 2017 1:02 am

Depending on platform, the file paths will be different. Parsing a path from the location of the standalone won't work in most cases (Windows sometimes is an exception; all other platforms will fail.) Instead of parsing the path, use the special folder path "resources" which always points to the same virtual folder as the standalone file:

Code: Select all

 put specialFolderPath("resources") &"/"& parsings &"/"& filename into tPath
 open file tPath
When you are developing in the IDE, specialFolderPath("resources") is the folder containing your mainstack. In a standalone, it is the equivalent location which varies by platform. LC knows where to find them.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

kresten
Posts: 152
Joined: Tue Sep 30, 2008 3:01 pm
Location: Copenhagen
Contact:

Re: How to transfer folder references to standalone ?

Post by kresten » Thu Jun 15, 2017 10:35 am

Thank you for fast and precise instruction
best regards
kresten

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: How to transfer folder references to standalone ?

Post by bogs » Thu Jun 15, 2017 1:05 pm

Oh that is just awesome Jaque, and solves a problem I had in the IDE post :D

**Edit - While no less awesome, it apparently wasn't available much before vers. 6.7.x, if your using something earlier other special folder paths exist.

To get directly to the applications folder, this appears to do the job for those using < 6.6.x. (Probably just me :mrgreen: )
Image

kresten
Posts: 152
Joined: Tue Sep 30, 2008 3:01 pm
Location: Copenhagen
Contact:

Re: How to transfer folder references to standalone ?

Post by kresten » Mon Jun 19, 2017 2:50 pm

jackueline s reply was most helpfull. But I need a way from menu items to just open the folders for inspection, without specifying a file.
How can that be scripted ?

Klaus
Posts: 13823
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: How to transfer folder references to standalone ?

Post by Klaus » Mon Jun 19, 2017 3:10 pm

Hi Kresten,
kresten wrote:jackueline s reply was most helpfull. But I need a way from menu items to just open the folders for inspection, without specifying a file.
How can that be scripted ?
that's pretty easy: launch document (path to folder)

Example:

Code: Select all

...
put specialfolderpath("desktop") into tFolder
launch document tFolder
...
Best

Klaus

kresten
Posts: 152
Joined: Tue Sep 30, 2008 3:01 pm
Location: Copenhagen
Contact:

Re: How to transfer folder references to standalone ?

Post by kresten » Tue Jun 20, 2017 1:45 pm

I am experimenting to implement the opening of a folder:

Case "Go to Screenshots"
put specialfolderpath("resources") &"/"& "Screenshots" into tFolder
launch document tFolder
set the iconic of stack "phenomenalog" to true

but evidently the reference to the folder is not accepted by the editor.
How shall it be spelled?

Klaus
Posts: 13823
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: How to transfer folder references to standalone ?

Post by Klaus » Tue Jun 20, 2017 2:01 pm

Hi Kresten,

the script looks OK, but on a Mac this -> specialfolderpath("resources") is a folder INSIDE of the
standalone application package and maybe the user is not allowed to view that folder?
Just guessing...

Please check the result and see what it tells you:

Code: Select all

...
put specialfolderpath("resources") &"/"& "Screenshots" into tFolder

## And maybe:
answer tFolder
## Just to check if the folderpath looks correctly!

launch document tFolder
if the result <> EMPTY then 
    answer the result
end if
...
Best

Klaus

kresten
Posts: 152
Joined: Tue Sep 30, 2008 3:01 pm
Location: Copenhagen
Contact:

Re: How to transfer folder references to standalone ?

Post by kresten » Tue Jun 20, 2017 2:29 pm

But the problem seems to lie in the first line, where I get an error message:

"Compilation error: can't create a variable with that name (explicit variable?) near tFolder, char 65"
Are you sure my spelling is correct, parentheses and quotation marks etc ?

Klaus
Posts: 13823
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: How to transfer folder references to standalone ?

Post by Klaus » Tue Jun 20, 2017 3:29 pm

AHA! :D

No spelling etc. is correct, but when in the script editor, uncheck "Script variables" in the "Edit" menu!
Looks like some evil guy checked this just to tease you. 8)

kresten
Posts: 152
Joined: Tue Sep 30, 2008 3:01 pm
Location: Copenhagen
Contact:

Re: How to transfer folder references to standalone ?

Post by kresten » Wed Jun 21, 2017 12:52 pm

Dear Klaus
Thank you so much for your fine help with this. I succeeded in implementing two folder references and reference to a html file, so they work as wished for in the "set the editMenus of this stack to true" situation.

But back in the editMenus to false situation none of the three items are implemented !!!!
I have tried saving, closing and reopening the application but same negative result !
Any advice on this?

Klaus
Posts: 13823
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: How to transfer folder references to standalone ?

Post by Klaus » Wed Jun 21, 2017 1:04 pm

Hi Kresten,

not sure I understand your problem!?
You edited your menu(s) and after "set the editMenus of this stack to false" your changes/edited menus are gone?


Best

Klaus

kresten
Posts: 152
Joined: Tue Sep 30, 2008 3:01 pm
Location: Copenhagen
Contact:

Re: How to transfer folder references to standalone ?

Post by kresten » Wed Jun 21, 2017 1:11 pm

The items are still there, but no effect from clicking them

Klaus
Posts: 13823
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: How to transfer folder references to standalone ?

Post by Klaus » Wed Jun 21, 2017 1:20 pm

Can or did you debug the "Menupick" handler(s)?

kresten
Posts: 152
Joined: Tue Sep 30, 2008 3:01 pm
Location: Copenhagen
Contact:

Re: How to transfer folder references to standalone ?

Post by kresten » Wed Jun 21, 2017 1:54 pm

Well, When I click apply I get a "no errors occured "

Post Reply

Return to “Talking LiveCode”