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, 12:03 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: DONE: Batch adjust shortcut targets  (Read 91083 times)

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 552
    • View Profile
    • Donate to Member
Re: DONE: Batch adjust shortcut targets
« Reply #25 on: July 17, 2012, 08:56 PM »

Well, I'm running out of room on the hard disk (c:) I was using, and need to transfer my contour plot images over to (e:).....

Using Batch Shortcut Modifier, adjusting all the present shortcuts to the images now on the different drive should be a breeze.

Question:  If I should decide to convert all the .png image files to .jpg (smaller file size), what would the RegEx code be for the shortcuts modification using BSM?  In other words, if any present shortcut contains ".png", change it to ".jpg".

My present BSM.ini file is as follows:

[General]
Folder=C:\5\QQQ\shortcuts 1_x_178
PathSearch=C:\\4(.+)
PathReplace=C:\\5\1
NameSearch=(.+)
NameReplace=\1


Thanks much!



4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: DONE: Batch adjust shortcut targets
« Reply #26 on: July 17, 2012, 09:22 PM »
This should do it:

NameSearch=(.+)\.png
NameReplace=\1\.jpg


You really should have a read of RegEx expressions :)

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 552
    • View Profile
    • Donate to Member
Re: DONE: Batch adjust shortcut targets
« Reply #27 on: July 17, 2012, 10:44 PM »

NameSearch=(.+)\.png
NameReplace=\1\.jpg

Something about it seems so foreign and daunting.  For now..., glad to have you, Skwire, etc.

So the code you provided above will work for shortcuts containing the names of the files, right?

I'd think the names would be included in the total path.

As I said, hardly makes sense.



4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: DONE: Batch adjust shortcut targets
« Reply #28 on: July 17, 2012, 11:09 PM »
NameSearch=(.+)\.png
NameReplace=\1\.jpg

Something about it seems so foreign and daunting.  For now..., glad to have you, Skwire, etc.

I don't even pretend to be able to do the things skwire and others can do with RegEx on the forum here but for straight forward things like this I'm OK....until someone corrects me :D

So the code you provided above will work for shortcuts containing the names of the files, right?

Yes.

I'd think the names would be included in the total path.

No, I chose to treat the file path and file name as two separate entities.

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 552
    • View Profile
    • Donate to Member
Re: DONE: Batch adjust shortcut targets
« Reply #29 on: July 18, 2012, 11:58 PM »

4wd, so the file names of shortcuts themselves will not be affected by BSM, only the contents of the shortcuts -- path to target, and filename of the target?

Here is a more complicated task, if you care to help further..., involving BOTH the target path and the target filename:

On drive e: now...

e:\1\QQQ\images\50501\...(16,000 .png images)
e:\1\QQQ\images\50502\...(16,000 .png images)
e:\1\QQQ\images\50503\...(16,000 .png images)
etc.

Within the first folder above are the files....

_50501_20101_20102_.png
_50501_20101_20103_.png
_50501_20101_20104_.png
_50501_20101_20201_.png
etc.

Within the second folder above are the files....

_50502_20101_20102_.png
_50502_20101_20103_.png
_50502_20101_20104_.png
_50502_20101_20201_.png
etc.

Notice the second (and subsequent) folder's file names are identical to the first, except for the first portion of the file name -- 50501 vs. 50502.

Using a combination of Skwire's FilePunter and 4wd's BSM, I have created a terrific set of shortcuts pointing to the files in the 50501 folder.  I regard that shortcut set as my 'gold standard.'

Example of 50501 shortcut -- path + target:

e:\1\QQQ\images\50501\_50501_20101_20102_.png

The trouble now comes in adjusting/modifying the shortcuts for the other folders, say 50502.

e:\1\QQQ\images\50502\_50502_20101_20102_.png

If possible, I'd like to use my 'gold standard' 50501 shortcuts --> copy them to, say, a 50502 shortcuts folder, and give BSM the instructions:

"BSM, take the 50502 folder full of shortcuts, look in there, when you find a path with '50501' change it to '50502.'  When you find a target filename with '50501' change it to '50502.'"

