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

Klaus
Posts: 13824
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 2:13 pm

Hi Kresten,
kresten wrote:Well, When I click apply I get a "no errors occured "
that only tells you that the script compiles without error.

Can you please post (one of) the menupick scripts and the scripts that does not work/get executed with "menupick"?


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 2:30 pm

it id the Go menu:

on menuPick pWhich
switch pWhich
case "Go to day..."
gotoday
break
case "Go to Parseviewer"
show stack "Parseviewer"
set the iconic of stack "Phenomenalog" to true
go stack "Parseviewer"
break
case "Go to My Cyberspace"
Open stack "Cyberspace"
set the iconic of stack "Phenomenalog" to true
set the visible of stack "Cyberspace" to true
break
Case "Go to Mindmapping"
open stack "Mindmapping"
set the iconic of stack "Phenomenalog" to true
break
Case "Go to Drafting"
open stack "DRAFT"
set the iconic of stack "Phenomenalog" to true
break
CASE "go to Drawing"
open stack "DRAWINGS"
set the iconic of stack "Phenomenalog" to true
break
Case "Go to Statistics"
open stack "Statistics"
ikonide
set the iconic of stack "Phenomenalog" to true
break
Case "Go to Screenshots"
put specialfolderpath("resources") &"/"& "Screenshots" into tFolder
launch document tFolder
set the iconic of stack "Phenomenalog" to true
break
Case "Go to Parsings"
put specialfolderpath("resources") &"/"& "Parsings" into tFolder
launch document tFolder
set the iconic of stack "Phenomenalog" to true
break
Case "Go to All days"
put specialFolderPath("resources") &"/"& Diarysum.html into tPath
launch document tPath
set the iconic of stack "Phenomenalog" to true
break
end switch
end menuPick

It is the three last items which works in the editMenus true situation, but not when false
all the other items refer to other substacks

best regards
kresten

Klaus
Posts: 13824
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 3:14 pm

Hi Kresten,

to narrow the problem down, add some "debugging" code to the handlers like:

Code: Select all

...
Case "Go to Screenshots"

  ## To see if the handler is really getting executed:
  answer pWhich

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

  ## To see if there are other reasons why the folder does not get opened, the result may give us a hint:
  launch document tFolder
  answer the result
break
...
I am off until the weekend, so no more answers from me until saturday or sunday!


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 » Mon Jul 31, 2017 2:19 pm

Hi
Well, I think I solved the menu problems.It turned out, that I had an extra old menu, which had to be deleted.
BUT:
Instead of opening a new subject, I continue here with a supplementary problem :
I have in my original stack some scriptlines, applying to the creation of a new daycard , which ensures that the content of the previous daycard is appended to a “diarysum.html” file, before a new daycard is created.
I have adapted the text to the placement of the “diarysum.html” file in the resources folder, resulting in a text:
go to last card
open file Diarysum.html for append
write "<p> =================================================== <BR>" to file Diarysum.html
write " <H3>" & short name of this card & "</H3>" to file Diarysum.html
write the HTMLText of field "Textfield" to file Diarysum.html
close file Diarysum.html

But this leaves the file unaffected.
Experiments to specify the location in the folder "resources" failed.

Instead I tried naively to follow the pattern which you suggested for handling the folders :

go to last card
put specialFolderPath("resources") &"/"& Diarysum.html into tPath
open file tPath for append
write "<p> =================================================== <BR>" to file tPath
write short name of this card to file tPath
write the HTMLtext of field "Textfield" of this card to file tPath
close file tPath

