Jump to content

Folder+Program USB Shortcut Maker


zone97
 Share

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.

Update#5a More cosmetic updates.

 

 

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

 

Spoiler

WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]
Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ]

 

Link to comment
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

How to get your question answered on this forum!

Link to comment
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.

explorer_2016-12-22_12-13-52.jpg

Edited by zone97
screenshot added

 

Spoiler

WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]
Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ]

 

Link to comment
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

WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]
Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ]

 

Link to comment
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

How to get your question answered on this forum!

Link to comment
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

WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]
Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ]

 

Link to comment
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

Au3Record.exe

Link to comment
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

WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]
Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ]

 

Link to comment
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

Au3Record.exe

Link to comment
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

WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]
Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ]

 

Link to comment
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

Au3Record.exe

Link to comment
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

Au3Record.exe

Link to comment
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

WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]
Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ]

 

Link to comment
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

Au3Record.exe

Link to comment
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_Res_Icon_Add=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

Au3Record.exe

Link to comment
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

WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]
Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ]

 

Link to comment
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

Au3Record.exe

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...