l3ill

PathFinder - Timesaver - Get Absolute & Relative Path

2 posts in this topic

#1 ·  Posted (edited)

Hi All,
  
   Here is a little script I have been using for a long time and since I haven't seen it on here, finally decided to post.
PathFinder is an executable that gives you the ability to right click a file and get it's Absolute or Relative Path and copy it to the clipboard.
 
Has only been tested on Windows 7 32 Bit
 
Constructive Comments & Questions are welcome!

Bill

p.s. Everything is in the zip file...
 
Quellcode:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****

#AutoIt3Wrapper_Icon=..\..\..\..\Program Files\AutoIt3\Icons\au3.ico

#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.3.9.21

Author: Bill



Script Function:

Gets Absolute Path & Relative path of a file via Context Menu



Revamped 12.11.13 ; from old XP version from 2010

#ce ----------------------------------------------------------------------------



Global $sFilePath

If $CmdLine[0] > 0 Then

$sFilePath = $CmdLine[1]

EndIf



#include 

#include 



Opt('MustDeclareVars', 1)

Opt("GUIOnEventMode", 1)



Global $sPath

Global $aPath = $sFilePath

Global $ExitID



_GetShortPath()

_Main()



Func _GetShortPath()

$sPath = StringSplit($sFilePath, "\")

_ArrayReverse($sPath)

Local $rows = UBound($sPath)

$rows = $rows - 1

For $i = 1 To $rows

_ArrayDelete($sPath, $i)

Next

$sPath = _ArrayToString($sPath)

EndFunc ;==>_GetShortPath



Func _Main()



Local $aPathBut, $sPathBut, $ExitID

GUICreate("PathFinder", 300, 110)

GUICtrlCreateLabel("Absolute Path: ", 10, 8)

GUICtrlCreateLabel($aPath, 10, 22)

GUICtrlCreateLabel("Short Path: ", 10, 36)

GUICtrlCreateLabel($sPath, 10, 50)

GUICtrlCreateLabel("Click on Relevant Button to copy Path to Clipboard", 10, 64)

$aPathBut = GUICtrlCreateButton("Absolute Path", 10, 80, 80, 20)

GUICtrlSetOnEvent($aPathBut, "OnAbsolutePath")

$sPathBut = GUICtrlCreateButton("Short Path", 110, 80, 80, 20)

GUICtrlSetOnEvent($sPathBut, "OnShortPath")

$ExitID = GUICtrlCreateButton("Exit", 210, 80, 80, 20)

GUICtrlSetOnEvent($ExitID, "OnExit")

GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit")

GUISetState() ; display the GUI



While 1

Sleep(1000)

WEnd

EndFunc ;==>_Main



Func OnAbsolutePath()

ClipPut($aPath)

MsgBox(0, "", $aPath & @CRLF & "Copied to Clipboard", 2)

Exit

EndFunc ;==>OnAbsolutePath



Func OnShortPath()

ClipPut($sPath)

MsgBox(0, "", $sPath & @CRLF & "Copied to Clipboard", 2)

Exit

EndFunc ;==>OnShortPath



Func OnExit()

If @GUI_CtrlId = $ExitID Then

EndIf

Exit

EndFunc ;==>OnExit


 
Installer:
 

; Running this script installs the shortcut to the Context Menu



$path = @ScriptDir & "\" & "PathFinder.exe"

RegWrite("HKEY_LOCAL_MACHINE\Software\Classes\*\Shell", "PathFinder")

RegWrite("HKEY_LOCAL_MACHINE\Software\Classes\*\Shell\PathFinder", "Command")

RegWrite("HKEY_LOCAL_MACHINE\Software\Classes\*\Shell\PathFinder\Command", "", "REG_SZ", '"' & $path & '"' & " " & '"%1"')


 
Uninstaller:
 

;Run this script to remove registry changes made by Pathfinder's RegWrite



RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\PathFinder")



readme.txt:

 Warning: This script make changes to your registry!!! Make a Backup before using!

Name: PathFinder
Does: Gets Absolute Path & Relative path of a file via Context Menu
Installation:
1. Copy the "PathFinder" folder to your Program Files Folder or wherever you like.
2. From there >Run RegWrite.exe to update the link in your context menu.
3. Finished
Usage: Now you can Right Click on any File and choose "PathFinder" to get and
copy the Absolute or Relative path of the file

Uninstall: To remove the changes made to the registry just run RegDelete.

PathFinder.zip

 

Some Pics

pathfinder.gif
 

post-56351-0-01368100-1387468811_thumb.j

post-56351-0-27078400-1387468833_thumb.j

Edited by l3ill
1 person likes this

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi Bill, very interesting idea! Thanks for share. Will test soon.

Jose

Edited by joseLB

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