One Use Only Files
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: One Use Only Files
Hi again.[SOLVED] Reinstalled LC 9 and it works fine.
Just trying to implement the "set script" code and LC is being extremely laggy? Has anyone else experienced this?
It takes about 10 seconds to do anything then notifies that the script has to be reloaded but it seems to completely
slow everything down?
Bidge
Just trying to implement the "set script" code and LC is being extremely laggy? Has anyone else experienced this?
It takes about 10 seconds to do anything then notifies that the script has to be reloaded but it seems to completely
slow everything down?
Bidge
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: One Use Only Files
You could try:
And begore that try to comment out the set-script-lines. I can't really believe this should be the culprit.
Code: Select all
lock screen; lock messages
shiftLock happens
Re: One Use Only Files
Hi [-hh]
Thanks again for the help Just about to start into it for the day.
Bidge
Thanks again for the help Just about to start into it for the day.
Bidge
Re: One Use Only Files
I am having problems browsing a file folder of images I have set up on the internet.
Just getting a bunch of html gobbledygook and the .png files at the botton withing the
html container. I've not had any experience with opening files from the internet with LC
so I am probably doing something wrong as this is working perfectly from the computer.
"put tFolder" is where i get the html
Even if I try to browse the folder with a button I get this:
EDIT: Oh...and yes klaus...I even tried binfile
Thanks again
Bidge
Just getting a bunch of html gobbledygook and the .png files at the botton withing the
html container. I've not had any experience with opening files from the internet with LC
so I am probably doing something wrong as this is working perfectly from the computer.
"put tFolder" is where i get the html
Code: Select all
on mouseUp
lock screen
global gFileList
local tFolder
put "" into gFileList
put url "http://www.bidgeposter.com/ThumbTest/" into tFolder
put tFolder
put the files into tFileList
repeat for each item i in ".png,.jpg"
put tFileList into temp
filter temp with ("*"&i)
repeat for each line l in temp
put tFolder & slash & l & cr after gFileList -- add to global
end repeat
end repeat
if gFileList = "" then -- no images
answer "No images found in this folder."
end if
put empty into field "Field"
set the text of field "Field" to gFileList
put the number of lines in field "Field" into tImages
if there is a group "CCTVObject" then delete group "CCTVObject"
create group "CCTVObject"
put empty into group "CCTVObject"
set the opaque of group "CCTVObject" to true
set the showBorder of group "CCTVObject" to true
repeat with x=1 to tImages
copy image "back" to group "CCTVObject"
set the name of the last image to ("back" & x)
add 60 to y
set the location of image ("back" & x) to 122,y
end repeat
set the borderWidth of group "CCTVObject" to 3
set the vScrollbar of group "CCTVObject" to true
set the threeD of group "CCTVObject" to true
set the scrollbarWidth of group "CCTVObject" to 12
set the backgroundColor of group "CCTVObject" to black
set the loc of group "CCTVObject" to 369, 352
set the height of group "CCTVObject" to 446
set the width of group "CCTVObject" to 90
unlock screen
end mouseUp
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>Index of /ThumbTest</title>
</head>
<body>
<h1>Index of /ThumbTest</h1>
<ul><li><a href="/"> Parent Directory</a></li>
<li><a href="Image1.png"> Image1.png</a></li>
<li><a href="Image2.png"> Image2.png</a></li>
<li><a href="Image3.png"> Image3.png</a></li>
<li><a href="Image4.png"> Image4.png</a></li>
<li><a href="Image5.png"> Image5.png</a></li>
</ul>
</body></html>
Thanks again
Bidge
Re: One Use Only Files
Hi David,
a couple of things...
1. the correct syntax for getting all files in a folder is:
...
set the directory to "path/to/folder"
put the files into tFiles
...
## Or in newer versions of LC:
put files("path/to/folder") into tFiles
...
2. That does not work over the internet with folders on a server!
3. This:
...
put url "http://www.bidgeposter.com/ThumbTest/" into tFolder
...
will return:
a. the content of the file "index.htm" or "index.lc" or whatever should be the start page for that internet address, if any.
Just as if you had entered this into your browsers address field!
b. If there is no INDEX in that folder, then, depending on the settings of the server, you will get a HTML formatted list of files in that folder, as you have experienced.
c. Or nothing, if the server is not set set this way.
You will need a PHP or LC script which will return a list of files in a folder, like this one.
Put it into any folder on the server and it will return all files in that folder:
Name it "filelisting.php" and then you can:
...
put url "http://www.bidgeposter.com/ThumbTest/filelisting.php" into tFilesOnServer
...
Best
Klaus
a couple of things...
1. the correct syntax for getting all files in a folder is:
...
set the directory to "path/to/folder"
put the files into tFiles
...
## Or in newer versions of LC:
put files("path/to/folder") into tFiles
...
2. That does not work over the internet with folders on a server!
3. This:
...
put url "http://www.bidgeposter.com/ThumbTest/" into tFolder
...
will return:
a. the content of the file "index.htm" or "index.lc" or whatever should be the start page for that internet address, if any.
Just as if you had entered this into your browsers address field!
b. If there is no INDEX in that folder, then, depending on the settings of the server, you will get a HTML formatted list of files in that folder, as you have experienced.
c. Or nothing, if the server is not set set this way.
You will need a PHP or LC script which will return a list of files in a folder, like this one.
Put it into any folder on the server and it will return all files in that folder:
Code: Select all
<?php
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo "$file\n";
}
}
closedir($handle);
}
?>
...
put url "http://www.bidgeposter.com/ThumbTest/filelisting.php" into tFilesOnServer
...
Best
Klaus
Re: One Use Only Files
Klaus.
Thank you so much. I was in the process of writing html filtering scripts
and it has been giving me a headache. Your help is very much appreciated.
I had no idea it could be that complicated. It worked perfectly except it also
returned the "tFilesOnServer.php" file that was in the directory
(I can filter that one out with script;)
Again, thank you so much Klaus.
Bidge
Thank you so much. I was in the process of writing html filtering scripts
and it has been giving me a headache. Your help is very much appreciated.
I had no idea it could be that complicated. It worked perfectly except it also
returned the "tFilesOnServer.php" file that was in the directory
(I can filter that one out with script;)
Again, thank you so much Klaus.
Bidge
Re: One Use Only Files
You may also want to watch out for things like this in your coding adventures, unlike the line in your repeat structure further down, what is tFolder being "put" into?
Something else you want to pay attention to is naming controls. You never ever not EVAH want to use the default names given, as is the case later in your code: Name things so that they have meaning if at all possible for the use they are being put to, for example
if you are using the field to list files. You will find this far more meaningful and useful later when you are staring at a list of fields or buttons or whatnot named "object 1, object 2, object 3..." etc. and have to click on each one to find out what you thought it should be doing when you placed or created it.
Don't sweat the small mistakes, someone once told me, but do try to not repeat them over and over
{btw, happens to me all the time }
With no container statement, it probably only introduces ambiguity. It could also end the world in 5, 3, 8..., well, we don't know! Computers iz stoopid like you wouldn't believe, instructions need to be given to them as if they were given to a young child with no experiences in life yet, specify everything.
Something else you want to pay attention to is naming controls. You never ever not EVAH want to use the default names given, as is the case later in your code:
Code: Select all
put empty into field "Field"
Code: Select all
field "fileList"
Don't sweat the small mistakes, someone once told me, but do try to not repeat them over and over
{btw, happens to me all the time }
Re: One Use Only Files
Thank you so much guys.
bogs:
My naming skills leave a lot to be desired and I really appreciate the pointers.
I think I used "put tFolder" to see what was being written to that file.
(Arrrrg!!!...my end of the world variable has been discovered)
field "Field" is just being used for my experimentation. Probably not a good idea
to post such bad code here in case someone like me are looking for samples and
answers
I'll be more careful next time.
Bidge
bogs:
My naming skills leave a lot to be desired and I really appreciate the pointers.
I think I used "put tFolder" to see what was being written to that file.
(Arrrrg!!!...my end of the world variable has been discovered)
field "Field" is just being used for my experimentation. Probably not a good idea
to post such bad code here in case someone like me are looking for samples and
answers
I'll be more careful next time.
Bidge
Re: One Use Only Files
bogs wrote:...etc. and have to click on each one to find out what you thought it should be doing when you placed or created it.
OH NOES, it started alreadybidgeeman wrote:I think I used "put tFolder" to see what was being written to that file.
If your the only maintainer, naming skill only has to be good enough for you to remember. Just wait till you start reviewing someone else's code < shuddering...>bidgeeman wrote:My naming skills leave a lot to be desired...
Interestingly enough, "put x" *does* serve a great purpose in the messagebox, for instance "put the colorNames" works quite nicely in there, where you are only dealing with a few lines of code. Learn to use and love the messagebox, it would be the ideal place to put your end of the world variablesbidgeeman wrote:(Arrrrg!!!...my end of the world variable has been discovered)
It is in the editor where just sticking it in randomly can cause you problems down the road when you think your program is finished, people start using it, you forgot it was in there, and get flooded with "WHY THE #@%$ IS THIS %$#@ BOX POPPING UP!!!!!!!!" emails
As for the field "Field", everyone throws together demos for something that are quick and dirty, just beware of falling into the habit of letting it slide into your work. As someone starting out, you just want to make sure it doesn't become a habit that is terrible hard to break later on.
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: One Use Only Files
Just for future reference, here's a quick way to strip html tags from text:bidgeeman wrote:Klaus.
Thank you so much. I was in the process of writing html filtering scripts
and it has been giving me a headache.
Code: Select all
set the htmltext of the templateField to tRawData
put the text of the templateField into tText
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: One Use Only Files
A very common solution used for printing picture softwares is to store image in a database. Only who has the database credentials can load images in your livecode software, no way to download in any way.bidgeeman wrote:Hi Klaus. Edit[SOLVED]
I'm tossing around multiple ideas for protecting my images. I have a poster designer and have a library of backgrounds that can be used to assemble a simple poster design with a bit of text and an imported photo. I have had already an experience of being pirated from a small shop where I sell a few bits and pieces of artwork. That system allows anyone to buy the actual design and download it. I'm sure you can imagine how it might feel to suddenly find someone is selling your work. (being a muso
I would like to try and protect my images this time around but at the same time allow people to print out their customized versions of the poster. I've seen server hosted images that only allow images to stream but that means I would have to build an entire browser in my app so people can see what images are there. I'm not sure how to go about this but it seems like it could be a good solution. Also not sure what problems this might present, ie, people being offline, the amount of time it takes to download images to a gallery etc. Just after some advice from the experts on the forum like yourself.
Hope that helps explain.
Bidge
The (livecode) software load the image at low resolutions (adding your logo, etc.), user can modify it. Then he pays you, and you give the ok to print at full resolution, without logo, etc.
No browser, just livecode image control(s) and database connection.
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: One Use Only Files
Using "put" without a destination is supported syntax. In the IDE, the content goes to the message box. On mobile it goes to stdout where it can be picked up by a terminal for debugging. In LC server scripts, content goes to the browser window, or is returned to the caller if it's a response to a POST or GET request.Interestingly enough, "put x" *does* serve a great purpose in the messagebox
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: One Use Only Files
Oh that is just awesome to know, I was under the impression the only place to use it without a container was in the message box.jacque wrote:Using "put" without a destination is supported syntax. In the IDE, the content goes to the message box. On mobile it goes to stdout where it can be picked up by a terminal for debugging. In LC server scripts, content goes to the browser window, or is returned to the caller if it's a response to a POST or GET request.
See Bidge? If you can somehow write the program that taps this lass's brain, you'll be in clover
I still somehow feel that if your end user see's popups where one isn't expected, though, your going to get mail, so strip em out when done (unless they are part of the plan as Jacque outlined)
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: One Use Only Files
That's certainly true if users are running your stack in the IDE. Someone wrote a script once to search for all empty "puts" so you could find and remove them as needed. That was a long time ago though and I don't have a reference.bogs wrote:I still somehow feel that if your end user see's popups where one isn't expected, though, your going to get mail, so strip em out when done (unless they are part of the plan as Jacque outlined)
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: One Use Only Files
MaxV wrote:
Not come across resolution controls in LC yet but it sounds very interesting. I have noticed that when you resize and image then export a snapshot, the image maintains the resolution of the resized version. Maybe that's what you were referring to? Resize then export snapshot? Aside from that,
dealing with a database is a bit out of my league at the moment unfortunately
Regards
Bidge
I*s there a way to control the resolution of an image or are you referring to loading a low res/snapshot copy of an image?The (livecode) software load the image at low resolutions (adding your logo, etc.), user can modify it. Then he pays you, and you give the ok to print at full resolution, without logo, etc.
Not come across resolution controls in LC yet but it sounds very interesting. I have noticed that when you resize and image then export a snapshot, the image maintains the resolution of the resized version. Maybe that's what you were referring to? Resize then export snapshot? Aside from that,
dealing with a database is a bit out of my league at the moment unfortunately
Regards
Bidge