Jump to content

This topic is 4307 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

It is my understanding that a script can be set up to perform automatically what I’ve been performing manually. Can you give me some direction for the script.  Let me begin at the beginning and I apologize if I'm giving too much information. 

 

I use a MacBook Pro running OSX 10.6.8 and FMP 12 Advanced.

 

I use an Apple product called GarageBand.  In GarageBand I import songs from iTunes and make what is called “Loops” which are selected parts of a given song.  These song Loops are stored in;

•  Finder>Library>Audio>Apple Loops>User Loops> SingleFIles

 

I go into the SingleFiles folder and copy the songs I want and paste them into Word.  The Song Loops look like this;

•  Toby Keith How Do You Like Me Now7.aif

In Word I do a "find and replace" so the above is changed like this, adding an * and deleting .aif;

Toby Keith*How Do You Like Me Now7

 

I then convert the Word dock into a Plain Text (txt) document and import it into FMP.   The Plain Text doc is imported into FMP using the field “Import_String” and the following fields perform the necessary separation into “Band_Name”, “Song_Name” and “Song_Number” etc.

 

Here are the FMP fields;

 

Import_String: Text field

Band_Name: Calc field with Text result:  

Let([

Pos=Position(ImportString;"*";1;1)];

Trim(Left(ImportString;pos-1))

)

Song_Name: Calc field with Text result

Let([

Len=Length(ImportString);

Pos=Position(ImportString;"*";1;1)];

Trim(Middle ( ImportString ; pos+1 ; len-pos-number length ))

)

Song_Number:  Calc field with number result

Right(ImportString;number length)

Number_Length:  Calc field with number result

Let([num= GetAsNumber(Right(Bands::ImportString;2));

len=Length(Num)];

len)

 

Song_Data:  Calc field with Text result

GetAsText ( Song Loop )    The information in this field looks like this;

remote:Toby Keith How Do You Like7.aif

AIFF:Secure/56/DE/9263CC8F/B6B79D97/02BF7C8C/550B

Song_Loop:  Container field External (Secure)  This field holds the actual MP3 allowing playback of the Loop.

 

Can you help me figure out how to set up a script for this.

 

Thank you,  HJ

Posted

Hi Harry,

 

To do this will require a script with multiple steps. It will revolve around the import script step. You can use that to import the song into the container field then use the getastext calc step to capture the filename and place that in a variable. Once you have the variable you can perform the character replace on the contents of the variable to replace the process you're using in Word. Then you can use the set field script step to set Import_String. From there everything should be fine.

 

pseudocode:

 

Import File

Set variable ( $FileName ; GetAsText ( container field ) )

Set variable ( $FileName ; substitute ( $FileName ; characters to change ; replacement characters )

Set field ( Import_String ; $FileName )

 

There might be some other steps you need to do additional text parsing or housekeeping, but this is the basic idea. This will get the file into the container field and capture the name in the format you need it.

 

Let me know if you need more help.

 

Levi

 

--

Laura (Levi) Vie | [email protected]  | 573-874-5176 | iChat:  leevie

Posted

Hi Levi,

 

it's good to hear from you again.  When I wrote my post I was concerned that I would not understand the information once I received it and that has turned out to be the case.  I got as far as setting the script to

Set variable ( $FileName ; GetAsText ( container field ) )

but that was as far as I was able to get.

 

I've been spending time reading about scripting and some of it is understandable and I've been able to write some simple scripts.  The more sophisticated scripting is more like a foreign language and will take me a bit longer to muster!

 

I try to wrap my brain around a lot of this and I'm happy to say I'm learning, albeit slowly. Worst of all is I feel as though I've wasted your time!  I just want you to know that I appreciate your help and kindness.

 

HJ

Posted

Harry,

 

You haven't wasted my time. You are trying to learn, you'll get it. Don't be afraid to play around with a test file. The easiest would be to create a copy of your actual database and create the script there so you can build it, modify it and test it without messing with any of the live records. Get to know the substitute calculation along with some of the other text parsing calculations. That is what you will use to recreate the find/replace that you were doing in Word. Think about each script step individually to reduce the sense of being overwhelmed.

 

I might also suggest the book Filemaker and Me if you haven't already looked at it.

 

Levi

 

--

Laura (Levi) Vie | [email protected]  | 573-874-5176 | iChat:  leevie

Posted

Hi Levi,

 

I just ordered "Filemaker and me" and any work I do or changes I make are always done in a copy, I learned that early on!  As for being overwhelmed, thats the easiest part but Filemaker has allowed me to do a lot of things i"m confident I could not have done in any other database. 

 

Thanks again Levi,

 

HJ

Posted

Filemaker is a very cool database app for that very reason.

 

Are you making headway on the script or do you need more help?

 

Levi

 

--

Laura (Levi) Vie | [email protected]  | 573-874-5176 | iChat:  leevie

Posted

Hi Levi,

 

RE: Are you making headway on the script or do you need more help?

 

Thank you but i"m a long way off from understanding this.  Thats why I said earlier I should not have asked the question because I new the answer is just way out of my wheelhouse.  To let you know how bad things are I barley know what a wheelhouse is, just enough to know i'm out of it!

 

I've been looking at some other scripts from solutions I've downloaded in hopes to understand better but as you said earlier, it will take awhile.

 

HJ

Posted

You should ask the question so that you can get direct responses to help guide your study. It sounds like you're starting to get a little frustrated with this. You are doing the right things.

 

Levi

 

--

Laura (Levi) Vie | [email protected]  | 573-874-5176 | iChat:  leevie

Posted

Hi Levi,

 

Getting a little frustrated I think is true, but I think its more of a recognition that i'm over my head at this stage in my development process. I know there is a given "logic" to the how and way of Filemaker and I accept that will take time. I know I'll figure it out eventually and hopefully can help others as you've been good enough to help me.

 

Harry

Posted

Harry,

 

You'll get it if you hang in there. You've come a long way in the couple of weeks that I've known you. As you play with it you'll see the logic and it will grow on you. its a heck of a lot of fun. If you feel like you need a little extra help for training or development to get over the hump we can help you with that.

 

Levi

--

Laura (Levi) Vie | [email protected]  | 573-874-5176 | iChat:  leevie

This topic is 4307 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.