opening files created by my app

Jan Schenkel janschenkel at yahoo.com
Thu Jun 30 17:03:44 EDT 2005


--- Langers Christian <christian.langers at education.lu>
wrote:
> Hello everybody,
> 
> how do I do to have my app read it's own created
> data upon startup ?
> e.g. when double-clicking a text file, the text is
> loaded into the
> Textedit (on Mac)...
> 
> I manage to link the created file to open my app,
> but not to read its
> content...
> 
> So, if anybody could give me a hint...
> 
> 
> 
> Thanks,
> 
> 
> Christian
> 


Hi Christian,

When the user opens one of your files, the MacOS will
send you an appleEvent of class "aevt" and ID "odoc".
So you would add a handler to your mainStack:
--
on appleEvent pClass, pID
  if pClass is "aevt" and pID is "odoc" then
    -- the file path is in the appleEvent data
    request appleEvent data
    put it into tFilePath
    -- do what it takes to open your file
  else
    -- very important, pass if you don't handle it
    pass appleEvent
end appleEvent
--

Hope this helped,

Jan Schenkel.

Quartam - Tools for Revolution
<http://www.quartam.com>

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)


		
__________________________________ 
Yahoo! Mail Mobile 
Take Yahoo! Mail with you! Check email on your mobile phone. 
http://mobile.yahoo.com/learn/mail 



More information about the use-livecode mailing list