topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday March 19, 2024, 2:02 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: Windows Shortcut transformation  (Read 32610 times)

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Windows Shortcut transformation
« on: February 20, 2011, 02:00 AM »
Windows Shortcut transformation.



I would like a script to click over a file shortcut and replace him with the real file.

I would like a script to click over a folder shorcut and replace him with the real folder.

Best Regards

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,610
    • View Profile
    • Donate to Member
Re: Windows Shortcut transformation
« Reply #1 on: February 20, 2011, 05:22 AM »
Do the suggestions at your original question-thread work for you?

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Re: Windows Shortcut transformation
« Reply #2 on: February 20, 2011, 07:31 AM »
I'll try and comment everywhere.

 :-*

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: Windows Shortcut transformation
« Reply #3 on: February 20, 2011, 09:25 PM »
Short2Real - Select a source directory and then select a destination - that's it.

It won't overwrite anything but it also doesn't check to see if the copy was successful, that said it seemed to work OK in my limited testing.

Code: AutoIt [Select]
  1. #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
  2. #AutoIt3Wrapper_UseUpx=n
  3. #AutoIt3Wrapper_UseX64=n
  4. #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
  5. ; Short2Real.au3
  6.  
  7. $src = FileSelectFolder('Select source directory:', '', 7)
  8. $dest = FileSelectFolder('Select destination directory:', '', 7)
  9.  
  10. $scut = FileFindFirstFile($src & "\*.lnk")
  11. If $scut = -1 Then
  12.     MsgBox(64, "Short2Real", "No shortcuts found.")
  13.     Exit
  14.  
  15.     $file = FileFindNextFile($scut)
  16.         $details = FileGetShortcut($src & '\' & $file)
  17.  
  18.         If StringInStr(FileGetAttrib($details[0]), 'D', 1) > 0 Then
  19.                 DirCopy($details[0], $dest & '\' & StringLeft($file, StringLen($file) - 4), 0)
  20.         Else
  21.                 FileCopy($details[0], $dest, 0)
  22.         EndIf
  23. FileClose($scut)
  24.  
  25. MsgBox(64, 'Short2Real', 'Finished')

Above is superceeded, see here.
« Last Edit: March 30, 2011, 11:15 PM by 4wd »

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Re: Windows Shortcut transformation
« Reply #4 on: February 21, 2011, 01:19 AM »
Nice name program indeed  :-*

I'll try and test completely. I am very interested in this application.

Best Regards
 :P

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Re: Windows Shortcut transformation
« Reply #5 on: February 21, 2011, 05:35 AM »
First proofs great.

Now I need a program to reproduce the folder structure. Copy the directory structure of the original folder. I think i've seen or have something like that. I will comment.

I observed the behaviour of this wonderful program : short2real , and the initial folder only contains other real folders, so do nothing.
Over the rest of folders acts one by one interacting with the user to transform file shortcuts and folder shortcuts to real files and real folders.

I have to test the behaviour under hard circunstances like more deeper shortcuts or cycle shortcuts.

Perhaps I can propose a better feature of this program, but from now is very useful.

Best Regards

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: Windows Shortcut transformation
« Reply #6 on: February 21, 2011, 06:04 AM »
Sorry, I know English isn't your native language but I'm still having trouble following what you need to happen.

Is there any chance you could give me a sample before and after folder structure.

eg. Can you do 'dir /b /s (source path) >src.txt' and then create the destination as you wish it to look and do 'dir /b /s (dest path) >dest.txt' and then PM me the two text files ?

PhilB66

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,522
    • View Profile
    • Donate to Member
Re: Windows Shortcut transformation
« Reply #7 on: February 21, 2011, 10:16 AM »
Miroirs - Makes it easy to replicate complex directory structures without copying the files within

Miroirs.png

http://www.scanialab...Miroirs/Miroirs.aspx

Requires .net

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,958
    • View Profile
    • Donate to Member
Re: Windows Shortcut transformation
« Reply #8 on: February 21, 2011, 11:53 AM »
Miroirs - Makes it easy to replicate complex directory structures without copying the files within

wasnt there a dc app/coding snack that did this as well (?)
Tom

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Re: Windows Shortcut transformation
« Reply #9 on: February 21, 2011, 04:14 PM »
Sorry, I know English isn't your native language but I'm still having trouble following what you need to happen.

Is there any chance you could give me a sample before and after folder structure.

eg. Can you do 'dir /b /s (source path) >src.txt' and then create the destination as you wish it to look and do 'dir /b /s (dest path) >dest.txt' and then PM me the two text files ?

I'll try of my best. Excuse me. I'll tell you later.


Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Re: Windows Shortcut transformation
« Reply #10 on: February 21, 2011, 04:27 PM »
Miroirs - Makes it easy to replicate complex directory structures without copying the files within
(see attachment in previous post)
http://www.scanialab...Miroirs/Miroirs.aspx

Requires .net


I don't know. I try treecopy as a portable version. But to solve the recursevely mode I think an array.
to control over the past copy shorts.

Miroirs - Makes it easy to replicate complex directory structures without copying the files within

wasnt there a dc app/coding snack that did this as well (?)


4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: Windows Shortcut transformation
« Reply #11 on: February 21, 2011, 05:36 PM »
Here's a version that gives you the option of recursive copying, replicating the original folder tree in the destination.  That is, the original folder tree of the directory with the shortcuts not the folder tree of the directories with the real files/folders.

Just needs a nice GUI now  DONE :)

Now just got to find a nice icon.
« Last Edit: February 22, 2011, 07:12 PM by 4wd »

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Re: Windows Shortcut transformation
« Reply #12 on: February 22, 2011, 10:14 AM »
 :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-* :-*

http://img101.imageshack.us/img101/7251/besotene2.gif
Windows Shortcut transformation


I'll test and comment. I was entering the forum for ask that exactly possibility

Best Regards

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Re: Windows Shortcut transformation
« Reply #13 on: February 22, 2011, 10:27 AM »
(this is only an introduction). Your splendid codesnack is finished at the above state.
By the way. I am looking for a sort of director file with universal shortcuts or something near that.

I try to explain the best I can. In the main original folder I use by example (a document word xp) with links (hyperlinks) . I suppose i will lose those links when move the .doc document to the new folder. And obviously sure when I move the word document to a cd/dvd/usb/external hard drive.

I use from many years ago a CRM Goldmine 5.5 that have the possibility to offer alternativas paths when an original link is not found.

http://img39.imageshack.us/img39/198/screenshot2202201109060.png
Windows Shortcut transformation


I don't know the exact concept behing : universal shortcut. Perhaps have other utilities like explore other hard disk when the link is not found in the first. Or a desktop shortcut tha may vary according the external disk you have connected.

When me like a little ant have to link several hundreds of linked files revised each time I move the word document is a tedious task.

Anyone knows alternatives ?

Best Regards


Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Re: Windows Shortcut transformation
« Reply #14 on: February 22, 2011, 10:36 AM »
Something happen

http://img130.imageshack.us/img130/1457/screenshot2202201116320.png
Windows Shortcut transformation


I don't reach exploring the original folder or the target folder because I can't enter en documents and settings folder.

 :P


Important Note : I hope the lady comes to the next Carnival in Tenerife where I am from.  :)

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: Windows Shortcut transformation
« Reply #15 on: February 22, 2011, 03:57 PM »
Forgot to test it on anything other than W7 x64, I'll have a look later today.

