Jump to content

Help getting the drive letter


 Share

Recommended Posts

This is my first post, I'm not too familiar with AutoIT, but for what I have seen, it looks awsome.

I'm working on a bakup script, I want to be able to click on a Drive in (Folder Browser), and get the drive letter to show up on an Input box.

I want just the drive letter C not C:\ . Can anyone help me?

Any sugestions will be greatly appreciated. :P

Link to comment
Share on other sites

This is my first post, I'm not too familiar with AutoIT, but for what I have seen, it looks awsome.

I'm working on a bakup script, I want to be able to click on a Drive in (Folder Browser), and get the drive letter to show up on an Input box.

I want just the drive letter C not C:\ . Can anyone help me?

Any sugestions will be greatly appreciated. :P

do you have any code written already? i mean just so we don't have to create the whole script to show you the one part you're interested in... if you know how to get C:\ then you could just StringLeft($that,1) to get the letter...
Link to comment
Share on other sites

do you have any code written already? i mean just so we don't have to create the whole script to show you the one part you're interested in... if you know how to get C:\ then you could just StringLeft($that,1) to get the letter...

Here's the Code.

Case $msg = $SelFolderBTN

$Path = FileSelectFolder("Choose a folder.", "")

GuiCtrlSetData($Textbox_1, $Path)

Link to comment
Share on other sites

  • Moderators

I think this will work:

$FullPath = FileSelectFolder("Choose a folder.", "")
$ShortPath = StringLeft($FullPath, 1)
GuiCtrlSetData($Textbox_1, $ShortPath)

It does, you can test it with this:

$FullPath = FileSelectFolder("Choose a folder.", "")
$ShortPath = StringLeft($FullPath, 1)
MsgBox(0, "Test", $ShortPath)
Edited by big_daddy
Link to comment
Share on other sites

I think this will work:

$FullPath = FileSelectFolder("Choose a folder.", "")
$ShortPath = StringLeft($FullPath, 1)
GuiCtrlSetData($Textbox_1, $ShortPath)

It does, you can test it with this:

$FullPath = FileSelectFolder("Choose a folder.", "")
$ShortPath = StringLeft($FullPath, 1)
MsgBox(0, "Test", $ShortPath)
YESSSS, Thank you big_daddy, you just saved my day. :P
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...