Jump to content

How to find selected file name and path in windows explorer


kcvinu
 Share

Recommended Posts

Hi there,

I have a few download folders and they contains hundreds of downloaded files. So i need to cut each file and make a new folder there and paste my file inside that folder. This is the steps to automate;

1. If i select a file in win explorer and right click it, then i need a context menu option there. ("Move file into      folder")

2. If i select the context menu item, then 

 2 a. Find the name of the selected file

 2 b. Cut the file and create a new folder there.

 2 c. Rename the folder with the filename(i.e. if file name is "Winrar_setup_32_Bit.exe", then the folder name should be "Winrar".

 2 d. Paste the file inside the folder. 

For this task, i know;

1. how to create a folder

2. how to cut n number of letters from file name with StringLeft()

And i don't know;

1. how to make a context menu entry for my script.

2. how to get the selected file name

3. how to rename the folder

4. how to cut and paste the selected file.

Edited by kcvinu
Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

Hi 

jdelaney, Thank you for the quick reply. But i have edited the question. So i request you to read the question once again please.
Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

  • Moderators

And i don't know;

1. how to make a context menu entry for my script.

2. how to get the selected file name

3. how to rename the folder

4. how to cut and paste the selected file.

 

1.  Don't, that's poor form, relying on a context menu not being interrupted by another app.

2.  Use _FileListToArray(), work out the extensions you want to list

3.  DirMove()/FileMove() will allow you to rename a folder/file

4.  DirMove()/FileMove() will allow you to move a folder/file (and rename it)

 

No more "Don't know how's now" :) (10's of thousands of examples of all)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

First you will need to register a context menu to right click with something like this

 

;--------------------------------------
Windows Registry Editor Version 5.00


[HKEY_CLASSES_ROOT\*\shell\mv]
@="Move to dedicated folder"


[HKEY_CLASSES_ROOT\*\shell\mv\command]
@="pathto\\my.exe %1"
;-------------------------------------------
1. then in the begining of your script $CmdLine[1] will be the full path of the file name you want to control

 

]If $cmdline[0] > 0 Then
$file2move=$CmdLine[1]
EndIf

2. compile the script to "my.exe" place it in "pathto=the location it will be"

3. test it out :)

Link to comment
Share on other sites

Hi 

SmOke_N, Thank you. Let me try.. :)
Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

Hi 

Deye, Thank you. Let me try... :)
Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

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

×
×
  • Create New...