FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister   ProfileProfile    Log inLog in   RSS Feed

Problem with images

 
Post new topic   Reply to topic    Salling Software Forums Forum Index -> Scripting Salling Clicker for Mac
View previous topic :: View next topic  
Author Message
relaht
Newbie


Joined: 17 May 2006
Posts: 10

PostPosted: Wed May 17, 2006 1:39 pm    Post subject: Problem with images Reply with quote

First of all: I'm new to Salling Clicker and AppleScript.

I'm writing a script to display a screenshot from a "Dreambox" to the Phone:


[code:1]if supports keypad images of a_terminal then
ignoring application responses

set thePicture to do http get "http://192.168.1.3/root/tmp/osdshot.png"

set image of my_keypad to thePicture

end ignoring
end if[/code:1]

This works fine if the "osdshot.png" is a small picture (128 x 64)
But if the picture is bigger then it doesn't.

It also does not work with .bmp pictures.

How can I make it work?

Thanks for any suggestions.
Back to top
View user's profile Send private message
salling
Site Admin


Joined: 27 Jul 2004
Posts: 7498
Location: Stockholm, Sweden

PostPosted: Wed May 17, 2006 1:56 pm    Post subject: Reply with quote

Could you please be more specific in your description of how it does not work?

Best.
--
Jonas
Back to top
View user's profile Send private message Send e-mail Visit poster's website
relaht
Newbie


Joined: 17 May 2006
Posts: 10

PostPosted: Wed May 17, 2006 2:30 pm    Post subject: Reply with quote

[quote="salling"]Could you please be more specific in your description of how it does not work?

Best.
--
Jonas[/quote]
If it works, the picture is displayed on the phone

If it doesn't work I can not start the script on the phone.
Back to top
View user's profile Send private message
relaht
Newbie


Joined: 17 May 2006
Posts: 10

PostPosted: Wed May 17, 2006 2:50 pm    Post subject: Reply with quote

I changed the code to[code:1]
try
if supports keypad images of a_terminal then
ignoring application responses
set thePicture to do http get "http://192.168.1.3/root/tmp/osdshot.png"

set image of my_keypad to thePicture
end ignoring
end if
on error
beep
end try[/code:1]

If it doesn't work => beep
Back to top
View user's profile Send private message
salling
Site Admin


Joined: 27 Jul 2004
Posts: 7498
Location: Stockholm, Sweden

PostPosted: Wed May 17, 2006 3:16 pm    Post subject: Reply with quote

Hm. Salling Clicker's "do http get" command will only do image conversion if the web server in question responds with a proper mime type header for the resource you're getting. Could you please check this?

Also, please (temporarily) remove the "try/on error/beep" combo to get a hopefully useful log item in the Script Log.

Best.
--
Jonas


[quote="relaht"]I changed the code to[code:1]
try
if supports keypad images of a_terminal then
ignoring application responses
set thePicture to do http get "http://192.168.1.3/root/tmp/osdshot.png"

set image of my_keypad to thePicture
end ignoring
end if
on error
beep
end try[/code:1]

If it doesn't work => beep[/quote]
Back to top
View user's profile Send private message Send e-mail Visit poster's website
relaht
Newbie


Joined: 17 May 2006
Posts: 10

PostPosted: Wed May 17, 2006 4:03 pm    Post subject: Reply with quote

[quote="salling"]Hm. Salling Clicker's "do http get" command will only do image conversion if the web server in question responds with a proper mime type header for the resource you're getting. Could you please check this?[/quote]
How can I check it?

(If I type the URL in Safari I get the Picture)
Back to top
View user's profile Send private message
salling
Site Admin


Joined: 27 Jul 2004
Posts: 7498
Location: Stockholm, Sweden

PostPosted: Wed May 17, 2006 8:15 pm    Post subject: Reply with quote

You can do this from the command line (Terminal):

curl -I http://192.168.1.3/root/tmp/osdshot.png
(notice capital "I")

This will show just the HTTP headers. Look for the line that says "Content-Type:".

Modify the URL to try a couple of different images, especially the ones you're having problems with.

Best.
--
Jonas

