Associated File Launching a Standalone or Handling Associated File Input
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 6
- Joined: Thu Jan 17, 2019 7:37 pm
Associated File Launching a Standalone or Handling Associated File Input
What message shows up when another app or associated file sends the launch command to my app?
I'm building an app to receive images from a camera. The camera app (EOS Utility) has the option to associate another app. Most apps (photoshop etc.) will just open the newly downloaded image file. I don't know what message to handle when I associate my own app. I tried "launchDataChanged" My app just launches and every time a new file is sent, it launches another instance of the app. I don't see anything in the Message Watcher if I associate the Livecode IDE to open the files.
I can capture the filepath by using the "on startup" and $1 But a new instance of my app is started every time I double click a new file?
Thanks!!
I'm building an app to receive images from a camera. The camera app (EOS Utility) has the option to associate another app. Most apps (photoshop etc.) will just open the newly downloaded image file. I don't know what message to handle when I associate my own app. I tried "launchDataChanged" My app just launches and every time a new file is sent, it launches another instance of the app. I don't see anything in the Message Watcher if I associate the Livecode IDE to open the files.
I can capture the filepath by using the "on startup" and $1 But a new instance of my app is started every time I double click a new file?
Thanks!!
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Associated File Launching a Standalone or Handling Associated File Input
The relaunch message allows you to control whether you want one or multiple instances of your app running when launched with documents on Windows:
https://livecode.com/resources/api/#liv ... t/relaunch
https://livecode.com/resources/api/#liv ... t/relaunch
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
-
- Posts: 6
- Joined: Thu Jan 17, 2019 7:37 pm
Re: Associated File Launching a Standalone or Handling Associated File Input
Thank you so much!
Now I'm working on making this work on the Mac. is on appleEvent the best way to do this?
I'm actually trying to get EOS Utility (Canon Camera Software) to use my app as a linked app to open newly downloaded camera files. I only need the filename. If I use an on appleEvent it gives me the path when dropping an image on the standalone icon manually, or when associating the file from the finder and double clicking, but EOS Utility gives me an error "The application can't be launched" So I'm missing something in communicating through apple events somehow. Here's what I've been playing with. Is there another way to do something like this?
Thanks
on appleEvent pClass, pEventID, pSender
if pClass is "aevt" then
request appleEvent data
put it into tFilename
put tfilename into field "Field1"
if pEventID is "odoc" then
put tfilename after field "display"
end if
end if
pass appleEvent
end appleEvent
Now I'm working on making this work on the Mac. is on appleEvent the best way to do this?
I'm actually trying to get EOS Utility (Canon Camera Software) to use my app as a linked app to open newly downloaded camera files. I only need the filename. If I use an on appleEvent it gives me the path when dropping an image on the standalone icon manually, or when associating the file from the finder and double clicking, but EOS Utility gives me an error "The application can't be launched" So I'm missing something in communicating through apple events somehow. Here's what I've been playing with. Is there another way to do something like this?
Thanks
on appleEvent pClass, pEventID, pSender
if pClass is "aevt" then
request appleEvent data
put it into tFilename
put tfilename into field "Field1"
if pEventID is "odoc" then
put tfilename after field "display"
end if
end if
pass appleEvent
end appleEvent
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Associated File Launching a Standalone or Handling Associated File Input
Are you building the Mac app on a Mac, or on Windows and copying it over?
If the latter, you may need to set the executable bit of the executable within the bundle.
If the latter, you may need to set the executable bit of the executable within the bundle.
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
-
- Posts: 6
- Joined: Thu Jan 17, 2019 7:37 pm
Re: Associated File Launching a Standalone or Handling Associated File Input
Thanks!
I'm building the mac on a mac and the windows on windows as I couldn't get it to launch otherwise. I have just figured out what makes it work. For some reason I have to do something with the pSender. I added this line to the start of the apple event handler and it all works. I'm not doing anything with the field. I was just trying to see what info was being passed.
put pClass & " "& pEventID & " " & pSender into field "pClass"
So now I'm moving along in my project.
Thanks for your great help
Jon
I'm building the mac on a mac and the windows on windows as I couldn't get it to launch otherwise. I have just figured out what makes it work. For some reason I have to do something with the pSender. I added this line to the start of the apple event handler and it all works. I'm not doing anything with the field. I was just trying to see what info was being passed.
put pClass & " "& pEventID & " " & pSender into field "pClass"
So now I'm moving along in my project.
Thanks for your great help
Jon
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Associated File Launching a Standalone or Handling Associated File Input
Glad that worked out. Keep us posted if there's anything else we can help with.
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