Jump to content
Sign in to follow this  
Doppio

Help getting the drive letter

Recommended Posts

Doppio

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

Share this post


Link to post
Share on other sites
seandisanti

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...

Share this post


Link to post
Share on other sites
Doppio

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)

Share this post


Link to post
Share on other sites
big_daddy

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

Share this post


Link to post
Share on other sites
Doppio

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

Share this post


Link to post
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
Sign in to follow this  

×