Searched and still need help with Internet Connect...

Hello All,

My name is Scott Audette and I am a complete apple script newbie. I am working on project for a photography client of mine that requires some use of Applescript. I have searched your message boards and Apple.com for the answers to no avail. I just simply am not grasping the language of applescript. And the obvious problems there seems to be scripting internet connect. I’ve looked at some the scripts on this site and understand some of the form.

BUT I want to create this script myself. I certainly could use some advice and direction. I am placing a digital camera in a very exciting remote location ( if it works I will let everyone know where).

A. My powerbook will boot up at a set time. After a short time is elapsed the camera will be triggered by sound and will transfer its images to my powerbook via a Canon FTP transmitter. The camera is connected via ethernet and will use the OS X built in ftp software to receive the images.

B. I then need an apple script to turn on and connect to the internet via an EVDO wireless broadband card at a set time. This script could be triggered two ways…either via a delay built in to the script itself. I would load the script to the login list or via inclusion in an ical automator action.

C. I am leaning towards to automator action calling the internet connect applescript primarily because I already have an ftp workflow that will upload the files to an ftp server automatically.

That’s it an a nutshell. This project is a backup to our first solution. And I know there are easier solutions but unfortunately after exstensive testing we believe the cell towers in the area are being turned off during the events “window” hint, hint. ; ) And are back on minutes later.

I am running OS 10.4.7

I look forward to hearing from some you that might help,

Scott Audette
Photojournalist

Model: Powerbook G4 1.67
AppleScript: 1.10.7
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

Let’s see if I get this -

The camera talks to the Canon transmitter via firewire, and the transmitter sends the picture via FTP over WiFi, being set to do this automatically. Presumably you’ll have a huge flash card in the camera because the click and send process will come to a halt when the card is full - the transmitter doesn’t remove the images, and battery life sets a 3-hour limit according to this web site.

The Laptop has a WiFi (AirPort) card and I assume you’re planning to use the built-in ftp server, so some of your question is how to do the equivalent of going to system prefs to enable FTP Access (in Sharing), and then to the Firewall tab to allow FTP through the firewall, and to the internet tab to turn on the EvDO wireless card (for which you have the appropriate drivers??) and your Airport card. I assume this is also modeled after the SportShooter site’s review. Since you want your Laptop to play both parts (receive image on one device and send on another) you’ll have to be able to switch between them (the Mac can’t do both at the same time without some software in between) so you can receive and store a picture, then send it, then go get another.

Given that the hardware will cooperate, this should be doable, but may be difficult.

My advice: don’t try to do this in one gulp - do the parts one at a time, and ask how to do them. Hopefully, this will intrigue some folks who know how to do it.

Adam,

Thanks for your reply. We have done a bunch of research and have most of the bugs worked out with the Canon stuff. We have used the Canon system at the Olympics, Politcal Conventions, etc. It just where we are doing this just plain doesn’t allow for the traditional ethernt or wifi network.

We have made this sytem work on-site without a laptop using an EVDO router instead. The problem is we are our losing connnectivity with the EVDO providers at some point. And even though the systems are supposed to reboot, they don’t. And once the cameras are locked down it is impossible to revisit them. Except for if the event gets postponed a day or two.

So, that brings me here today. We have another system we are working with but it may not be ready in time for this event late next week. Here is also some information to help clarify things.

A. The Canon transmitter is connected via ethernet to Powerbook. Wifi is too much of power draw. And we are also using usb to connect to the cameras. Also the three hours if it is transmitting non-stop, which we are not.

B. The camera is sound triggered during this “event” and it will at most shoot thirty to forty frames. We’ve been covering this particular event for a long time and in the old days forty pix would have meant you missed the pic. :wink: I’m sorry to be so vague but this is a high profile event and our competitors would love to read about all the research we’ve done and tested. If this works I will be sure to share the news with you all, promise!

C. Battery power is a non-issue. Over years of doing this we developed clean power sources that last for days running a laptop in the field. The cameras all run off this source. As of today I have managed to keep a camera live and sending pictures via ethernet in 95 degree heat for two days with plenty of juice left :slight_smile:

