Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 14 of 14
  1. #1
    Join Date
    Feb 2005
    Location
    Birmingham, Alabama
    Posts
    175

    Star Add shortcut for USB drive

    Hey guys,
    I was wondering if anybody could point me in the right direction.

    I have an app on a USB drive, I need it to place a shortcut in the start folder.

    I've tried using the Shell.CreateShortcut action, maybe I just don't have it quite right. It places the shortcut, but it points to the C: drive? even thought the app is on the usb drive and I used _SourceDrive? The app was running (obviously)

    Anybody?

  2. #2
    Join Date
    Aug 2003
    Posts
    2,427
    Is the scenario that you have an app on a USB and when you run it, you want it to create a shortcut to itself in the 'all users' or 'current users' startup folder i.e. in c:\documents and settings etc. etc.

    How about posting your code.

  3. #3
    Join Date
    Feb 2005
    Location
    Birmingham, Alabama
    Posts
    175
    Yes, that is the scenario. When the app runs it places a shortcut to itself in the "current user" start folder. NOTE: on the code below I have the desktop shown, but that is just for testing purposes.

    Code:
    Shell.CreateShortcut(Shell.GetFolder(SHF_DESKTOP), "Security Key", _SourceDrive.."\\lock.exe" , _SourceDrive.."\\", "", 0, SW_SHOWNORMAL, nil);
    I may have changed it since I tested it, I don't remember. What happened was it placed a shortcut on the desktop, but it had the path listed as C:

    Here is the problem in a nutshell, its a USB drive, so on my system it might be I: but on another system it might be D: or F: or whatever.

  4. #4
    Join Date
    Aug 2003
    Posts
    2,427
    try -

    Code:
    Shell.CreateShortcut(Shell.GetFolder(SHF_STARTUP), "Security Key", _SourceDrive.."\\lock.exe", "", _SourceFolder, _SourceFolder.."\\lock.exe", 0, SW_SHOWNORMAL);
    That works for me, not quite sure what Windows does if it can't find an app when it's booting though.

    Just checked again - see what you mean, the shortcut is created to C:\lock.exe - back to the drawing board ....
    Last edited by longedge; 02-21-2007 at 01:45 PM. Reason: It doesn't work.

  5. #5
    Join Date
    Aug 2003
    Posts
    2,427
    Just took the dog for a walk and had a think whilst walking

    You are building an executable file. When it runs, the runtime unpacks the whole thing temporarily to C: and so the place it is running from is actually C:

    Try the code below BUT then do a build NOT to .exe but to Hard Drive Folder and into the root of your USB drive. It works then.

  6. #6
    Join Date
    Feb 2005
    Location
    Birmingham, Alabama
    Posts
    175
    Well, my head is done for the day, I might pick it up later tonight - I think I'll go to the gym, it's not walking the dog but maybe it will help!

    thanks.
    PS - so I need to build the project DIRECTLY to the USB drive?

  7. #7
    Join Date
    Aug 2003
    Posts
    2,427
    Quote Originally Posted by thetford View Post
    so I need to build the project DIRECTLY to the USB drive?
    Well you don't *have* to build it to the USB you can build it anywhere but it's easiest because you would otherwise have to move it there anyway. The two important points are that it runs from the USB and it is NOT an exe.

  8. #8
    Join Date
    Feb 2005
    Location
    Birmingham, Alabama
    Posts
    175
    Right - I tried it, your right it works. Only it creates a new problem, this is a security program, it places activation files on the users system (well, if they have the correct serial no.)

    So, now I will have to encrypt the files, or protect them in some manner.

    thanks for the help, you are my only allie in this endeavor

    PS - Do you have\need a website? I have tons of server space leased from netfirms, I can host free of charge in return for all of your help.
    Mike
    Last edited by thetford; 02-22-2007 at 07:18 AM. Reason: add post script

  9. #9
    Join Date
    Aug 2003
    Posts
    2,427
    Quote Originally Posted by thetford View Post
    PS - Do you have\need a website? I have tons of server space leased from netfirms, I can host free of charge in return for all of your help. Mike
    Thanks for the offer but I don't have any need. I already have more space than I use but I'll bear it in mind because you never know

    If I understand what you are saying about the security files, you could perhaps zip them in a separate file passworded and then use the AMS Zip.Extract action when you've done your checking. Just a thought.

  10. #10
    Join Date
    Feb 2005
    Location
    Birmingham, Alabama
    Posts
    175
    Well, I took the plunge, upgraded to AMS6.0, at least I paid for it

    I haven't recieved my download link yet. probably will tommorrow

    Just curious, what type of work do you do longedge?

  11. #11
    Join Date
    Aug 2003
    Posts
    2,427
    Quote Originally Posted by thetford View Post
    Just curious, what type of work do you do longedge?
    I'm retired - well nearly, I have a part time job in general IT Support in our Local Education Dept. but it's one of those jobs that covers anything that needs doing in our section although I do get all the Audio, Video, Media Duplication & Database stuff

  12. #12
    Join Date
    Feb 2005
    Location
    Birmingham, Alabama
    Posts
    175
    That sounds like a pretty good deal.

    Me, just trying to make it as a surveyor\contrctor. Been on my own for over a year. I like computers & programming, so I paractice with AMS and REALbasic, I've gone much further with AMS. lua scripting is so much easier than basic language. (well imo).

    The things that dumb*sses like me can do with computers these days!
    I noticed you are from UK, ever been to Thetford? That is where I am from, but I've never been there.

  13. #13
    Join Date
    Feb 2005
    Location
    Birmingham, Alabama
    Posts
    175
    alright, need a little more help on this project...... When the USB drive is inserted, it runs an app already installed on the PC.

    PROBLEM: what if the user unplugs the USB drive & then plugs it back in - the app is still running from the first time the drive was plugged in.

    How do I get the USB drive to check if the application is running before launching it?

    Almost thru.... if I can figure this out I am home free for now!

  14. #14
    Join Date
    Aug 2003
    Posts
    2,427
    I would guess that the Window.EnumerateTitles action is where you should be looking. Not something I've ever used myself but it should enable you to determine if another instance of your app is already running and if so, exit.

Similar Threads

  1. _code_templates.xml - Add Code - Shortcut
    By Intrigued in forum AutoPlay Media Studio 6.0
    Replies: 8
    Last Post: 04-17-2006, 04:58 PM
  2. Add Shortcut to Start Menu
    By rFactor in forum Visual Patch 2.0
    Replies: 1
    Last Post: 10-24-2005, 05:11 PM
  3. HOWTO: Uninstall a Shortcut Created with Actions
    By Support in forum Setup Factory 6.0 Knowledge Base
    Replies: 0
    Last Post: 09-25-2002, 09:50 AM
  4. HOWTO: Create a Shortcut on the Desktop
    By Support in forum Setup Factory 6.0 Knowledge Base
    Replies: 0
    Last Post: 09-19-2002, 02:56 PM
  5. Shortcut storing UNC instead of Mapped drive
    By jassing in forum Setup Factory 5.0
    Replies: 2
    Last Post: 11-13-2001, 11:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts