Solved!!! How to custom an open stack file???

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Fasasoftware
Posts: 203
Joined: Mon Oct 31, 2011 9:36 pm
Contact:

Solved!!! How to custom an open stack file???

Post by Fasasoftware » Sun Apr 08, 2018 7:08 pm

Dear friends,
I need to open a stack as my custom file....in other words i want only open a type of file...like .pippo
how i can do?? thanks a lot....
example code like this.....

Code: Select all

on mouseUp
		answer file "A text file" with type ("text files|txt|tTXT" & return & "all files|*|*")
		if it <> "" then
			put it into theFilePath
			put URL ("file:" & theFilePath) into field "text"
			
		else
			--no file was selected, or cancel was pressed
			beep
		end if
	end mouseUp
	
here my bad script....

Code: Select all

on mouseUp
		answer file "A custom file" with type (".pippo" & return & "all files|*|*")
		if it <> "" then
			put it into theFilePath
			-----put URL ("file:" & theFilePath) into field "text"
			Open thefilepath
		else
			--no file was selected, or cancel was pressed
			beep
		end if
	end mouseUp
	
Thank a lot to everybody!!!

best regards,
Lestroso :oops:
Last edited by Fasasoftware on Mon Apr 09, 2018 8:31 pm, edited 1 time in total.

Klaus
Posts: 14193
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to custom an open stack file???

Post by Klaus » Sun Apr 08, 2018 7:27 pm

Buonasera Lestroso,

not sure, but maybe you mean something like:

Code: Select all

...
  if it <> "" then
      put it into theFilePath
      try
         go stack thefilepath
         if the result <> EMPTY then
            answer "Looks like this is not a stack!"
         end if
      end try
   end if
...
Best

Klaus

Fasasoftware
Posts: 203
Joined: Mon Oct 31, 2011 9:36 pm
Contact:

Re: How to custom an open stack file???

Post by Fasasoftware » Sun Apr 08, 2018 7:35 pm

Vielen Danke Klaus!!!

my idea for the script is a little different....i want with ask command see only a .pippo file...ok, stack...

but in the file when i choose the file i want see only .pippo .....because i want customize my main stack...

Thanks again....

Best regards,

Lestroso :oops:

Klaus
Posts: 14193
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to custom an open stack file???

Post by Klaus » Sun Apr 08, 2018 7:37 pm

Sorry, I have no idea what exactly you want to do?
Do you only want to allow .pippo files in the open dialog?

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

Re: How to custom an open stack file???

Post by bogs » Sun Apr 08, 2018 7:57 pm

IF Klaus is correct, and you *only* want to show pippo files, what you would shoot for is more like this -

Code: Select all

answer file "A custom file" with type ("Pippo files|pippo")
if it <> "" then
	put it into theFilePath
	Open thefilepath
else
	--no file was selected, or cancel was pressed
	beep
end if
Which would give you this:
Selection_003.png
Selection_003.png (18.4 KiB) Viewed 8328 times
Image

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am

Re: How to custom an open stack file???

Post by sphere » Sun Apr 08, 2018 8:15 pm

or check this
https://nl.wikipedia.org/wiki/Pipo_de_Clown

Sorry i could not resist... :lol:

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

Re: How to custom an open stack file???

Post by bogs » Sun Apr 08, 2018 8:43 pm

Good one sphere :lol:
Image

Klaus
Posts: 14193
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to custom an open stack file???

Post by Klaus » Sun Apr 08, 2018 8:47 pm

Pipo <> pippo

The latter is a common italian (first) name, you jokers! :D

Fasasoftware
Posts: 203
Joined: Mon Oct 31, 2011 9:36 pm
Contact:

Re: How to custom an open stack file???

Post by Fasasoftware » Sun Apr 08, 2018 8:51 pm

Dear bogs,

i have tryed your script...but here nothing works....do you have an other ideas to try ????

in truth i want to make "catalog" as extension to open with livecode...
in other words i want only open a livecode stack file with my custom extension...

thanks a a lot..to everybody,

Lestroso :oops:

Klaus
Posts: 14193
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to custom an open stack file???

Post by Klaus » Sun Apr 08, 2018 8:56 pm

I just saved a stack with the suffix "*.pippo" and bogs' script worked as advertised!?
At least here on my Mac.

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

Re: How to custom an open stack file???

Post by bogs » Sun Apr 08, 2018 10:17 pm

Well, I tested it here on linux, mac and windows, and it worked, which leads me to suspect typographical error in naming your file, assuming of course that you copied the script I put up there and didn't type it in manually.
Fasasoftware wrote:
Sun Apr 08, 2018 8:51 pm
in truth i want to make "catalog" as extension to open with livecode...
in other words i want only open a livecode stack file with my custom extension...
The extension doesn't really matter, you could put anything. The part that filters out that particular extension is the part after the pipe symbol, which is what determines what file extensions will be shown.

So for example, if you put -

Code: Select all

answer file "A custom file" with type ("My marvelous custom files!!|mcf")
then you would only see files with an extension of ".mcf". If your extension is going to be uppercase, make sure you make it that after the piping symbol, or you won't see them. *.MCF is not *.mcf.

Same thing for the "pippo", if your file was ".Pippo" the script won't work until the extension is corrected.

Hope that was of some help.
Image

Fasasoftware
Posts: 203
Joined: Mon Oct 31, 2011 9:36 pm
Contact:

Re: How to custom an open stack file???

Post by Fasasoftware » Mon Apr 09, 2018 4:35 pm

Dear friends,

nothing works here....i'm using livecode community 8.1.9 on my imac...but the code you gave me don't work!!

can you help me please??

i put here some type i have tryed...

Code: Select all

on mouseDown 
  -- answer file "A custom file" with type ("My marvelous custom files!!|pippo") --> Don't work!
   --answer file "Give me  a file with catalog extension..." with type ("catalog | catalog") --->Don't work!
   --answer file "Give me  a file with catalog extension..." with type ("catalog | CATALOG") --->Don't work!
 --   answer file "prompt" with type "my catalog file |.catalog" --->Don't work!
   --answer files "Select the images you wish to view:" with type "JPEG Images|jpg|JPEG"--> THis Work Fine!!
    answer file "A custom file" with type ("Pippo files |pippo") ---> Don't work
if it <> "" then
	put it into theFilePath
	Open thefilepath
else
	--no file was selected, or cancel was pressed
	beep
end if
end mouseDown
best regards,
Lestroso :oops:

Klaus
Posts: 14193
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to custom an open stack file???

Post by Klaus » Mon Apr 09, 2018 4:56 pm

Just tested this snippet on LC 8.1.9 on my Mac:
...
answer file "A custom file" with type ("Pippo files |pippo")
put it into theFilePath
Open thefilepath
...
and it worked, sorry, no idea what is going wrong on your side...

Klaus
Posts: 14193
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to custom an open stack file???

Post by Klaus » Mon Apr 09, 2018 6:12 pm

Try this, maybe we get a hint then:

Code: Select all

...
if it <> "" then
 put it into theFilePath
 Open thefilepath
 answer the result
...

Fasasoftware
Posts: 203
Joined: Mon Oct 31, 2011 9:36 pm
Contact:

Re: How to custom an open stack file???

Post by Fasasoftware » Mon Apr 09, 2018 6:23 pm

hi klaus,

i have mac os yosemite....10.10.5... perhaps there's a bug....i don't know why...

thanks in any way lestroso :cry:

Post Reply