simple applescript string issue

This script works great.

But I would like to hard code in the following strings:

=====================
sSearch  

and

sReplace
=====================

I am not in a position to learn new code languages, so I figure this is a simple syntax issue.

The code asks for a pop up box currently:

// Snippet from the attached code //

      

    set sSearch to text returned of
     (display dialog "Enter the beginning of the path to be replaced:
(e.g. Macintosh HD:FolderName:)" default answer "")

      set sReplace to text returned of
    (display dialog "Edit this path to match how it should be edited for Items in the catalog:" default answer sSearch)


// End Snippet //

I just want to hard code sSearch to:

this exact string
----------------------------

C:\Documents and Settings\cntmedia\My Documents\cntmedia_library\Source\

----------------------------

And sReplace to the exact string:
----------------------------

/Volumes/300gig/cntmedia_library/Source/

----------------------------


Thanks!


(*  Change Path Script for Portfolio 8.5  *)
 
 
-- Check to make sure Portfolio is running 
tell application "Finder" to set P_app to every process whose name contains "Portfolio"
if P_app is {} then
	display dialog ¬
		"Portfolio must be running for this script to operate." buttons {"OK"} default button {"OK"}
	return
end if
 
tell application "Portfolio"
	-- Check to make sure a catalog is opened 
	tell application "Portfolio" to set windowCount to count every document
	if not (exists of document 1) then
		display dialog ¬
			"A Portfolio catalog must be opened for this script to operate." buttons {"OK"} default button {"OK"}
		return
	end if
	
	--Get the appropriate search information from the user
	set sSearch to text returned of (display dialog "Enter the beginning of the path to be replaced:
(e.g. Macintosh HD:FolderName:)" default answer "")
	set sReplace to text returned of (display dialog "Edit this path to match how it should be edited for Items in the catalog:" default answer sSearch)
	if name of selected gallery of the front document ` name of gallery 1 of the front document then
		set cButton to button returned of (display dialog "Edit items in the current gallery, or the whole catalog? " buttons {"Entire Catalog", "Current Gallery"} default button 1)
	else
		set cButton to "Entire Catalog"
	end if
	
	-- pad the strings with ":" at the end
	(*
	if the last character of sSearch ` ":" then set sSearch to sSearch & ":"
	if the last character of sReplace ` ":" then set sReplace to sReplace & ":"
	*)
	set searchLength to length of sSearch
	set replaceLength to length of sReplace
	
	-- go to the proper gallery
	if cButton = "Entire Catalog" then
		tell the front document to display gallery 1
	end if
	set currentGallery to name of selected gallery of the front document
	set recordCount to count every record of gallery currentGallery of the front document
	
	set myIndex to 1
	set replaceCount to 0
	tell gallery currentGallery of the front document
		repeat recordCount times
			if file path of record myIndex starts with sSearch then
				tell record myIndex
					set thePath to file path as Unicode text
					set recordLength to the length of thePath
					set file path to sReplace & characters (searchLength + 1) through (recordLength) of thePath
					set replaceCount to replaceCount + 1
				end tell
			end if
			set myIndex to myIndex + 1
		end repeat
	end tell
	
	-- If no items were found, tell the user and then quit.
	if replaceCount is 0 then
		display dialog ¬
			"No Item Paths were found to match the Path entered. 
			
Be sure you are entering the beginning of the path you want to edit (e.g. Macintosh HD:FolderName), not an item within the path  (e.g. FolderName)." with icon 2 buttons {"OK"} default button {"OK"}
		return
	else
		display dialog ¬
			"Script completed. " & replaceCount & " items edited. " & "
 
Items found with a matching file path have been edited." buttons {"OK"} default button {"OK"}
		
	end if
end tell

Open in new window

cntmediaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

aherpsCommented:

set sString to "C:\\Documents and Settings\\cntmedia\\My Documents\\cntmedia_library\\Source\\"
set sReplace to "/Volumes/300gig/cntmedia_library/Source/"

Open in new window

0
cntmediaAuthor Commented:
The script is returning an error of:


variable sSearch not Defined.

Wondering where I would be messing up there.

I understand it's doing a query and replace, but it didn't work on my side.
0
aherpsCommented:
Sorry - mistype.

If you're just trying to hard code the results (without the need for the prompt) see below.

Sorry, I had sString instead of sSearch
set sSearch to "C:\\Documents and Settings\\cntmedia\\My Documents\\cntmedia_library\\Source\\"
set sReplace to "/Volumes/300gig/cntmedia_library/Source/"

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Swift Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.