If BSM can do that, I'll repeat the process on the subsequent remaining folders.

So, what would be the BSM code for accomplishing the above task?

Present BSM.ini:

[General]
Folder=e:\1\QQQ\shortcuts 1_x_178\50502
PathSearch=e:\1\QQQ\images\50501(.+)
PathReplace=e:\1\QQQ\images\50502\1
NameSearch=(.+)
NameReplace=\1


Thanks much!



4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: DONE: Batch adjust shortcut targets
« Reply #30 on: July 19, 2012, 04:54 AM »
[General]
Folder=e:\1\QQQ\shortcuts 1_x_178\50502
PathSearch=(.+)\\50501(.*)
PathReplace=\1\\50502\2
NameSearch=_50501(.+)
NameReplace=_50502\1

(.+)\\50501(.*) - Group, (1), everything up to \50501 and group, (2), everything after, (even if there's nothing).
\1\\50502\2 - Replace with group 1 followed by \50502 followed by group 2.

_50501(.+) - Group, (1), everything after _50501.
_50502\1 - Replace with _50502 followed by group 1.

Spent an hour wondering why it wouldn't work until I realised that putting \150502 meant insert everything from group 150502...which doesn't exist.  Hence the need to include \\ to search/replace the \ before 50501.

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 552
    • View Profile
    • Donate to Member
Re: DONE: Batch adjust shortcut targets
« Reply #31 on: July 20, 2012, 02:14 AM »

4wd's Batch Shortcut Modifier, BSM, just finished adjusting nearly 700,000 shortcuts in a large directory tree -- all without hitch.

Thanks so much, 4wd, for some really helpful software!


Here are some possible enhancement for BSM, but by no means necessary.  BSM is great as is presently, in my opinion:

-- Progress indicator while Testing -- I wasn't sure anything was happening, so stopped BSM via Task Manager.

-- Remember preferred size/layout of Test window (BSM.ini file entry?)

-- Remember state of check boxes, such as Recurse on (BSM.ini file entry?)

-- Change Go ---> Stop, once process is underway.

-- Change notice when hovering over Go to "Starts Shortcut Modification"



4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: DONE: Batch adjust shortcut targets
« Reply #32 on: July 22, 2012, 12:18 AM »
4wd's Batch Shortcut Modifier, BSM, just finished adjusting nearly 700,000 shortcuts in a large directory tree -- all without hitch.

Thanks so much, 4wd, for some really helpful software!

Good to know at least one of my programs works :)


- Progress indicator while Testing -- I wasn't sure anything was happening, so stopped BSM via Task Manager.

Unfortunately, when it's sitting there looking like it's not doing anything, it's actually recursing through the folders looking for shortcuts, _all_ shortcuts, not just the first 20 for the test output.

Because the collecting of shortcuts is performed by an external function written by somoeone else, I'd need to rewrite parts of it to enable some form of indicator/interrupt, something I don't normally like doing because the functions were written by people with far more knowledge in AutoIt than me.

The time between the completion of shortcut collection and displaying the test output is less than a second - that bit is outside the above function and that's when the progressbar kicks in, 0->20 in less than a second.  I could change the Go->Stop->Go in that period but the change is almost instant - you don't have time to press Stop.

-- Remember preferred size/layout of Test window (BSM.ini file entry?)

That I can do, requires using another external function but seems easy enough.

-- Remember state of check boxes, such as Recurse on (BSM.ini file entry?)

-- Change Go ---> Stop, once process is underway.

-- Change notice when hovering over Go to "Starts Shortcut Modification"

They're easy.

As I suggested in the TCBOO thread, could you use skwire's ZeroZipper to zip up the tree with all the shortcuts and the tree with all the images, then just attach the archives in a PM - they should only be a few MB in size, then I'll have something to test against.

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 552
    • View Profile
    • Donate to Member
Re: DONE: Batch adjust shortcut targets
« Reply #33 on: July 22, 2012, 01:54 AM »

