 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
DataLife
Joined: 27 Apr 2008 Posts: 13
|
Posted: Sun Jul 20, 2008 1:37 am Post subject: Bug? Blank variable return on FileSelectFolder |
|
|
I want to copy or move a file I saved in a variable using FileSelectFolder. If a user presses cancel the outputvar is blank.
Here is the problem.
The outputvar is also blank if a user presses the recycle bin or only selects the top folder for My Computer, My Network Places, and top level for Entire Network.
I check for a blank variable and treat it as the user pressing Cancel.
But if they choose one of the others by mistake it appears to copy or move the file normally but of course it does not. Just looks that way to the user.
I also store the selected folder in a variable for later use. So I would like to know if the folder they chose is valid when they choose it.
FileSelectFolder should not let the user select an item that is not a folder.
How can I determine if they pressed cancel or chose one of the others that also returns a blank variable?
thanks
DataLIfe |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5790
|
Posted: Sun Jul 20, 2008 2:08 am Post subject: Re: Bug? Blank variable return on FileSelectFolder |
|
|
| DataLife wrote: | | How can I determine if they pressed cancel or chose one of the others that also returns a blank variable? |
You have to check both:
1) Whether the variable content is null
2) Whether an ErrorLevel has been set
Try the following demo:
| Code: | Loop {
FileSelectFolder, FolderN,,, Choose a Folder
If ( ErrorLevel=0 && FolderN="" )
{
MsgBox, 16, Choose Folder, What you chose is not a valid Folder.. Retry!, 5
Continue
}
Else If ( ErrorLevel=1 )
{
MsgBox, 16, Choose Folder, You chose to cancel the dialog!, 5
Break
}
Else
{
MsgBox, 32, Choose Folder, You chose the following folder:`n%FolderN%, 5
Break
}
} |
 _________________ SKAN - Suresh Kumar A N |
|
| Back to top |
|
 |
DataLife
Joined: 27 Apr 2008 Posts: 13
|
Posted: Sun Jul 20, 2008 2:56 am Post subject: |
|
|
thanks very much, I was stuck on the blank variable and forgot about the errorlevel.
that works
DataLife |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|