Welcome Guest.   Make a donation to an author on the site April 23, 2014, 11:28:12 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
The N.A.N.Y. Challenge 2013! Download dozens of custom programs!
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1] 2 Next   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: IDEA: Dynamic shortcuts  (Read 15327 times)
Josh
Charter Honorary Member
***
Posts: 3,298



View Profile Give some DonationCredits to this forum member
« on: May 25, 2008, 09:28:40 AM »

Here is an idea that I have had for a bit now. What if you could create a shortcut on your desktop that is updated, automatically, each time a thumb drive is put into the PC? That way, you can have a shortcut to firefox portable (FOR EXAMPLE), which points to D:\Apps\PortableFirefox.exe. Then, if you were to insert another thumb drive prior to inserting the one with FF Port on it, the shortcut would be updated to point to an updated path when the proper drive is inserted. Basically, you have a smart shortcut that can detect when you put the right drive in and have it change the shortcuts properties accordingly.

Is this a possibility?
Logged

Strength in Knowledge
SirSmiley
Member
**
Posts: 64


see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #1 on: May 25, 2008, 10:20:58 AM »

Is this what you mean DiskMounter
Or DeskDrive via FreewareGenius.

Have tried the first one but, not the second.
Logged
lanux128
Global Moderator
*****
Posts: 6,047



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #2 on: May 25, 2008, 01:45:19 PM »

you can try Launcher programs that specialize in portable apps such as PStart or UBSpawn.
Logged

Ampa
Charter Member
***
Posts: 589


I am cute ;)

View Profile WWW Give some DonationCredits to this forum member
« Reply #3 on: May 25, 2008, 04:43:49 PM »

Also DeskDrive (via LifeHacker)
Logged
Josh
Charter Honorary Member
***
Posts: 3,298



View Profile Give some DonationCredits to this forum member
« Reply #4 on: May 25, 2008, 11:26:22 PM »

Actually, I am looking more for something that doesnt display an icon on the desktop for the thumb drive, but more updates an existing icon to point to a proper path for an application on a removable drive.

Say I have inserted a drive for the first time and made a shortcut on the desktop to D:\Apps\FirefoxPortable.exe

Now. I remove this drive and insert another which then becomes D:\. Now I reinsert the original drive at the same time as the other and now the original D:\ is now E:\.

I want a program that will change the properties of the existing shortcut to point from D:\Apps\FirefoxPortable.exe to E:\Apps\FirefoxPortable.exe

Is this possible?
Logged

Strength in Knowledge
lanux128
Global Moderator
*****
Posts: 6,047



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #5 on: May 25, 2008, 11:36:35 PM »

I want a program that will change the properties of the existing shortcut to point from D:\Apps\FirefoxPortable.exe

i'm not sure that this is possible but i've been in situations that you had mentioned and now i'm using USB drive letter manager to avoid this by assigning a fixed drive letter for flash drives. also check out this thread.
Logged

Josh
Charter Honorary Member
***
Posts: 3,298



View Profile Give some DonationCredits to this forum member
« Reply #6 on: May 25, 2008, 11:46:33 PM »

I dont see why it shouldnt be possible. All that should be required is a program which monitors new drive letters, scans the drive for a given shortcut on the desktop's path, and then updates the shortcut accordingly.
Logged

Strength in Knowledge
justice
Supporting Member
**
Posts: 1,885



Solve issues simply.

View Profile WWW Give some DonationCredits to this forum member
« Reply #7 on: May 26, 2008, 06:02:38 AM »

I'd create a coding snack in AHK but actually you don't even have to do that. The easiest option is to overwrite shortcuts instead of updating them.
Create a file called Autorun.inf with the following contents:
[copy or print]
[autorun]
open=LnkSwitch\LnkSwitchThumb.bat
Keep copies of shotcuts on the drive in the LnkSwitch folder
Then create the LnkSwitch\LnkSwitchThumb.bat file and have it copy the right shortcut to the right folder using a copy command such as
[copy or print]
copy *.lnk c:\users\Josh\Desktop /y

Logged

lanux128
Global Moderator
*****
Posts: 6,047



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #8 on: May 26, 2008, 10:59:49 AM »

The easiest option is to overwrite shortcuts instead of updating them.

good call, justice. Thmbsup i hadn't thought of that.
Logged

Josh
Charter Honorary Member
***
Posts: 3,298



View Profile Give some DonationCredits to this forum member
« Reply #9 on: May 26, 2008, 10:38:26 PM »

The problem with this is I would like to be able to run this on multiple PC's. This would require me have a batch file for every conceivable PC I use this on as path's change from PC to PC. I could use the %USERPROFILE% environment variable, however, some PC's I have access to do not allow those variables.
Logged

Strength in Knowledge
steeladept
Supporting Member
**
Posts: 1,056



Fettucini alfredo is macaroni & cheese for adults

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #10 on: May 26, 2008, 10:50:03 PM »