I'm using Folder Monitor (FolMon) all the time now.  Another example of your excellent work.

Thinking more about BSM, best to simply leave well enough alone.  Works terrifically.  Maybe someone else will have a substantive enhancement request at some point.  Who knows.

The images file folder = 50 gb
One tree of shortcuts = 1.45 gb
Another tree of shortcuts = 1.47 gb

I'll try using Skwire's ZeroZipper, and see how that goes.

If not, no worries.  Things are now all set up the way I had hoped.

Thanks again for your generous assistance!


« Last Edit: July 22, 2012, 02:03 AM by nkormanik »

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: DONE: Batch adjust shortcut targets
« Reply #34 on: July 22, 2012, 02:28 AM »
Thinking more about BSM, best to simply leave well enough alone.

:huh: Does that mean you don't want the radically faster version?

Still can't interrupt the fetching of shortcuts but time to fetch is >60% less than previous version, (just changed to using DOS dir command).

Now saves test output window size/position and resizes columns to fit contents, saves state of checkboxes, added a statusbar so at least it looks like it's doing something.

Haven't done the Go->Stop during processing yet - next day or so should see it finished.

Still like a copy of your image/shortcut tree so I can see if I can find where TCBOO is going belly up - the limit on string length is 2,147,483,647 characters, (which is a lot), so it would be interesting to see what's actually failing.

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 552
    • View Profile
    • Donate to Member
Re: DONE: Batch adjust shortcut targets
« Reply #35 on: July 22, 2012, 02:31 AM »

My goodness.  Definitely would like the new version, then.

I'm not positive how to send a PM.  Would you briefly say how?



4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: DONE: Batch adjust shortcut targets
« Reply #36 on: July 22, 2012, 02:46 AM »
Looks like you'll have to email them to me, no attachments in PMs.

And for future reference, to send a PM:

Screenshot - 22_07_2012 , 17_41_29.png
« Last Edit: July 22, 2012, 08:05 PM by 4wd »

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 552
    • View Profile
    • Donate to Member
Re: DONE: Batch adjust shortcut targets
« Reply #37 on: July 22, 2012, 02:50 AM »

Will do.  Zero Zipper is now chugging along.



nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 552
    • View Profile
    • Donate to Member
Re: DONE: Batch adjust shortcut targets
« Reply #38 on: July 22, 2012, 07:42 PM »

Will send link by PM to one of those file-sharing sites.  Resulting file was too large to send by email.

Using Skwire's Zero Zipper, and letting it keep running while I went to bed:

ContourPlots.zip = 206 mb

I recompressed into .rar format, best compression:

ContourPlots.rar = 80 mb


Hope the file helps with whatever you want to attempt.



4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: DONE: Batch adjust shortcut targets
« Reply #39 on: July 23, 2012, 04:10 AM »
Thanks - I might have to slow it down a bit, it found 768780 shortcuts in 13.5 seconds - hardly enough time to make a cuppa.

Slightly better than the 62 seconds that v0.3 took.

UPDATE (v0.5) here:
  • Scanning for shortcuts is a bit faster, (relies on DOS dir command).
  • Saves position of main window and test output window, (will be saved when the respective window is closed).
  • Saves state of checkboxes.
  • Can interrupt shortcut processing, (not scanning though) - log file will open by default when interrupted.
  • Added a statusbar so it looks like it doing something.

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 552
    • View Profile
    • Donate to Member
Re: DONE: Batch adjust shortcut targets
« Reply #40 on: July 23, 2012, 03:08 PM »

Wow.  Pure magic.

Thanks for sticking with it.

Hope others find and use your programs.



weberxw

  • Participant
  • Joined in 2014
  • *
  • default avatar
  • Posts: 7
    • View Profile
    • Donate to Member
Re: DONE: Batch adjust shortcut targets
« Reply #41 on: September 26, 2014, 02:04 PM »
4wd, I hope you steel here 2 years later  :D
I'm trying to use BSM but I keep recieving this msg: Line 9834 - Error: Subscript used with non-Array variable.
I'm using BSM 0.5.