It looks like you're using XP ?

Were you trying to get to a folder on the Desktop ?
« Last Edit: February 22, 2011, 04:01 PM by 4wd »

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Re: Windows Shortcut transformation
« Reply #16 on: February 22, 2011, 05:57 PM »
Yesssssssssssssssssssss.

Windows xp pro sp3 .
 :P

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Re: Windows Shortcut transformation
« Reply #17 on: February 22, 2011, 05:58 PM »
I have seven in the portatil

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: Windows Shortcut transformation
« Reply #18 on: February 22, 2011, 06:51 PM »
Never mind, it was because I didn't allow System or Hidden folders.

I'll put another up in a  couple of hours.

I have seven in the portatil

Is that like a porta-potty ?   :P

There seems to be a problem with the function to display folders so it may take a little while to find it.

So in the meantime, here's the no gui version.

« Last Edit: February 23, 2011, 05:17 AM by 4wd »

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Re: Windows Shortcut transformation
« Reply #19 on: February 23, 2011, 03:07 AM »
 :) I'll try and comment
 :P

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Re: Windows Shortcut transformation
« Reply #20 on: February 23, 2011, 03:22 AM »
 :(

http://img72.imageshack.us/img72/4125/screenshot2302201109185.png
Windows Shortcut transformation

http://img35.imageshack.us/img35/6605/screenshot2302201109191.png
Windows Shortcut transformation

http://img251.imageshack.us/img251/2824/screenshot2302201109193.png
Windows Shortcut transformation


Seems don't copy the empty folders and in other image seems don't copy well some folders.

 :P

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: Windows Shortcut transformation
« Reply #21 on: February 23, 2011, 04:16 AM »
The program only works on shortcuts, if a folder has no shortcuts in it then it won't be replicated in the destination because it was empty.

I think you might have to do what I suggested back here so I know exactly what the before and after is supposed to look like.

OK, found a bug that was turning folders into files, (kind of like wine into water ;) ), so that will fix that problem.  However, it still won't recreate folders that are empty, (no shortcut in them), because it only works on shortcuts.
« Last Edit: February 26, 2011, 09:50 PM by 4wd »

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Re: Windows Shortcut transformation
« Reply #22 on: February 23, 2011, 10:24 AM »
 ;D I'll try and comments
 :-*

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 3,199
    • View Profile
    • Donate to Member