D. FTP : Ftp file sharing is turned on and doesn’t need to be scripted at all. It will stay on with no problem. The laptop itself is assigned a static ip for ethernet only. The Canon FTP transmitter will send to that ip address.

We are using Transmit for the FTP outbound and thank goodness the folks at Panic love applescript. Transmit will watch a folder and when it sees pictures in there it will connect to a remote ftp and send them. But the connection needs to be up and running.

So, where I stand now is needing to work on a script that will allow me to connect to our EVDO card thru internet connect. I’d could could certainly use some help from the guru’s around here… Then I need to make the connnection happen like 50 minutes after bootup.

Some more details for those of interest would be that I will setup the configuration for the networks as my default. So it will only have the ethernet info and the EVDO card info. Oh, and the EVDO card driver is built in to most recent version of Tiger and can be triggered via internet connect.

If anybody’s game for the challenge or more questions I can also be reached at scott at scottaudette.com.

Thanks for the interest.

Scott

Startup 50 minutes after boot is probably most easily done like this: (saved as a stay-open application, and included in Accounts>Login Items)


on run -- this runs immediately
	set c to false
end run

on idle -- followed by this (which runs the first time right after 'on run')
	if c then
		run script (path to myScript)
		quit
	else
		set c to true -- so c is set at startup to true without running the other script
	end if
	return 3000 -- these are seconds -- 50 minutes later, the 'on idle' runs again with c now true, and starts the other script
end idle

Now, assuming you can do the process you want to code ‘by hand’, describe in some detail just what you do. As I understand it, when you get a picture in the receiving folder, Transmit wants to do it’s thing, but the ethernet is set to en0 to receive the picture and needs to be reset to EvDO for the duration of the transmission, and then back to en0 when the pic has been sent by Transmit. Is that it?

Perhaps the easiest way to do this is to switch locations. Set up one network location for the camera, another for Transmit. You should be able to see them all with this. The one that starts with an asterisk is the current one and is identified in the script.


to getLocNames()
	set locNames to {}
	try
		do shell script "scselect"
	on error Loc
	end try
	set myLocs to paragraphs 2 thru -2 of Loc
	repeat with aLoc in myLocs
		set tid to AppleScript's text item delimiters
		set AppleScript's text item delimiters to "("
		set temp to last text item of aLoc
		set AppleScript's text item delimiters to tid
		if "*" is in contents of aLoc then
			set end of locNames to "*" & text 1 thru -2 of temp
		else
			set end of locNames to text 1 thru -2 of temp
		end if
	end repeat
	return locNames
end getLocNames

set Locs to getLocNames()
repeat with anItem in Locs
	if "*" is in anItem then set CurrLoc to text 2 thru -1 of anItem
end repeat

To set them, you do shell script "scselect " & tNameOfNewLoc

Adam,

Here is some more detail for you:

The camera comes on at set time along with the laptop. The camera will only fire when the sound arrount it reaches a certain db threshold. This only happens for about 30 to 40 frames. The plan here is to wait until the camera has sent all the photos to the laptop BEFORE transmitting anything. The transmission would start only after a set time period i.e. 50 minutes from bootup. Which would be like 15 minutes post event.

We are 99.9% sure our signal is being blacked out during the event and it returns minutes after it is over. So, in answer to part of your question no I don’t have to switch back to ethernet once the EVDO starts at all. I would do this manually in event that I had to reset everything.

Our thinking is definetly aligned on how I think this should work. I would have two “locations” setup. One that would be the default at bootup to handle the incoming ftp photos. At the same time the timed delay script would start at the end of the delay it would change locations to the EVDO setup. Another short delay to make sure we have a connection and then Transmite would start.

Now my plan for Transmit isactivate it as an automator workflow via ical. This would give me more control over timing. I’m open to all ideas…

Scott

Assuming that the event gets substantial news coverage, the signal may not be blacked out at all - it may just be swamped but reporters filing stories and photos of their own from the floor and all trying to use the same channel.

I’m not an Automator guy, so I can’t help you there.

Use my script above to get the names of the locations (as the computer lists them), and then in your workflow add this little script to change the selection:


set newLoc to "theNameHere"
do shell script "scselect " & quoted form of newLoc