# Folder+Program USB Shortcut Maker

## Recommended Posts

Original concept came from the application called ShortEXE found here http://www.horstmuc.de/wminis.htm#shortexe

I don't take any credit for this concept, as I saw this somewhere else. I searched here to see if it was created with Autoit, but couldn't find anything. (If found, I'll be happy to give the author credit); However, Being as I couldn't locate the original application, I decided to created a new one with some added features. Basically what this does is allows you to create a sudo shortcut in a folder that points to an application buried in sub folders. (mainly for use on removable drives, but can be used anywhere really.)

Where this program comes in handy, is when you want to create a persistent shortcut on a removable device such as external hard drive or flash drive. Windows does not let you create shortcuts that can remember paths without drive letters. If you created a standard shortcut and then moved the device to another machine, unless it has exactly the same drive letter the shortcut would fail. This application solves that issue.

Update#1: Changed the file selection mechanism to use ChooseFileFolder.au3 UDF by : Melba23 Thanks to him for the great UDF addon.

Update#2: Changed a bit of the code to handle if a program triggers the UAC (admin required)

Update#3 Fixed a bug when dealing with drive letters vs network paths when renaming the shortcut. Also changed how the shortcut is renamed to work around a limitation when using windows 10.

Update#4 Re-fixed drive letter renaming bug, that was putting a + at the start of the name.

Update#5 Added about window in first run, prevented program from selecting itself. Cosmetic bells and whistles.

Edited by zone97
Expanded upon the discription of the application and uploaded code changes!

Spoiler

##### Share on other sites
• Moderators

It's a nice concept, but if you have to locate the EXE to bind the pseudo-shortcut to anyway, what does it buy you over doing right clicking on the exe?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

##### Share on other sites
7 minutes ago, JLogan3o13 said:

It's a nice concept, but if you have to locate the EXE to bind the pseudo-shortcut to anyway, what does it buy you over doing right clicking on the exe?

You'll only have to do it once. It will rename the scripts exe to the correct format and become the shortcut. Here is an example of what I have on a thumb-drive.. Might make more sense.

Edited by zone97

Spoiler

##### Share on other sites
12 minutes ago, JLogan3o13 said:

It's a nice concept, but if you have to locate the EXE to bind the pseudo-shortcut to anyway, what does it buy you over doing right clicking on the exe?

Re-read your message.. If you mean right clicking a program and making a shortcut? You can't do that on removable media. (you can, but if the drive letter changes you break the link) Shortcuts cannot be created with "relative paths" I hope that explains how this is different.

Spoiler

##### Share on other sites
• Moderators

More or less what I was trying to get you to do. Point out to someone reading your initial post what the value was to them: i.e. the shortcut path persists.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

##### Share on other sites
1 hour ago, JLogan3o13 said:

More or less what I was trying to get you to do. Point out to someone reading your initial post what the value was to them: i.e. the shortcut path persists.

Thanks for the guidance, original post has been updated.

Spoiler

##### Share on other sites

Might need some help. Just tested this on windows 10 and filemove nor filecopy worked? Any ideas?

Spoiler

##### Share on other sites

Im sorry, what am i missing? so i started the exe, it asks for a program, i selected one, nothing happened. It doesn't allow me to select a program in another drive, only shows the script dir contents.

Win 10 btw

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

# IUIAutomation - Topic with framework and examples

##### Share on other sites

There seems to be an issue with windows 10 for some reason? Hopefully someone more cleaver than me can figure out what the issue is.

Update, seems to have to do with how the drive letter is assigned in windows 10.. I see an F: drive, but if I go to the command prompt and type F: it acts like it doesn't exist?

Edited by zone97

Spoiler

##### Share on other sites

Was it supposed to show other drives or what? It's supposed to be a shortcut that works even if the removable drive changes letter, right?

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

# IUIAutomation - Topic with framework and examples

##### Share on other sites
1 hour ago, careca said:

Was it supposed to show other drives or what? It's supposed to be a shortcut that works even if the removable drive changes letter, right?

It is designed to only see it's folder and sub-folders in that folder, it cannot see any other drives or parent folders as it's designed to work in its on folder forward, not back.

In other words.. If you had this situation.

x:\tools\tool1

x:\tools\tool2

x:\tools\tool3

and x:\tools\folder.program.exe

it will be able to see everything in x:\tools\, x:\tools\tool1, x:\tools\tool2 and x:\tools\tool3 but would not be able to navigate backwards to x:\ not designed to work that way.

Edited by zone97

Spoiler

##### Share on other sites

And therefore be able to make a shortcut into a file that's deep into a subdirectory. Regardless of the drive letter, because it's a relative shortcut. got it.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

# IUIAutomation - Topic with framework and examples

##### Share on other sites

Original post updated with some fixes.

Spoiler

##### Share on other sites

I've changed some things and it works in my windows 10.

;#RequireAdmin
#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=Icons\Folder+Program.ico
#AutoIt3Wrapper_Outfile=Program\Folder+Program.exe
#AutoIt3Wrapper_Run_Tidy=y
#Tidy_Parameters=/tc 3 /reel
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <String.au3>
#include <File.au3>
#include ".\Incudes\ChooseFileFolder.au3"
Local $sDrive = "",$sDir = "", $sFileName = "",$sExtension = "", $NewFileName If StringInStr(@ScriptName, "+") Then$ShortCut = StringReplace(@ScriptName, "+", "\")
If FileExists(".\" & $ShortCut) Then Run(".\" &$ShortCut)
Sleep(1000)
_PathSplit($ShortCut,$sDrive, $sDir,$sFileName, $sExtension) If Not ProcessExists($sFileName & $sExtension) Then ShellExecute($ShortCut, "", "", "runas")
EndIf
Else
$aFile = StringSplit(@ScriptName, ".") If StringLower($aFile[1]) <> "folder+program" Then
MsgBox(16, "Error", "Unable to locate .\" & $ShortCut) EndIf New_File_Select() EndIf Else New_File_Select() EndIf Exit Func New_File_Select()$sRet = _CFF_RegMsg()
If Not $sRet Then MsgBox(16, "Failure!", "Handler not registered") Exit EndIf$sRet = _CFF_Choose("Select a program.", 300, 300, -1, -1, @ScriptDir, "*.exe;*.com;*.bat;*.cmd")
If $sRet Then$NewFileName = StringReplace($sRet, "\", "+")$NewFileName = _StringTitleCase($NewFileName)$NewFileName = StringReplace($NewFileName, ".Exe", ".exe", -1, 1)$NewFileName = StringTrimLeft($NewFileName, 2) ;If FileExists(@ScriptDir & "\" &$NewFileName) Then
;FileDelete(@ScriptDir & "\" & $NewFileName) ;EndIf FileMove(@AutoItExe, @ScriptDir & "\" &$NewFileName, 8)
Else
MsgBox(16, "Error", "No program was selected.")
EndIf
EndFunc   ;==>New_File_Select

It was creating a file "H" without extension, so i figured it was the drive letter so i proceeded to put a string trim left for 2 characters and thats it.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

# IUIAutomation - Topic with framework and examples

##### Share on other sites
15 hours ago, careca said:

I've changed some things and it works in my windows 10.



It was creating a file "H" without extension, so i figured it was the drive letter so i proceeded to put a string trim left for 2 characters and thats it.

I think I solved the cause of this. I had to account for various types of source names such as F:\usbdrive vs f:\ vs \\network\path\to\usb etc.

@ScriptDir would report a trailing backslash when you are at the root of the drive.. IE: F: would be F:\ but if you were in a sub folder, say F:\USB would not have a trailing slash and would have to have it added.

Spoiler

##### Share on other sites

Hi mate, i just tried your app and it complained "file not found!"  and the path looks like this:

"Setup +Progs+02 Utilities+Apps+Atkpackage.exe"

"H:\Progs\02 Utilities\Apps\Atkpackage\Setup.exe"

EDIT Interestingly enough, or not, the code i had posted still works for me, but your final version doesn't. :\

In terms of the file choosing, i always prefer the more common file dialog, where you see the folders and it's icons and all that, but that's just an opinion.

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

# IUIAutomation - Topic with framework and examples

##### Share on other sites

I took the liberty to change the script a bit more, for myself, only now i added filecopy so that once the executable changes name, (into a path) the original is copied so i can keep creating "new" shortcuts, instead of "losing" the exe.

;#RequireAdmin
#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=FolderProgram.ico
#AutoIt3Wrapper_Outfile=FolderProgram.exe
#AutoIt3Wrapper_Run_Tidy=y
#Tidy_Parameters=/tc 3 /reel
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <String.au3>
#include <File.au3>
FileInstall('FolderProgram.au3', @TempDir & '\FolderProgram.au3', 1)
FileInstall('FolderProgram.ico', @TempDir & '\FolderProgram.ico', 1)
FileCopy(@ScriptDir & '\FolderProgram.exe', @TempDir & '\FolderProgram.exe', 9)
TraySetIcon(@TempDir & '\FolderProgram.ico')
GUISetIcon(@TempDir & '\FolderProgram.ico')
Local $RootDir = StringSplit(@ScriptDir, '\', 1) Local$sDrive = "", $sDir = "",$sFileName = "", $sExtension = "",$NewFileName
If StringInStr(@ScriptName, "+") Then
$ShortCut = StringReplace(@ScriptName, "+", "\") If FileExists($RootDir[1] & $ShortCut) Then Run($RootDir[1] & $ShortCut) Sleep(1000) _PathSplit($ShortCut, $sDrive,$sDir, $sFileName,$sExtension)
If Not ProcessExists($sFileName &$sExtension) Then
ShellExecute($ShortCut, "", "", "runas") EndIf Else$aFile = StringSplit(@ScriptName, ".")
If StringLower($aFile[1]) <> "FolderProgram" Then MsgBox(16, "Error", "Unable to locate: " &$RootDir[1] & $ShortCut) EndIf New_File_Select() EndIf Else New_File_Select() EndIf Exit Func New_File_Select()$sRet = FileOpenDialog('Select a program', @ScriptDir, 'Executables (*.exe;*.com;*.bat;*.cmd)', 1)
If @error = 0 Then
$NewFileName = StringReplace($sRet, "\", "+")
$NewFileName = _StringTitleCase($NewFileName)
$NewFileName = StringReplace($NewFileName, ".Exe", ".exe", -1, 1)
$NewFileName = StringTrimLeft($NewFileName, 2)
FileMove(@AutoItExe, @ScriptDir & "\" & \$NewFileName, 8)
FileCopy(@TempDir & '\FolderProgram.exe', @ScriptDir & '\FolderProgram.exe', 9)
Else
MsgBox(16, "Error", "No program was selected.")
EndIf
EndFunc   ;==>New_File_Select

EDIT: Now also works inside folders, replaced

".\"

by the first split of

StringSplit(@ScriptDir, '\', 1)

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

# IUIAutomation - Topic with framework and examples

##### Share on other sites
8 hours ago, careca said:

Hi mate, i just tried your app and it complained "file not found!"  and the path looks like this:

"Setup +Progs+02 Utilities+Apps+Atkpackage.exe"

"H:\Progs\02 Utilities\Apps\Atkpackage\Setup.exe"

EDIT Interestingly enough, or not, the code i had posted still works for me, but your final version doesn't. :\

In terms of the file choosing, i always prefer the more common file dialog, where you see the folders and it's icons and all that, but that's just an opinion.

Thanks for the heads up, maybe the space in the folder name is causing an issue, ill take your example and run some test and see where its failing.

Spoiler

##### Share on other sites

@careca I believe i have solved the issue you had, give it another try.

Spoiler

##### Share on other sites

It works in root now, but still not inside any folder.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

# IUIAutomation - Topic with framework and examples

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
×
• Create New...