[quote="relaht"][quote="salling"]Hm. Salling Clicker's "do http get" command will only do image conversion if the web server in question responds with a proper mime type header for the resource you're getting. Could you please check this?[/quote]
How can I check it?

(If I type the URL in Safari I get the Picture)[/quote]
Back to top
View user's profile Send private message Send e-mail Visit poster's website
relaht
Newbie


Joined: 17 May 2006
Posts: 10

PostPosted: Wed May 17, 2006 8:52 pm    Post subject: Reply with quote

curl -I http://192.168.1.3/root/tmp/screenshot.bmp
HTTP/1.1 405 Method not allowed
Connection: close
Content-Type: text/html

This is the respond on all pictures


The log item is:
The Variable thePicture is not defined


If it does not work with "do http get" I can retrieve the picture also from the mac.
But I couldn't figure out how to do this

Let's say the path is "MyHD:Users:me:desctop:osdshot.png"
How can I retrieve the picture from there?
Back to top
View user's profile Send private message
jaysonc
Newbie


Joined: 09 Jan 2006
Posts: 8

PostPosted: Wed May 17, 2006 10:17 pm    Post subject: Reply with quote

I use

[code:1]set image_data to read (alias "MyHD:Users:me:desctop:osdshot.png") as picture[/code:1]

to load JPG images into my scripts.
Back to top
View user's profile Send private message
salling
Site Admin


Joined: 27 Jul 2004
Posts: 7498
Location: Stockholm, Sweden

PostPosted: Wed May 17, 2006 10:19 pm    Post subject: Reply with quote

If you can grab the picture from the hard drive, that'd be much better from a performance perspective. Check out the "System -> Screen Capture" script for a code snippet to read a file into a picture using pure AppleScript.

Why were you using the web server in the first place?

Best.
--
Jonas
Back to top
View user's profile Send private message Send e-mail Visit poster's website
relaht
Newbie


Joined: 17 May 2006
Posts: 10

PostPosted: Wed May 17, 2006 10:35 pm    Post subject: Reply with quote

The "Dreambox" is a TV-Satellite-Receiver. It has a Web Interface and is also connected to my Mac.

The picture I want to display on the Phone is a Screenshot from the "Dreambox" and not from the Mac.

I can download this picture to the Mac. (as a file)
There must be an easy way to display the picture on the phone.

Thanks for your patience.
Back to top
View user's profile Send private message
salling
Site Admin


Joined: 27 Jul 2004
Posts: 7498
Location: Stockholm, Sweden

PostPosted: Wed May 17, 2006 11:32 pm    Post subject: Reply with quote

It appears to me that the webserver in the Dreambox doesn't allow you to pull the image out that way. Neither curl nor Salling Clicker manages to do it, so it does not appear to be a Clicker-specific thing.

Does the web server require authentication? Can you successfully use the image URL in a fresh Safari session? (i.e. Safari caches cleaned, not loading the whole page that the image is in, but just the image URL)

Best.
--
Jonas
Back to top
View user's profile Send private message Send e-mail Visit poster's website
relaht
Newbie


Joined: 17 May 2006
Posts: 10

PostPosted: Fri May 19, 2006 11:40 am    Post subject: Reply with quote

How about to drop the idea with http.
Is there any way to get the picture from the mac?
Back to top
View user's profile Send private message
salling
Site Admin


Joined: 27 Jul 2004
Posts: 7498
Location: Stockholm, Sweden

PostPosted: Fri May 19, 2006 12:49 pm    Post subject: Reply with quote

Did you see jaysonc's hint above? It tell you exactly what you need, unless I'm misunderstanding you.

Best.
--
Jonas

[quote="relaht"]How about to drop the idea with http.
Is there any way to get the picture from the mac?[/quote]
Back to top
View user's profile Send private message Send e-mail Visit poster's website
relaht
Newbie


Joined: 17 May 2006
Posts: 10

PostPosted: Fri May 19, 2006 2:16 pm    Post subject: Reply with quote

[quote="salling"]Did you see jaysonc's hint above? It tell you exactly what you need, unless I'm misunderstanding you.

Best.
--
Jonas

[/quote]
No, sorry, I didn't see it.
That works!
Thank you all!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Salling Software Forums Forum Index -> Scripting Salling Clicker for Mac All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group