Re: Windows Shortcut transformation
« Reply #23 on: February 23, 2011, 11:07 AM »
Not sure it's relevant, but just noticed this in TinyApps Blog:

Replace dupes with hard links or shortcuts

    * CloneSpy: GUI dedupe utility that can (among other things) replace duplicate files with shortcuts or hard links.
    * Dupemerge: CLI utility that searches for identical files on a logical drive and creates hard links among those files. (via Anthony Frazier)
    * Duplicate File Hard Linker (DFHL): Open source CLI tool that replaces duplicate files with hard links. Byte-per-byte comparison ensures only identical files are hard linked.
    * Finddupe: Open source CLI tool for detecting, deleting, or hard linking duplicate files. Can also list all hardlinked files on a given volume (similar to Microsoft's Hlscan.exe). Finddupe computes a hash based on the first 32k of a file, only checking entire file if there is a match.

This KB article explains hard links:

    A hard link is a folder entry for a file regardless of where the actual file data exists on that volume. Every file is considered to have at least one hard link. On NTFS volumes, each file can have multiple hard links; therefore, a single file can be displayed in many folders (or even in the same folder with different names). Because all of the links reference the same file, programs can open any of the links and modify the file. A file is deleted from the file system only after all of the links to it have been deleted. After you create a hard link, programs can use the link like any other file name. Note that Windows Explorer and a command prompt will show all linked files as being the same size, even though they all share the same data and do not actually use that amount of disk space.

This last bit can be confusing. Let's say you've got a folder with three duplicate files of 10MB each. After replacing the dupes with hard links, the folder size is still reported as 30MB by Windows Explorer and cmd.exe. However, the "Used space" reported by Windows Explorer for the volume will have decreased by 20MB.

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,940
    • View Profile
    • Donate to Member
Re: Windows Shortcut transformation
« Reply #24 on: February 23, 2011, 04:08 PM »
I'll take a good look rjbull and comments.
 :P