If it just places the Shortcut on the desktop upon load, then it wouldn't matter if you never used the USB device on that pc before or not.  If you have, it would just update the link, if not, it would create it.

EDIT - Hmm, maybe not.  Sometimes it will create <ShortcutName>(2) instead.  That might be a problem...
Logged
SirSmiley
Member
**
Posts: 64


see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #11 on: May 26, 2008, 10:51:29 PM »

Don't think you would need a batch for every individual PC just a loop that iterates through various desktop path options until it finds the correct one.

A monitoring type app might be some what over kill for something as simple as this? Guess it would depend on how frequently you are polling the drives, etc.
Logged
Josh
Charter Honorary Member
***
Posts: 3,298



View Profile Give some DonationCredits to this forum member
« Reply #12 on: May 26, 2008, 10:52:44 PM »

That would be an option I would like. A way to say "Poll for updated shortcuts every 30 minutes". Or even a program which sits idly waiting for a new drive to be inserted. Then, upon insertion, it scans that drive to see if said path exists and updated the shortcut accordingly.
Logged

Strength in Knowledge
mikiem
Participant
*
Posts: 87

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #13 on: June 17, 2008, 09:35:34 PM »

Ummm... not a coder (that part of my brain died long ago) so this is probably a stupid idea, but what popped into my head was why have an app constantly watching &/or polling when it could be activated by an autorun association? Also, instead of a shortcut, updating or otherwise, would a constant sized/placed window work containing your shortcuts? That way you could have several sticks with the icons or shortcuts varying by content?
Logged
nite_monkey
Member
**
Posts: 674


see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #14 on: July 10, 2008, 07:40:46 PM »

I have created a very basic AHK script that should work
[copy or print]
FileCreateShortcut, %A_WorkingDir%\test\test.exe, %A_Desktop%\test.lnk
just make a new ahk script in the root of the usb drive, and put that in it.
replace test\test.exe with the program you want to make a shortcut to
replace test.lnk with the name of the program
compile the script, and you are good to go.
you can also copy that code several times in the same ahk script for multiple shortcuts

then just create an autorun file that will run the ahk script when you stick in the usb drive, when you are done, unplug the drive, and delete the shortcut from the desktop.

example: FileCreateShortcut, %A_WorkingDir%\Apps\PortableFirefox.exe, %A_Desktop%\Portable FireFox.lnk
Logged

[Insert really cool signature here]
belkira
Member
**
Posts: 52



see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #15 on: July 14, 2008, 12:02:36 AM »

Try this out and let me know what you think. I have attached both the source (ahk) and a compiled version.

Edit:
See posts below for latest version
« Last Edit: July 15, 2008, 10:12:34 AM by belkira » Logged
belkira
Member
**
Posts: 52



see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #16 on: July 14, 2008, 09:46:34 PM »

Updated it to keep track of the lnk files already on the desktop,
and replace them if they got overwritten when the new shortcuts
were created. (Once the removable drive gets removed)

Edit:
See posts below for latest version
« Last Edit: July 15, 2008, 10:12:59 AM by belkira » Logged
mouser
First Author
Administrator
*****
Posts: 32,693



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #17 on: July 14, 2008, 10:35:03 PM »

what a cool idea.. i'd love to see a demo movie of some of this in action, i think it would help people understand what it's for.
Logged
nogojoe
Charter Member
***
Posts: 134


see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #18 on: July 15, 2008, 02:06:23 AM »

tried this out and it worked OK  except it removed the icons to the shortcuts of my drives C D E F G H I J K that I have on my desktop.
Also removed a icon from shortcut that was already on the desktop that was of the same program that was also on the usb drive. (the drive had a backup of that program although the icons were different it removed both at the finish just leaving the shortcut itself that was already on the desktop.

Left all the other shortcuts and their icons alone.

I can see some promise in the program but for the above.

a possibility would be to have the  shortcuts be delivered to a place on the tray  (something similar to DESKonTOP) as in the finish you have to access the "Safely Remove Hardware" from there.
Logged

Often the most convincing people are those who have lost the plot so much they don't recognize the difference between fact and fantasy
belkira
Member
**
Posts: 52



see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #19 on: July 15, 2008, 10:10:38 AM »

nogojoe,

Which version did you try? The original did delete shortcuts if they were the same name as a shortcut being created, but the second version doesn't(shouldn't).

As for the deleting of the Drive letter shortcuts I will look into that. I dont keep shortcuts to the drives on my desktop so that issue didn't come up for me.
Also I have attached a new version which recurses only 1 level (easily changed) looking for exe files.