What I need is:
My shortchuts are in this folder: C:\Users\Rodotec2\Documents and I want to change the path and name of then monthly, so in September I'll have a path like this:
D:\RODOTECPAV\NF - Rod\09 2014\NF PDF but in October i need to change it for D:\RODOTECPAV\NF - Rod\10 2014\NF PDF

And the name are: PDF 09.2014 RODOTEC and I need to change it for PDF 10.2014 RODOTEC


Can you please help here?
Thank you for your work, i'm prety sure your BSM can solve my problem.

weberxw

  • Participant
  • Joined in 2014
  • *
  • default avatar
  • Posts: 7
    • View Profile
    • Donate to Member
Re: DONE: Batch adjust shortcut targets
« Reply #42 on: September 26, 2014, 04:42 PM »
Omg, I just set the "Recurse" checkbox.... and now works PERFECTLY.... I don't know if someone is seeing this still, but BSM works great!

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: DONE: Batch adjust shortcut targets
« Reply #43 on: September 27, 2014, 07:26 AM »
Omg, I just set the "Recurse" checkbox.... and now works PERFECTLY.... I don't know if someone is seeing this still, but BSM works great!

I'm still here, so does that mean it's working OK for you now?

The error you got previously seems to indicate a problem, I'll have a look at it in a few weeks when I'm back in-country, (OS ATM).

weberxw

  • Participant
  • Joined in 2014
  • *
  • default avatar
  • Posts: 7
    • View Profile
    • Donate to Member
Re: DONE: Batch adjust shortcut targets
« Reply #44 on: September 27, 2014, 02:22 PM »
Yes, work in part.
I was able to change the path, this works fine.
But I couldn't change the name using the same search parameters..

For example:
I change the path from D:\RODOTECPAV\NF - Rod\09 2014\PDF\ to D:\RODOTECPAV\NF - Rod\10 2014\PDF\
Using the parameter 09 (old path) 10 (new path)... this works nice and prety simple

But I tried to change the name using the same parameters and nothing changes...
My shortuct names are like PDF 09.2014 Rodotec

Am I doing something wrong?
The parameters to change the name are diferent?

Thanks again, happy to see you here yet hehe

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: DONE: Batch adjust shortcut targets
« Reply #45 on: September 28, 2014, 03:40 PM »
What RegEx are you using?

Screenshot of the interface, (for the RegEx), together with the Test window would be good also.

gendalf

  • Participant
  • Joined in 2014
  • *
  • default avatar
  • Posts: 3
    • View Profile
    • Donate to Member
Re: DONE: Batch adjust shortcut targets
« Reply #46 on: September 29, 2014, 06:07 AM »
BSM shows Error: Subscript used with non-Array variable. for me
i'm trying to change Disk letter of all of the shortcuts paths in the start menu.
i tried: G:\\(.*) -> D:\\\1 , G:(.*) -> D:\1 , $G(.*) -> D\1 , "G(.*) -> "D\1
all give me that error with or without test&recurse checkboxes
« Last Edit: September 29, 2014, 07:36 AM by gendalf »

weberxw

  • Participant
  • Joined in 2014
  • *
  • default avatar
  • Posts: 7
    • View Profile
    • Donate to Member
Re: DONE: Batch adjust shortcut targets
« Reply #47 on: September 29, 2014, 07:32 AM »
bsm screenshot.png

Like you can see on the screenshot, I was able to change the path but not the name.
What I'm I doing wrong?

Thanks again.

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 552
    • View Profile
    • Donate to Member
Re: DONE: Batch adjust shortcut targets
« Reply #48 on: September 29, 2014, 07:17 PM »
Glad BSM is being kept alive.  It's a much needed addition to our tool set.


gendalf

  • Participant
  • Joined in 2014
  • *
  • default avatar
  • Posts: 3
    • View Profile
    • Donate to Member
Re: DONE: Batch adjust shortcut targets
« Reply #49 on: September 29, 2014, 10:33 PM »

nkormanik, if by keeping alive you mean its not working at all  ;D