Jump to content

Recommended Posts

Posted

There's FileOpen, but is there something like... 'FolderOpen'?

I want to place a short script to open/delete a specific folder in the task bar context menu(my app's) but don't know how to do it.

Please advise.

FileSelectFolder(), along with DirCopy(), DirMove(), and DirRemove() should do it.

<_<

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
  • 1 month later...
Posted

There's FileOpen, but is there something like... 'FolderOpen'?

I want to place a short script to open/delete a specific folder in the task bar context menu(my app's) but don't know how to do it.

Please advise.

Where you want to open it? Explorer, GUI, potato or else?

I can do signature me.

Posted

There's FileOpen, but is there something like... 'FolderOpen'?

I think part of your confusion lies in misunderstanding what FileOpen() does.

What FileOpen() CAN do:

-Lock a file so that no other applications can write to it until you FileClose() it

-create a handle referencing the opened file so your script can change its data

-create a handle referencing the opened file so your script can read its data, either as raw data or as a string.

What FileOpen() DOES NOT do:

-Cause the file's contents to be shown on your screen

-Open the file in another program (like Word or Internet Explorer)

Does that make sense? For this reason, there is no need to have a FolderOpen() command, because essentially a folder is just a path to files (a string).

Now, here's a run-down of when to use each of the commands pointed out to you in previous posts in this thread:

-If you want to ask the person running your script to PICK a folder, use FileSelectFolder()

-If you want to display the contents of a folder on the screen in an Explorer window, use ShellExecute($path) or Run("explorer.exe "&$path), where $path is a variable which has already been defined as holding a string - the folder's path. For instance, $path="C:\Program Files\AutoIt"

-If you want to do something to everything in that folder, use DirCopy(), DirMove(), or DirRemove(), depending on what you want to do.

-If you want to lock the folder, you could try Run(@ComSpec & " \c attrib " & $path & " +r") to make it read-only.

-If you want to "open" a folder in a program that has that ability, use run("FolderOpeningProgram.exe " & $path)

Does that help?

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110

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
×
×
  • Create New...