This version does not remove any drive icons or other existing icons from my desktop. Let me know if you experience something different.
[copy or print]
;
; Program Version: 1.3
; Language:       English
; Author:         belkira
;
; Script Function:
; Script to create shortcuts on Desktop for exe files on a removable drive
;   and then to remove those shortcuts when the removable drive has been removed.
;Script Usage:
; Launch script on whatever computer(s) you want to have the shortcuts updated on.
; When a new removable drive is inserted, this script will scan for all exe files on the
; removable device, and create shortcuts for them on the users Desktop.
;
; Once removed the script will cleanup any shortcuts that were created.
;

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
;SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#Persistent
First = 0
DriveGET, USB, List, REMOVABLE
settimer, check, 500
return

check:
ret := scan4newDrives(USB)
If (First = 0)
{
; Copy current shortcuts
Loop, %A_Desktop%\*.lnk
{
FileGetShortcut, %A_LoopFileName%, Target
ShortCutTarget = %ShortCutTarget%%Target%\\%A_LoopFileName%`n
;ShortCutName = %ShortCutName%%A_LoopFileName%`n
;MsgBox %ShortCutTarget%`n%ShortCutName%
}
}
First = 1
if (!ret)
{
UsbDirList :=
ShortcutList :=
;nothing here
}
else
{
; Scan usb drive for applications
Usb_Folders = %ret%:\
Loop, %Usb_folders%*.exe, 0, 1
{
   StringReplace, dummy, A_LoopFileFullPath, \, \, UseErrorLevel
   If (ErrorLevel > 2) ; ex: "C:\folder1\folder2\folder3\file.ext"
      continue ; skip files that are 1 or more folders deep
    UsbDirList = %UsbDirList%%A_LoopFileFullPath%`n
}

{

}
Sort UsbDirList, UD`n ;Remove duplicate entries, just in case
; create shortcuts
Loop, Parse, UsbDirList, `n
{
If !A_LoopField
Break
SplitPath, A_LoopField, Name, Dir, Extension, NameNoExt, OutDrive
FileCreateShortcut, %Dir%\%Name%, %A_Desktop%\%NameNoExt%.lnk
CreatedShortcuts = %CreatedShortcuts%%A_Desktop%\%NameNoExt%.lnk`n
}
}
; remove shortcuts if drive removed
IfNotExist %OutDrive%
If CreatedShortcuts >= 1
{
Loop, Parse, CreatedShortcuts, `n
{
FileDelete, %A_LoopField%
CreatedShortcuts =
}
Loop, Parse, ShortCutTarget, `n
{
If A_LoopField =
Continue
SplitPath, A_LoopField, Name, Old_Target
StringTrimRight, Target, Old_Target, 1
FileCreateShortcut, %Target%, %A_Desktop%\%Name%
;MsgBox Name=%Name%`nTarget=%Target%
}
}
return

scan4newDrives(byref olddrives)
{
DriveGET, NewUSB, List, REMOVABLE
Loop, parse, NewUSB
{
if InStr(olddrives, a_loopfield)
{
   ;still here
}
else
{
   ;found new device!
   olddrives := NewUSB ;update
   return, % a_loopfield
}
}
olddrives := NewUSB ;update
return, 0 ;no new devices found.
}


* Shortcut Updater v1.3.ahk (2.83 KB - downloaded 274 times.)
Logged
belkira
Member
**
Posts: 52



see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #20 on: August 08, 2008, 09:19:45 PM »

what a cool idea.. i'd love to see a demo movie of some of this in action, i think it would help people understand what it's for.

Per mousers request...

Let me know how this works, its my first screen capture.

* demo.AVI (1403.13 KB - downloaded 290 times.)
« Last Edit: August 08, 2008, 10:09:21 PM by belkira » Logged
lanux128
Global Moderator
*****
Posts: 6,047



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #21 on: August 12, 2008, 02:37:56 AM »

what a cool idea.. i'd love to see a demo movie of some of this in action, i think it would help people understand what it's for.

Per mousers request...

Let me know how this works, its my first screen capture.

wow! i didn't know much about your program's feature until i saw the demo video. thumbs up

P.S. could have used a more decent codec, though. smiley
Logged

belkira
Member
**
Posts: 52



see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #22 on: August 13, 2008, 03:54:46 PM »


wow! i didn't know much about your program's feature until i saw the demo video. thumbs up

P.S. could have used a more decent codec, though. smiley

Like??

As I said I have never done a screen capture before so I just used what I found. It was either avi or swf and the swf file looked pretty crappy and had a huge file size.....
Logged
lanux128
Global Moderator
*****
Posts: 6,047



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #23 on: August 13, 2008, 08:51:44 PM »

i'm no expert myself but i believe that DC 's Best Screencasting Tool review might help. btw, when the need arises, I normally use Camtasia Studio 3. smiley
Logged

belkira
Member
**
Posts: 52



see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #24 on: August 20, 2008, 02:33:55 AM »

Thanks, I'll give that a read. I used Camstudio, but will definitely look into camtasia.
Logged
Pages: [1] 2 Next   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.055s | Server load: 0.05 ]