- With a most curious result:
-
- This is the accumulating content of the diary. The file has to remain at the default location. and with its default name: Diarysum.html. In this form, user cannot erase or add to it, but you can save its content at a given day somewhere else, on your computer, and edit that copy with a wordprocessor ================================================================
-  
- 瀼‾㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽‽䈼㹒㜱㜰㌰敤⁴祬歫摥獥ബ㌱㌺‵漉獧₌湫灡数楴污慤獹渠Ⱶ洠湥ഠ㌱㌺‶䌨杩牡瑥整_灵慤整⁤潴›㈠ഩ㌱㌺‶倉⌉″ഉ㌱㌺‶洉湥搠慩祲畳祳敮_瑡栠⁡癯牥歳敲敶⁴敤椠摮敬敤摮_潦歲慬楲杮汳湩敪_豰渠⁹楤牡獹浵昭汩ബ㌱㔺‰瘉獩⁴汢瑯映牯楤搠牥瘠牡琠൯㌱㔺″愉歡楦汰捡牥瑥椠爠獥潳牵敶ⱳ渠⁵敢潨摬牥搠湥椠摮敬湤湩獧楬橮牥敭歳楲敶_敭⁤楨牥杯祬晦牥椠敧൮㌱㔺‸栉汥敬敲攠⁴潦獲枿洠牥ⱥ映牯猠歩敫桲摥映牯映橥敬Ɱ愠瑬豳洠晲洠⁵楤牡獹浵⁩敲潳牵散൳㐱〺′爉灥慬散_㐱〺‵䴉湥映橥敬数獲獩整敲൲㐱ㄺ‵渉㘉ഉ㐱㈺′爉湥敳⁴楬瑤攠景洠牡敫楲杮牥椠猠慴正歳楲整൴㐱㐺′搉湯ⱥ猠₌湥湤⁵瑥氠汩敬潮敲⁴豨汢玿ⱴ潦獲枿ㄍ㨴〵ठ歡敹൳㐱㔺‰瀉뽲牶映牪湴_呈䱍愠杮癩汥敳湲_⁩捳楲瑰瑥ㄍ㨴㔵ठ潤敮瀼‾㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽㴽‽䈼㹒㜱㜰㐰

In the hope for a solution to this
Best regards from
Kresten

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

Re: How to transfer folder references to standalone ?

Post by Klaus » Mon Jul 31, 2017 2:51 pm

Hi Kresten,

if the standalone is (correctly) installed in the "Program files x86" (Win) or "Applications" (Mac) folder,
only users with ADMIN permissions are allowed to write in these folders!

If you need to write something to file, use the documents folder or the preferences folder!
Mac:
-> specialfolderpath("preferences")

Win:
-> specialFolderPath(35) = For all users!
-> specialfolderpath(26) = for the current user only!

Linux
-> $HOME

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 » Mon Jul 31, 2017 11:44 pm

Hi Klaus
Thank you for the specification applying to the future of a standalone. But before approaching those problems, I think it should be possible to organise the stack with its further resources (4 folders) + the diarysum.html in a way, which ensures the appending of daycard text, as long as it is executed in livecode.
Can you help scripting that ?
I understand, that the placement of the standalone in the application folder may limit the freedom of the user. But alternative placements of the standalone, on desktop or in document folder might perhaps be feasible ?
Best regards
Kresten

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

Re: How to transfer folder references to standalone ?

Post by Klaus » Tue Aug 01, 2017 9:34 am

Hi Kresten,
kresten wrote:Thank you for the specification applying to the future of a standalone. But before approaching those problems, I think it should be possible to organise the stack with its further resources (4 folders) + the diarysum.html in a way, which ensures the appending of daycard text, as long as it is executed in livecode.
Can you help scripting that ?
try this:

Code: Select all

...
go to last card

## Or do you have a subfolder with your html file? If yes, use this:
## put specialFolderPath("resources") &"/html/Diarysum.html" into tPath
put specialFolderPath("resources") &"/Diarysum.html" into tPath

## I always collect data in a variable first and then write to file (or put into a field) "en bloc"
put "<p> =================================================== <BR>" into tAppendix
put the short name of this card after tAppendix
put the HTMLtext of field "Textfield" of this card after tAppendix
put tAppendix after url("file:" & tPath)

## May give a hint what went tworng when writing to file
if the result <> EMPTY then
   answer "Error:" && the result
end if
...
kresten wrote:I understand, that the placement of the standalone in the application folder may limit the freedom of the user. But alternative placements of the standalone, on desktop or in document folder might perhaps be feasible ?
Maybe, not sure, and no guarantees! :D

Best

Klaus

Post Reply

Return to “Talking LiveCode”