SHORTCUT PARAMETERS UPDATERSo here are some basics of how It works for a user.
In the bottom half of the image is the application. In that The
Folder To Update is the folder that has the shortcuts that you want to update their parameters in.
There is also an include subfolders tickbox but that is not constructed yet. I will get that working soon
The top half is a display of the folder I have entered and as you can see the contents icons are not displayed because I moved their contents to a new folder.
After clicking the VIEW button the application displays all the shortcuts within the folder to update as well as the target the shortcuts are pointing to.
These are what need to be changed and the text that needs to be changed is in the
Text To Replace option. The
Replacement Text is the text that will replace the
Text To Replace when you click the update button. When the edit button gets clicked it updates all the shortcuts for their Target and the workspace parameters
This second image shows how all the shortcuts are now updated and you can see that because the
contents icons are now being displayed againFor the code all you should need to do, and I'm going to test it soon just to make sure.
All you need to do is copy it. Create a text file where you want it and rename it to something like ShortcutUpdater.hta Note: You must have windows set to show the file extensions in order to do that so it works
Googling it should help you to do it but I will show how if it gets requested
Once you have created the text file and named it you need to edit it with a basic text editor. I use Notepad++ because its free.
Open it in the editor and past the code save and close it. Now you should be able to double click it and it should execute like the images display
The next post will be a description about how the code works so it will help you to know how to change things so it fits your file setups better.
I am trying to make these changes as easy as possible. I'm not sure if its just my opinion or it is really true but I see web development and VBS to be quite easy to learn.
Saying that because if you don't know that stuff but it interests you then this may be something that will help you learn it? Don't forget google. My best friend for things I want to discover
Also, you really should check out the software before you run it. Just so you can be sure I am not doing something to rip you off or hurt your computer.
I promise to you that I am not doing any of that but you should never blindly believe what someone says. Especially with software they are giving away.
OK, I have downloaded the code, put it into a new text file reset to .hta and it got errors but the messages tells the lines where the errors are. There are 2 errors and if you check the code here you will notice there are 2 faces. They are supposed to be ) and they have been changed to yellow faces. You just need to add the ) to the end of the line where the error occurs in the text file
Actually, I just noticed that typing the ) here didn't show up as faces. So I deleted them and retyped them into the code and the faces disappeared.
I recopied this code and replaced the previous trials code with this code and it worked with no error. I will test it does the updates soon
OK, I have done an actual update now from the code I copied from here and everything worked fine. So hopefully it will work for you also
Now I need to adjust my shortcut creator version so it works similar to this. This one I started writing today so the other one shouldn't take too long
I have tried coloring the code a little bit, I thought it might make it a bit easier for people to follow
Red is HTML, green is styles for HTML objects and blue is the VB script.
I also adjusted the color levels to show separate parts. For example Darkest blue shows the start and end of subroutines and the light stuff between them is the code the executes when the sub is called.
I have also set the text you need to change to suit your own setup to yellow. Everything else can stay as it is unless you know how to program and want to make your own improvements
Sub means subroutine by the way
HERE IS THE CODE<html>
<head>
<style>
table{width:100%; border-collapse:collapse; border: 0px solid white; height:100% }
td {padding:3px; border-spacing:100px; border: 1px solid black;vertical-align:top; font-size:xx-small; }
input.inTbl{width:100%;border: 0px solid red;}
input.btn{width:100%;}
</style>
<script language=vbscript>
dim WshShell,fso
dim td1,td2,td3,td4
'dim td5
dim DefaultReplacementText,TextToReplace,OriginalReplacementText,ReplacementText
dim ShortcutsBaseFolder,retchanged
Sub Window_OnLoad()
ShortcutsBaseFolder="E:\02 IClone\"
DefaultReplacementText="E:\Reallusion\Template\ContentPacks"
set WshShell = CreateObject("Wscript.shell")
set fso = CreateObject("Scripting.FileSystemObject")
set td1=document.getElementById("tdFiles") : set td2=document.getElementById("tdResults") : set td3=document.getElementById("tdPath")
set td4=document.getElementById("tdWork") ': set td5=document.getElementById("tdFolder")
document.getElementById("txtFileLocation").value="E:\02 IClone\1ContentShortcuts\20) Celestial\Alians"
end sub
sub window_onunload()
set td1=nothing : set td2=nothing : set td3=nothing : set td4=nothing ': set td5=nothing
set WshShell = nothing : set fso=nothing
end sub
sub View()
td1.innerHTML="" : td2.innerHTML="" : td3.innerHTML="" : td4.innerHTML="" ': td5.innerHTML=""
document.getElementById("txtTextToReplace").value=DefaultReplacementText
DoTheView(document.getElementById("txtFileLocation").value)
end sub
Sub DoTheView(FileSpec)
set fldr=fso.GetFolder(FileSpec)
for each fle in fldr.Files
if fle.type="Shortcut" then
td1.innerHTML=td1.innerHTML & fle.name & "<br>"
Set oLnk = WshShell.CreateShortcut(fle.path)
td2.innerHTML=td2.innerHTML & oLnk.TargetPath & "<br>"
Set oLnk=nothing
end if
next
if document.getElementById("chkIncludeSubfolders").checked then
For Each Subfolder in fldr.SubFolders
DoTheView Subfolder.Path
Next
end if
set fldr=nothing
end sub
sub Update()
td3.innerHTML="" : td4.innerHTML="" ': td5.innerHTML=""
TextToReplace=document.getElementById("txtTextToReplace").value
ReplacementText=document.getElementById("txtReplacementText").value
OriginalReplacementText=trim(ReplacementText)
if trim(TextToReplace)<>"" then
td1.innerHTML="" : td2.innerHTML="" : td3.innerHTML="" : td4.innerHTML="" ': td5.innerHTML=""
DoTheUpdate(document.getElementById("txtFileLocation").value)
else
msgbox "You must enter at least the TextToReplace to do an update"
end if
end sub
sub DoTheUpdate(FileSpec)
set fldr=fso.GetFolder(FileSpec)
for each fle in fldr.Files
if fle.type="Shortcut" then
td1.innerHTML=td1.innerHTML & fle.name & "<br>"
Set oLnk = WshShell.CreateShortcut(fle.path)
td2.innerHTML=td2.innerHTML & oLnk.TargetPath & "<br>"
tp=oLnk.TargetPath
if instr(tp,TextToReplace)<>0 then
if trim(OriginalReplacementText)="" then ReplacementText=ShortcutsBaseFolder & getSourceFolder(tp)
tp=replace(tp,TextToReplace,ReplacementText)
if left(tp,1)<>"""" then tp="""" & tp
if right(tp,1)<>"""" then tp=tp & """"
td3.innerHTML=td3.innerHTML & tp & "<br>"
wd=tp
while right(wd,1)<>"\"
wd=left(wd,len(wd)-1)
wend
wd=left(wd,len(wd)-1)
wd=right(wd,len(wd)-1)
td4.innerHTML=td4.innerHTML & wd & "<br>"
oLnk.TargetPath=tp
oLnk.WorkingDirectory=wd
oLnk.Save
else
td3.innerHTML=td3.innerHTML & "not updated<br>"
td4.innerHTML=td4.innerHTML & "not updated<br>"
end if
Set oLnk=nothing
end if
next
if document.getElementById("chkIncludeSubfolders").checked then
For Each Subfolder in fldr.SubFolders
DoTheUpdate Subfolder.Path
Next
end if
set fldr=nothing
end sub
function getSourceFolder(loc)
ret="Reallusion"
retchanged=false
ret=checkThis(loc,ret,"3DEverything","Marketplace")
ret=checkThis(loc,ret,"4u2ges","Marketplace")
ret=checkThis(loc,ret,"Alley","Marketplace")
ret=checkThis(loc,ret,"BenjaminTuttle","Marketplace")
ret=checkThis(loc,ret,"BigBoss","Marketplace")
ret=checkThis(loc,ret,"BiggsTrek","Marketplace")
ret=checkThis(loc,ret,"Colonel_Klink","Marketplace")
ret=checkThis(loc,ret,"ColonelKlink","Marketplace")
ret=checkThis(loc,ret,"Delerna","Marketplace")
ret=checkThis(loc,ret,"Dexsoft","Marketplace")
ret=checkThis(loc,ret,"Dicho","Marketplace")
ret=checkThis(loc,ret,"Duchess","Marketplace")
ret=checkThis(loc,ret,"GrannyJ","Marketplace")
ret=checkThis(loc,ret,"Guppi","Marketplace")
ret=checkThis(loc,ret,"Irina","Marketplace")
ret=checkThis(loc,ret,"NL2012","Marketplace")
ret=checkThis(loc,ret,"Nova","Marketplace")
ret=checkThis(loc,ret,"owenssj","Marketplace")
ret=checkThis(loc,ret,"Peteradam6","Marketplace")
ret=checkThis(loc,ret,"Protofactor","Marketplace")
ret=checkThis(loc,ret,"QTheory","Marketplace")
ret=checkThis(loc,ret,"Quantam","Marketplace")
ret=checkThis(loc,ret,"Sen","Marketplace")
ret=checkThis(loc,ret,"SinisterGames","Marketplace")
ret=checkThis(loc,ret,"Texoma","Marketplace")
ret=checkThis(loc,ret,"TheBizMovies","Marketplace")
ret=checkThis(loc,ret,"ToKoMotion","Marketplace")
ret=checkThis(loc,ret,"Unknown","Marketplace")
ret=checkThis(loc,ret,"Warlords","Marketplace")
ret=checkThis(loc,ret,"Wengi","Marketplace")
ret=checkThis(loc,ret,"Wensk","Marketplace")
ret=checkThis(loc,ret,"WVeek","Marketplace")
ret=checkThis(loc,ret,"HDRIHaven","ExteriorStores")
ret=checkThis(loc,ret,"iCloneZero","ExteriorStores")
ret=checkThis(loc,ret,"KernalTopal","ExteriorStores")
ret=checkThis(loc,ret,"Mixamo","ExteriorStores")
'if not retchanged then td5.innerHTML=td5.innerHTML & "not changed<br>"
getSourceFolder=ret
end function
function checkThis(loc,ret,nme,newRet)
if instr(loc,nme)<>0 then
retchanged=true
ret=newRet
'td5.innerHTML=td5.innerHTML & nme & "<br>"
end if
checkThis=ret
end function
</script>
</head>
<body>
<table>
<tr><td>
<table id=tblFilters>
<tr style='background-color:steelblue;color:white;'><td>Common Words</td><td colspan=5 style='color:yellow;'>
E:\02 IClone\ ExteriorStores Marketplace Reallusion
</td></tr>
<tr style='background-color:steelblue;color:white;'>
<td width='1%' nowrap>Folder To Update</td>
<td colspan=3><input type=text class=inTbl id=txtFileLocation /></td>
<td width='1%' nowrap>Include Subfolders<input type=checkbox id=chkIncludeSubfolders /></td>
<td rowspan=2 width='1%'><input type=button class=btn onclick=View() value=VIEW /><br><input type=button class=btn onclick=update value=UPDATE /></td>
</tr>
<tr style='background-color:steelblue;color:white;'>
<td>Text To Replace</td>
<td width='50%'><input type=text class=inTbl id=txtTextToReplace /></td>
<td width='1%' nowrap>Replacement Text</td>
<td colspan=2><input type=text class=inTbl id=txtReplacementText /></td>
</tr>
</table>
</td></tr>
<tr><td height='98%'>
<table >
<tr style='background-color:steelblue;color:white;height:1%;text-align:center;'>
<td width='1%' nowrap>File Name</td>
<td width='30%' nowrap>Shortcuts Current Target</td>
<td width='30%' nowrap>Shortcuts New Target</td>
<td width='30%' nowrap>Shortcuts New Work Directory</td>
<!--td width='1%' nowrap>Folder</td-->
</tr>
<tr>
<td id=tdFiles width='1%' nowrap></td>
<td id=tdResults width='30%' nowrap></td>
<td id=tdPath width='30%' nowrap></td>
<td id=tdWork width='30%' nowrap></td>
<!--td id=tdFolder width='1%' nowrap></td-->
</tr>
</table>
</td></tr>
</table>
</body>
</html>
i7-3770 3.4GHz CPU 16 GB Ram
GeForce GTX1080 TI 11GB
Windows 10 Pro 64bit
Edited
6 Years Ago by
Delerna