kylek29 Posted August 17, 2007 Share Posted August 17, 2007 (edited) I know this has been discussed (infact, I've searched for a few hours), but the solutions offered were either partial or didn't work with my needs. Basically, I'm scripting a GUI Menu that will autoexec when a USB Flashdrive is put in (it resides on the USB Flashdrive). This menu has links to programs on the Flashdrive, these programs/links often require a drive letter assignment that is static. So I always assign drive "P" (for Portable). Which leads me to the script ... I'm looking for something that when the program is initially ran, will check to see if A) "P" is available as a drive letter, and if "P" is already assigned to the current USB key (program resides on USB key). If P is available and is not assigned, it will then change the current drive letter (for USB drive) to letter "P:". I thought about having it run just drive-management so I could manually change it, but that sorta defies the whole point of the script. Any ideas? Maybe I missed a few threads. There was one where the guy had the exact thing, but only partial code was up. I don't have any code examples because I don't even know where to begin on this, it's a tad over my head Edited August 17, 2007 by kylek29 Link to comment Share on other sites More sharing options...
Monamo Posted August 17, 2007 Share Posted August 17, 2007 (edited) I know this has been discussed (infact, I've searched for a few hours), but the solutions offered were either partial or didn't work with my needs. Basically, I'm scripting a GUI Menu that will autoexec when a USB Flashdrive is put in (it resides on the USB Flashdrive). This menu has links to programs on the Flashdrive, these programs/links often require a drive letter assignment that is static. So I always assign drive "P" (for Portable). Which leads me to the script ...I'm looking for something that when the program is initially ran, will check to see if A) "P" is available as a drive letter, and if "P" is already assigned to the current USB key (program resides on USB key). If P is available and is not assigned, it will then change the current drive letter (for USB drive) to letter "P:". I thought about having it run just drive-management so I could manually change it, but that sorta defies the whole point of the script.Any ideas? Maybe I missed a few threads. There was one where the guy had the exact thing, but only partial code was up. I don't have any code examples because I don't even know where to begin on this, it's a tad over my head Is there a reason for you not to use relative paths (instead of absolute paths)? If it's a matter of executing applications on your flash drive, I'd just pop your GUI menu executable into the root of the drive, then for each of your programs you want to launch, just use @ScriptDir\Program folder\program.exe Edited August 17, 2007 by Monamo - MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup] Link to comment Share on other sites More sharing options...
weaponx Posted August 17, 2007 Share Posted August 17, 2007 I would just modify your menu to accept a drive letter as a command line paramater and then have the autorun script pass @ScriptDir to it. Link to comment Share on other sites More sharing options...
kylek29 Posted August 17, 2007 Author Share Posted August 17, 2007 (edited) Is there a reason for you not to use relative paths (instead of absolute paths)? If it's a matter of executing applications on your flash drive, I'd just pop your GUI menu executable into the root of the drive, then for each of your programs you want to launch, just use @ScriptDir\Program folder\program.exeSome programs have configurations that require a static path (old programs) for other items it calls. Plus, I want it to be compatible with shortcuts on the desktop. For example, at work. I have the initial launch of some programs looking in the directories below it with @ScriptDir, so I can launch things fine even if it is assigned "E:".Another example would be WMP. One thing I use the Flashdrive for at work is to store music. Windows Media Player (on the PC) references the "P:\Music" for the library, as do other programs (with differing files). In the long run, it's just easier to have it always assigned to "P" if available. Edited August 17, 2007 by kylek29 Link to comment Share on other sites More sharing options...
MISIIM Posted August 17, 2007 Share Posted August 17, 2007 See this http://www.microsoft.com/resources/documen...t.mspx?mfr=true Link to comment Share on other sites More sharing options...
kylek29 Posted August 17, 2007 Author Share Posted August 17, 2007 See this http://www.microsoft.com/resources/documen...t.mspx?mfr=trueI can do that. But for the command, can I use @ScriptDir to have it automatically find it's current drive letter? I'll play with it. Link to comment Share on other sites More sharing options...
kylek29 Posted August 18, 2007 Author Share Posted August 18, 2007 Easily got it to map P: to a drive. However I still can't figure out how to get it to pull the current drive - this will change on each PC I enter the Flashdrive into - still a little n00bish on some of this stuff. I was *hoping* it'd be as easy as run("subst p: @ScriptDir\") ... Link to comment Share on other sites More sharing options...
kylek29 Posted August 21, 2007 Author Share Posted August 21, 2007 No-one? Eh .. oh well. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now