Jump to content

a looping script for your entertainment


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

Recommended Posts

I am going to post two more items in this thread following this.

First will be a structure for a simple database file and a looping script which takes about a half-minute to run.

Second will be code for 5 format files (copy and paste - written for .fp5, edit if necessary).

Make a folder "loop". Make a folder "database" and place it in "loop".

Put the db file (loop.fp5 or fp3) in "database".

Ultimately "loop" will contain 4 format files and "database". You will place "loop" in your Web folder and place default.htm in Web Folder (removing other stuff - I made a folder "Orig. Web" in my FM Applications in which I store whatever came with the application and projects I have completed or have in progress at various levels).

Set your Web Security for the db file "loop.fp5" (or .fp3) for all users, browse and script. Run this as you would any web development (fake lan or whatever).

You can try running this over multiple browsers at the same time. I use NN, it is more demanding. Open 2nd, etc browsers "File/New/Navigator" enter your url and resize the windows to very small and close together. Of course you will probably want to run it first in one browser to see what happens with just one user.

Have fun with this, it won't take very long to construct this stuff. And you can use this as a template to write a different non-looping script to test.

I have been unable to get a looping script to collide. My experience is that for some reason the looping script will queue somewhere in FMP.

Link to comment
Share on other sites

Meant to mention that the names of your folders and files should not have the quote marks.

First build a database loop.fp5 (or fp3)

There is one layout "web" showing two fields and their Type is number

Define Fields:

no0 /Type: number

no1 /Type: number

Next write a script: runloop

Enter Browse Mode []

Set Field ["no1" , "1"]

Go to Field []

Loop

Exit Loop If ["no0 >= 20000"] <!--written this way for pc users-->

Set Field ["no0" , "no0 + 1"]

End Loop

Set Field ["no1" , "no1 + 1"]

Set Field ["no0" , "1"]

Go To Field []

You will need only one record. Enter the number 1 into field no1. (you can always put a button on the layout to test the loop.) The number in field no1 should increment by 1.

If you want to get fancy, you can create three fields (time, 24 hour notation) and set a start_time in stime as the first step, an end_time in etime as the final script step before Go To Field [] and the calculation_time (etime-stime) will give you an approximate run time in seconds. This part is not necessary and is extra work.

Remember to set Web Security and Sharing for this db and your fake lan or whatever you are running this on.

Link to comment
Share on other sites

There are five format files: default.htm, blank.htm, error.htm, home.htm and success.htm.

You should create the head and title and body parameters for each, as well as the closing tags. I provide code for the bodies.

For default.htm:

within a <form action... /form> write (I am leaving the close-form off to help this display)

<form action="loop/fmpro" method="post">

<!--notice the folder designation-->

<input type="hidden" name="-db" value="loop.fp5">

<input type="hidden" name="-script" value="runloop">

<input type="hidden" name="-format" value="blank.htm">

<input type="hidden" name="-error" value="error.htm">

<input type="submit" name="-findall" value="CLICK">

______________________

For blank.htm you need to insert (starting in the head tag)

<meta http-equiv="refresh" content="0;url=fmpro?-db=loop.fp5&-format=success.htm&-recid=[fmp-currentrecid]&-find">

</head>

<body bgcolor="#ffffff">

</body>

_______________________

For success.htm all you need in the body is:

<p>

[fmp-field:no1]</p>

<p>

<form action="fmpro" method="post">

<input type="hidden" name="-db" value="loop.fp5">

<input type="hidden" name="-format" value="home.htm">

<input type="submit" name="-findall" value="Home">

</form></p>

__________________________

For error.htm all you need is:

<p>

I will never see this page.</p>

______________________

home.htm will look almost exactly like default.htm

For home.htm:

within a <form action... /form> write (I am leaving the close-form off to help this display)

<form action="fmpro" method="post">

<!--notice the folder designation has been removed-->

<input type="hidden" name="-db" value="loop.fp5">

<input type="hidden" name="-script" value="runloop">

<input type="hidden" name="-format" value="blank.htm">

<input type="hidden" name="-error" value="error.htm">

<input type="submit" name="-findall" value="CLICK">

remember to close your tags/pages.

Have fun with this.

Link to comment
Share on other sites

I know you all work very hard all week long. And you look forward to goofing on the weekend. But I hope that those of you who are interested in the script problem will follow the above instructions and try this out. Some time next week I will post more about the loop, and provide more codes and structures so that those who want to see a script collision will be able to create their own and do so. Additionally, those who try this will find out from the next step how a simple looping script can make other actions very cumbersome. And we will be shortening the loop's run time in the next step.

Link to comment
Share on other sites

This topic is 8351 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.