'Open In...' doc handling

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
seaniepie
Posts: 154
Joined: Wed Sep 07, 2011 10:56 am

'Open In...' doc handling

Post by seaniepie » Fri Jan 04, 2013 2:22 pm

Hi all,

I'm working on a plan to have a doc open from safari into myApp using the Open In/With dialogue. By hacking the 'Settings.plist' files in /Applications/LiveCode 5.5.3.app/Contents/Tools/Runtime/iOS I can add in the file association (filetype) for the doc types I am trying to handle.

What I need to work out now is what happens when someone tries to open the doc from Safari into myApp. How does myApp know that it is being handed a file? Does anyone here have some experience with this?

Thanks in advance.

Pi

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: 'Open In...' doc handling

Post by monte » Sat Jan 05, 2013 2:51 am

Urlwakeup should be sent with the local file URL
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

seaniepie
Posts: 154
Joined: Wed Sep 07, 2011 10:56 am

Re: 'Open In...' doc handling

Post by seaniepie » Sat Jan 05, 2013 3:13 am

Thanks Monte
works a treat
Pi

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: 'Open In...' doc handling

Post by monte » Sat Jan 05, 2013 10:01 pm

No problem. If you want to send the Doc from your app to others then there's mergDoc or mergPop
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Re: 'Open In...' doc handling

Post by Nakia » Fri Feb 01, 2013 9:48 am

Is there any reason I cant just do a mergShowDocPreview pURL using urlWakeUp pURL?
When I do this the preview never loads..

Is this because pURL contains the full file path and doesn't use specialFolderPaths etc?
also
I am using this following line to save the file but it has no size when it creates the file
put URL pURL into URL ("file://" & specialFolderPath(Documents) & "/Completed/Commissions/" & tUnit & "-" & tDate & ".doc")

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: 'Open In...' doc handling

Post by monte » Fri Feb 01, 2013 10:21 am

Hmm, not sure. Maybe try answer URL purl to show yourself the file contents and make sure there's data there.
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Re: 'Open In...' doc handling

Post by Nakia » Fri Feb 01, 2013 10:59 am

Hmm, yeah it didn't seem to like the full file name (localhost/var/appid/docs/inbox etc etc)
A bit of filtering on pURL and it all works fine now but it was a bit of a PITA

Jellicle
Posts: 453
Joined: Thu Feb 24, 2011 11:07 am

Re: 'Open In...' doc handling

Post by Jellicle » Wed Feb 20, 2013 3:43 am

Nakia, how did you filter the pURL so the file was accessible?

Cheers

Gerry
14" MacBook Pro
Former LiveCode developer.
Now recovering.

Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Re: 'Open In...' doc handling

Post by Nakia » Fri Feb 22, 2013 10:15 am

Hi Gerry,

Not at the computer right now but from memory I think I just used some chunk expressions
to get the file name out of pURL and from there made the observation that the files are always placed in the
Same folder (Documents/Inbox from memory) so just referenced that when using the file..

Jellicle
Posts: 453
Joined: Thu Feb 24, 2011 11:07 am

Re: 'Open In...' doc handling

Post by Jellicle » Sat Feb 23, 2013 2:38 am

Ahhhh. For some reason I thought the attachment I was after was not in my app's directory. I just didn't read the URL properly. Silly me. Ok, it's trivial now :)

Thanks

Gerry
14" MacBook Pro
Former LiveCode developer.
Now recovering.

williamdesmet
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 67
Joined: Tue Jun 26, 2012 7:07 pm

Re: 'Open In...' doc handling

Post by williamdesmet » Thu Feb 28, 2013 5:36 pm

Hi, can you tell me how you did this exactly?
When I follow your suggestion I still have to choose a folder (Device or Simulator) before I see the Settings.plist.
And when I try to open the .plst in Xcode I get an error "The data couldn't be read because it has been corrupted".
I never touched this file before.
Doesn't make a difference for LC 5.5.3. or LC 5.5.4.
I am on OS X 10.8.2.

Greetings,

William

Post Reply