Import file
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Import file
Well, I'm not a beginner but I'm not ashamed to say that this is a beginner question.
I want to view a jpeg file in a Runtime Rev application that I've made. I don't know how to do this simple thing. I try "open file NovJournal.jpg" and nothing happens.
I have a bird database and I'm entering in 37 years of my parents' bird notes from our house in Mexico. The bird entry is easy, but they've written journals out longhand, and I'm tired of entering it all by typing so I thought I'd scan each page and make it available. If I scan a page a day, I'll be done in a few years.
Any ideas on how I might incorporate scanned writing into a database for viewing would be appreciated, but as I said I don't even know how to get the file to open using RunRev.
Thanks
Tom
I want to view a jpeg file in a Runtime Rev application that I've made. I don't know how to do this simple thing. I try "open file NovJournal.jpg" and nothing happens.
I have a bird database and I'm entering in 37 years of my parents' bird notes from our house in Mexico. The bird entry is easy, but they've written journals out longhand, and I'm tired of entering it all by typing so I thought I'd scan each page and make it available. If I scan a page a day, I'll be done in a few years.
Any ideas on how I might incorporate scanned writing into a database for viewing would be appreciated, but as I said I don't even know how to get the file to open using RunRev.
Thanks
Tom
Re: Import file
Hi Tom,
Pictures are displayed in an image object. Your script needs to create one first and then put the picture data into the image control.
Kind regards,
Mark
Pictures are displayed in an image object. Your script needs to create one first and then put the picture data into the image control.
Code: Select all
create img "New Image"
put the long id of it into myImageID
set the text of myImageID to url ("C:/path/to/NovJournal.jpg")
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Import file
Thanks, Mark
I've tried:
on mouseUp
create img "New Image"
put the long id of it into myImageID
set the text of myImageID to url ("computer/macintosh hard drive/users/tomcole/retirement folder/estero morua bird database/December5_1975.jpg")
end mouseUp
Nothing happens, however.
Tom
I've tried:
on mouseUp
create img "New Image"
put the long id of it into myImageID
set the text of myImageID to url ("computer/macintosh hard drive/users/tomcole/retirement folder/estero morua bird database/December5_1975.jpg")
end mouseUp
Nothing happens, however.
Tom
Re: Import file
Hi Tom,
Doesn't LiveCode create an image object?
You can view the correct file path in the message box with the syntax
Select your file in the file dialog and check the file path in the message box.
Kind regards,
Mark
Doesn't LiveCode create an image object?
You can view the correct file path in the message box with the syntax
Code: Select all
answer file ""
put it
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- VIP Livecode Opensource Backer
- Posts: 9823
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Import file
The "text" property of an object is its contents. In fields it's the textual data displayed, and in images is the imageData.
To assign an image file to an image object use that object's filename property.
To assign an image file to an image object use that object's filename property.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Import file
Hi,
If you use the filename property of an image object, you're not actually importing that file. OP is asking how to import a file, not how to display a picture on disk. Using the filename property could be an alternative to importing a file, but that solution doesn't answer the OP's question.
If you set the imagedata to the contents of a picture file, you'll get garbage. You have to use the text property, not the imagedata.
Kind regards,
Mark
If you use the filename property of an image object, you're not actually importing that file. OP is asking how to import a file, not how to display a picture on disk. Using the filename property could be an alternative to importing a file, but that solution doesn't answer the OP's question.
If you set the imagedata to the contents of a picture file, you'll get garbage. You have to use the text property, not the imagedata.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Import file
I've checked the CARD INSPECTOR and the scripting does create an image but it is kind of invisible. I can select it and that's all. I guess I don't know what I'm doing as usual. I can import my images as controls and put them on pages. And view them that way. Is there an advantage to the way you are suggesting?
Re: Import file
Hi,
Whom are you asking?
It seems to me that you wanted to do this by script and that you wanted to actually import the file. The script I posted does this.
Mark
Whom are you asking?
It seems to me that you wanted to do this by script and that you wanted to actually import the file. The script I posted does this.
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Import file
I was asking Mark. Thanks for your help. I'll keep diddling with this. I can import the files as controls though.
Many thanks,
Tom
Many thanks,
Tom
Re: Import file
Hi Tom,
If it is sufficient for you to import the picture files as control through the File menu, then there is no reason not to use it. I guess that solves it.
Kind regards,
Mark
If it is sufficient for you to import the picture files as control through the File menu, then there is no reason not to use it. I guess that solves it.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- VIP Livecode Opensource Backer
- Posts: 9823
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Import file
Maybe. The OP wrote:Mark wrote:If you use the filename property of an image object, you're not actually importing that file. OP is asking how to import a file, not how to display a picture on disk. Using the filename property could be an alternative to importing a file, but that solution doesn't answer the OP's question.
He also mentioned that he has a good may of these images to view. As journal pages I'd guess they're at least 500x700px, possibly larger if scanned at a good resolution. Importing all them into a stack may be overkill, requiring a lot of memory."I want to view a jpeg file in a Runtime Rev application that I've made."
Unless there's some specific reason why it would be essential to import them, I'd just leave them on disk and set the filename of an image object.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Import file
Hi,
I think you're repeating yourself.
Mark
I think you're repeating yourself.
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Import file
Yes, there are a zillion scanned images or there will be. They're big, so I guess it would be best to just view the image. I put a couple in, and they're so big that it takes a second to go from one card to the next. There's an icon on the tools palette called image area. If I make one of those and stick it on a single card it would be nice to make it display the jpg image. Each image that I will store on my hard drive will have as its name a date. It would be good to enter a date and have the image object display the scanned journal page. I just can't get an image object to display. I guess it must be my path or something. computer/macintosh hard drive/users/tomcole/retirement folder/estero morua bird database/december5_1975.jpg
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Import file
Hi Tom,
There seems to be too much going on here as what you are asking for is too simple.(I think) As I understand it you just want to show an image, maybe be able to change that image to use just a single card.
On a card use the image tool to drag a square into it, in the inspector call it myImage
In a button script put this code;
Will help more once you've seen how this works.
Simon
There seems to be too much going on here as what you are asking for is too simple.(I think) As I understand it you just want to show an image, maybe be able to change that image to use just a single card.
On a card use the image tool to drag a square into it, in the inspector call it myImage
In a button script put this code;
Code: Select all
on mouseUp
ask file "Please select an image." -- this is just to get you started, select one of your image files
put it into tFilePath
breakpoint -- Take a look at the tFilePath now. Remove this breakpoint when you are ready
set the filename of img "myImage" to tFilePath
end mouseUp
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Import file
Hi Simon,
I'm pretty sure that you mean "answer file" instead of "ask file" because "ask file" won't let you select a file but rather enter a file name in a particular folder to generate a file path where a new file can be written.
I think your script should be
Tom, your file path is indeed wrong, as I already indicated in my previous posts. You must have a look at the file path returned by the answer file command, which I also already demonstrated in an earlier post.
Kind regards,
Mark
I'm pretty sure that you mean "answer file" instead of "ask file" because "ask file" won't let you select a file but rather enter a file name in a particular folder to generate a file path where a new file can be written.
I think your script should be
Code: Select all
on mouseUp
answer file "Please select an image."
if it is not empty then
put it into tFilePath
put tFilePath // display path in message box
set the filename of img "myImage" to tFilePath
end if
end mouseUp
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode