Problems with the 'Change Path' script (or 'Edit Path' for Mac)


<< Scripting Changes in Path ...
Back to Portfolio FAQ index
Problems with Path inform ... >>

The 'changepath' script is a free download obtainable from the Extensis web site or CD as part of the 'scripting extras' archive. The (Windows) archive contains both compiled EXE files and VB project files. For Mac users, an AppleScript called 'Edit Path' with the same functionality is provided as part of the standard install.

In the examples below Mac users should substitute ':' for the Windows '\' folder delineator, and use '::' for ':\' or '\\'.

Here is a typical problem:

We have moved from one server to another. My problem now is to change the path in the links from ex. \\STRNT8\DTP to \\STRNT21\DTP. How do I do that? I tried the script "change path" but that didn't work.
 
The old server was named "STRNT8" and the new one is named "STRNT21". The old Volume was "DTP" and the new Volume is "DTP". This is an example of the 'old' string:
"\\STRNT8\DTP\A_00\xxxxxx.tif"
...which I want to change to:
"\\STRNT21\DTP\A_00\xxxxxxx.tif"
 
So why doesn't this work?

You should try:
Find string - "STRNT8\DTP\"
Replace string - "STRNT21\DTP\"

Note you omit the opening \\ and put a \ at the end. Sadly the script is not documented but in effect it does this:

Don't worry if you do an update that has worked but produced a 'broken' path. Simply take the whole path up to and including the first folder delineator after the 'broken' section and re-run the script.

One U-to-U forum member (Flemming) has suggested changing the Windows script code thus:

Public PortObj As Document ' CHANGED FROM Public PortObj As Portfolio.Document
 
Private Sub cmdGo_Click()
Dim theQuery As String
Dim PortGal As Gallery
Dim r As Integer
Dim sSearch As String
Dim sReplace As String
Dim iSearchLen As Integer
Dim test As Integer
Dim i As Integer
Dim fPath As String
Dim iLeft As Integer
Dim fNewPath As String
 
Set PortObj = New Document
' COPIED THIS CODE. TESTS IF PORTFOLIO IS RUNNING (AND IT HAS TO)
If PortObj.Count = 0 Then
' AND CREATES THE PROPER OBJECT
   r = MsgBox("Portfolio must be running for this script to operate.", vbCritical)
End If
 
Set PortGal = PortObj.Gallery(PortObj.GetGalleryIndexFromName(PortObj.GetActive))
sSearch = "strnt8"
' PUT YOUR OWN CRITERIA HERE (what to find
sReplace = "strnt21"
' PUT YOUR OWN CRITERIA HERE (what to put instead)
iSearchLen = Len(sSearch) + 2
' I ADDED the "+ 2" (it's a BUG)
 
theQuery = "Path" & vbTab & "contains" & vbTab & sSearch
' CHANGED FROM "starts with" TO contains"
On Error Resume Next
test = PortGal.Find(theQuery, 1, 0)
 
If test = 0 Then
   r = MsgBox("No records match your search criteria", vbExclamation)
Exit Sub
End If
 
For i = 1 To test
   fPath = PortGal.AllRecords(i).Field("Path").Value
   iLeft = Len(fPath)
   fNewPath = "::" & sReplace & (Right(fPath, (iLeft - iSearchLen)))
' I ADDED "::" & (BUG too)
   PortGal.AllRecords(i).Field("Path").Value = fNewPath
Next
 
r = MsgBox(Str(test) & " records were modified.", vbExclamation)
 
End Sub

The reason Flemming's change to the script works is because (officially) Portfolio stores path info in Mac style, thus '\\strnt8\myfolder\' is actually stored '::strnt8:myfolder:'. However, experimenting with text export of path info, it appears images archived from local Windows drives (& using the Windows version if the app) are stored in Windows syntax, e.g. 'D:\strnt8\myfolder\' and not Mac as documented. Trying to replace the :\ part of the path string can also produce unexpected results.



Question: Problems with the 'Change Path' script (or 'Edit Path' for Mac) [FAQ00098.htm]
Last Update:- 01 June 2006


<< Scripting Changes in Path ...
Back to Portfolio FAQ index
Problems with Path inform ... >>

Quick Search of PortfolioFAQ (word, words or phase): or try the Advanced Search

User-to-User Forums  |  Report error/typo/broken link  |  Request new topic  |  Ask a question

Site and articles © Mark Anderson 2001-2007 - Visit my home page


This FAQ is created and maintained using
Friday logo
Friday - The Automatic FAQ Maker