Quantcast

Maximum PC

It is currently Tue Sep 16, 2014 5:32 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Trouble with autorun
PostPosted: Tue Dec 01, 2009 4:48 pm 
8086
8086

Joined: Thu Jul 30, 2009 7:49 am
Posts: 74
I recently created a small, simple app to help my sister get the pictures from her digital camera to her pictures file. I have confirmed the .exe works, and would like to set it to run whenever she plugs in the camera, but can't get it to work, and don't know why. I am using Windows XP SP3, and used TweakUI to set autorun to work on removable drives. It also does not work when I just put in the SD card. The autorun.inf is below, any and all help will be greatly appreceated.

Quote:
[autorun]
open=CameraThing.exe


Top
  Profile  
 
 Post subject:
PostPosted: Sat Dec 05, 2009 5:59 am 
Team Member [Top 500]*
Team Member [Top 500]*
User avatar

Joined: Thu Jun 24, 2004 2:22 pm
Posts: 8720
Location: Cleveland, Ohio
Where exactly are you placing the autorun.inf?

Ron


Top
  Profile  
 
 Post subject:
PostPosted: Sat Dec 05, 2009 9:58 am 
8086
8086

Joined: Thu Jul 30, 2009 7:49 am
Posts: 74
at the root of the sd card's file directory.


Top
  Profile  
 
 Post subject:
PostPosted: Sat Dec 05, 2009 3:33 pm 
Team Member [Top 500]*
Team Member [Top 500]*
User avatar

Joined: Thu Jun 24, 2004 2:22 pm
Posts: 8720
Location: Cleveland, Ohio
That won't work the way you are doing it. You want something like this:

Code:
[autorun]

shellexecute=OpenFolder.VBS


The OpenFolder.VBS would also be on the root of the media card and look like this:

Code:
Const MY_COMPUTER = &H11&
Const WINDOW_HANDLE = 0
Const OPTIONS = 0

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(MY_COMPUTER)
Set objFolderItem = objFolder.Self
strPath = objFolderItem.Path

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder _
   (WINDOW_HANDLE, "Select a folder:", OPTIONS, strPath)
     
If objFolder Is Nothing Then
    Wscript.Quit
End If

Set objFolderItem = objFolder.Self
objPath = objFolderItem.Path

Wscript.Echo objPath


That is just a very broad example. IN the case of your "open=CameraThing.exe" the camera thing execute would also need to be in the root of the media card. If the camera thing isn't in the root of the card and on the local machine then it won't work.

You can play around with the shell.exe with a file path to the local machine to run your exe and see what works. I haven't tried it. All I did was use shell.exe to point to a VBScript file and run it which opens a folder browser.

Still not sure where you are going with this as when you place a camera media card in the system it should ask you what you want to do? Also anytime the camera card is formatted it will blow away the AutoRun and any other embedded files.

Ron


Top
  Profile  
 
 Post subject:
PostPosted: Sat Dec 05, 2009 8:00 pm 
8086
8086

Joined: Thu Jul 30, 2009 7:49 am
Posts: 74
Thank you, I have it working, however, you still have to click on the camera in My Computer to get it to run. This is for a less tech savy relative, and I would like it to run automaticaly when she plugs it in. Is there any way to get that working, or is that asking too much?


Top
  Profile  
 
 Post subject:
PostPosted: Sun Dec 06, 2009 7:51 am 
Team Member [Top 500]*
Team Member [Top 500]*
User avatar

Joined: Thu Jun 24, 2004 2:22 pm
Posts: 8720
Location: Cleveland, Ohio
The only way I can think of (and I am far from a programmer type) would be a small script that always ran in the background (VBS or maybe a batch file) that when the camera was connected would trigger and launch your already written code.

That is relatively east with a process starting but I noticed when I connect my camera (USB) to my system it doesn't trigger a process. Then I tried a USB approach looking for a new USB device connected to trigger starting something. I didn't do to well on that note.

Starting or Stopping a process based on another process starting or stopping isn't really that difficult. The problem is nailing down something that happens when the camera is connected and using it as a trigger.

Ron


Top
  Profile  
 
 Post subject:
PostPosted: Sun Dec 06, 2009 10:20 am 
8086
8086

Joined: Thu Jul 30, 2009 7:49 am
Posts: 74
Ok, thanks.


Top
  Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group