I tried out the lesson at http://lessons.runrev.com/buckets/784/lessons/15963, Launching a PDF in an external viewer but I'm getting card id 1002: execution error at line n/a () near "unknown browser id". What am I missing here?
-- My card script
local sBrowserId
on openCard
browserOpen
end openCard
on browserOpen
-- We pass the windowId of the stack to revBrowser
-- so that it can determine which window to place the
-- browser object into
put the windowid of this stack into tWinID
-- Open the browser, using the windowId and initial url
put revBrowserOpen(tWinID,"") into sBrowserId
-- Set some basic properties for the browser
revBrowserSet sBrowserId, "showborder","true"
revBrowserSet sBrowserId, "rect",rect of image "browser image"
end browserOpen
on browserClose
revBrowserClose sBrowserId
end browserClose
on browserSetURL pURL
## Set the url to be displayed to the given url
revBrowserSet sBrowserId, "url", pURL --card id 1002: execution error at line n/a () near "unknown browser id"
end browserSetURL
revbrowser newbie
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: revbrowser newbie
Hi gwbasic,
looks like opening the browser object gives an error, so sBrwoserId is NO number lateron!
You can check this like this in your brwoseropen handler and act accordingly:
At least this will give you (us) a hint what might go wrong here!
Best
Klaus
looks like opening the browser object gives an error, so sBrwoserId is NO number lateron!
You can check this like this in your brwoseropen handler and act accordingly:
Code: Select all
...
on browserOpen
put the windowid of this stack into tWinID
-- Open the browser, using the windowId and initial url
put revBrowserOpen(tWinID,"") into sBrowserId
## Checkl NOW! :-)
## sBrwoserId will be a number on success and contain an error otherwise!
if sBrowserId is not a number then
answer "An error occured:" && sBrowserId
## We leave the handler(s) in this case!
exit to top
end if
...
end browserOpen
Best
Klaus
Re: revbrowser newbie
Hi Klaus...
I looked at this as well... I have got it to open a pdf, but only if the pdf is sitting next to the stack and even then not all pdf's that I put next to the stack will open... it also quits unexpectedly and gives the 'ignore', 'report' or 'reopen' dialog...
(harry doesn't feature here!)
be well
Dixie
I looked at this as well... I have got it to open a pdf, but only if the pdf is sitting next to the stack and even then not all pdf's that I put next to the stack will open... it also quits unexpectedly and gives the 'ignore', 'report' or 'reopen' dialog...
(harry doesn't feature here!)

be well
Dixie
- Attachments
-
- Untitled 1.rev.zip
- (1.41 KiB) Downloaded 274 times
Re: revbrowser newbie
Hi gwbasic,
I tried your script and get the same error if I dont initialize the browser in the opencard handler. This can happen if you script the stack and then try it without triggering the opencard message. To trigger the opencard message you could either just close and reopen the stack. Or if the stack only has one card add a card and go to that card and come back to your browser card. Or you could simply type "opencard" without quotes into the message box and hit the return key.
Could you try this?
Mind you I noticed that on a Mac 10.6.4 the browser did not open all PDFs. No idea why. So you might want to try different PDFs. The ones that dont work just stay empty, no error message.
regards
Bernd
I tried your script and get the same error if I dont initialize the browser in the opencard handler. This can happen if you script the stack and then try it without triggering the opencard message. To trigger the opencard message you could either just close and reopen the stack. Or if the stack only has one card add a card and go to that card and come back to your browser card. Or you could simply type "opencard" without quotes into the message box and hit the return key.
Could you try this?
Mind you I noticed that on a Mac 10.6.4 the browser did not open all PDFs. No idea why. So you might want to try different PDFs. The ones that dont work just stay empty, no error message.
regards
Bernd
Re: revbrowser newbie
Hi Dixie, Klaus and gwbasic
I found that the PDFs that I can not open in RevBrowser are the ones that have spaces in their title. I tried to put the path string into quotes -> no go.
urlencode the path string -> no go.
a search on the list turned up:
http://runtime-revolution.278305.n4.nab ... ml#a322437
the essence being to replace the space with "%20" in the file path, works for me. There might be other funny things in the filepath, who knows?
my code now looks like this:
regards
Bernd
I found that the PDFs that I can not open in RevBrowser are the ones that have spaces in their title. I tried to put the path string into quotes -> no go.
urlencode the path string -> no go.
a search on the list turned up:
http://runtime-revolution.278305.n4.nab ... ml#a322437
the essence being to replace the space with "%20" in the file path, works for me. There might be other funny things in the filepath, who knows?
my code now looks like this:
Code: Select all
answer file "Please choose the file you would like to display" with type "PDF document|pdf|PDF"
if it is not empty then
put it into tFile
replace " " with "%20" in tFile -- added this line
browserSetURL tFile
Bernd