Replace function triggering oddness

Need help with a script? This is the place to discuss how to get your code running!

Replace function triggering oddness

Postby OceanWolfe » Mon Sep 04, 2017 4:12 pm

I have a piece of code that first uses the replace function to remove a selected line from a field. It operates properly and the field shows up with the appropriate line removed. However, the next step seeks to copy that resulting field to a variable. It returns empty. I"ve tried to harvest the contents of the field from several angles (get, then put it into a variable; put the contents of the field into a variable, etc.). All return as empty, though the field clearly is not.
Any ideas?
Here's the latest version of the script lines.

put replace (cd fld "ToDo Soon",taskStore,"") into cd fld "ToDo Soon" --taskStore contains the text I want removed
get the contents of cd fld "ToDo Soon"
put it into ToDoSoon
put ToDoSoon into cd fld "test7"

Yes, I know there are more steps than necessary, I've just been trying alternate routes to see if I could find one that returned the field contents. I started with a simple 'put the contents of cd fld "ToDo Soon" into ToDoSoon'
OceanWolfe
 
Posts: 8
Joined: Fri Aug 25, 2017 3:54 pm

Re: Replace function triggering oddness

Postby Scott » Mon Sep 04, 2017 10:17 pm

You might want to have a look at the 'contents' entry in the Language Guide. All you need here is:

Code: Select all
get cd fld "ToDo Soon"


BTW... since you are new to SuperCard, HIGHLY recommended reading is 'Using the Script Tracer' starting on page 138 of the SuperCard User Guide. This is another one of those areas of SuperCard that blows the HyperCard equivalent out of the water.
User avatar
Scott
Site Admin
 
Posts: 1233
Joined: Sat Jul 05, 2008 1:37 pm
Location: Northern Sierra Nevada

Re: Replace function triggering oddness

Postby OceanWolfe » Tue Sep 05, 2017 3:36 pm

Thanks. Still hanging onto some of the Hypercard scripting terminology. I'll get there.
OceanWolfe
 
Posts: 8
Joined: Fri Aug 25, 2017 3:54 pm


Return to Scripting in SuperTalk

Who is online

Users browsing this forum: No registered users and 1 guest