How do I find a text file created by a website to generate output

Hello! So I have been trying different things with this problem but I thought this seemed the easiest way; however, I need some help figuring out the right syntax.
I want to have my arduino do things (like spin a motor) when it finds a txt file that is produced by the website in SD card.
Here is the part of the sd code that tries (i guess ) to create a txt file inside the SD card

<script type="text/javascript">
var jsalarm={
        padfield:function(f){
                return (f<10)? "0"+f : f
        },
        showcurrenttime:function(){
                var dateobj=new Date()
                var ct=this.padfield(dateobj.getHours())+":"+this.padfield(dateobj.getMinutes())+":"+this.padfield(dateobj.getSeconds())
                this.ctref.innerHTML=ct
                this.ctref.setAttribute("title", ct)
                if (typeof this.hourwake!="undefined"){ //if alarm is set
                        if (this.ctref.title==(this.hourwake+":"+this.minutewake+":"+this.secondwake)){
                                clearInterval(jsalarm.timer)
                                countdowntimer()
				PrintWriter writer = new PrintWriter("alarm.txt", "UTF-8");
                        }
                }
        },

So this website that runs from the sd card creates a text file in itself and then I have the arduino look for it to do things.
So basically I have a nested SD finder: Here is the part of the code im trying to debug.

void setup()
{
  
  Ethernet.begin(mac,ip);
  pinMode(9,OUTPUT);
  server.begin();
  Serial.begin(9600);
 // initialize SD card
    Serial.println("Initializing SD card...");
    if (!SD.begin(4)) {
        Serial.println("ERROR - SD card initialization failed!");
        return;    // init failed
    }
    Serial.println("SUCCESS - SD card initialized.");
    // check for index.htm file
    if (!SD.exists("index.htm")) {
        Serial.println("ERROR - Can't find index.htm file!");
        return;  // can't find index file
    }
    Serial.println("SUCCESS - Found index.htm file.");
}
void  loop()
{
  EthernetClient client = server.available();
  if (client){
    boolean currentLineIsBlank = true;
    while(client.connected()) {
      if(client.available()){
        char c = client.read();
        if (c== '\n' && currentLineIsBlank) {
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connection: close");
          client.println();
          //web page
          webFile = SD.open("index.htm");        // open web page file
                    if (webFile) {
                        while(webFile.available()) {
                            client.write(webFile.read()); // send web page to client
                            if (SD.exists("alarm.txt"));
                              void functions();
                              SD.remove("alarm.txt");
                        
                        }
                        webFile.close();        
                    }
          break;
        }

Any help would be gracefully apreciated!

Where does the website create a txt file?.

Mark

Here: Its not equal to the previous because I saw that this seems to be the right way

 if (typeof this.hourwake!="undefined"){ //if alarm is set
                        if (this.ctref.title==(this.hourwake+":"+this.minutewake+":"+this.secondwake)){
                                clearInterval(jsalarm.timer)
                                countdowntimer()
                    var object = new ActiveXObject("Scripting.FileSystemObject");
                    var file = object.CreateTextFile("alarm.txt", false); 

                        }

btw you view the access that it makes here:
www.itcup.skuttcatholic.com

tamashy: So this website that runs from the sd card creates a text file in itself and then I have the arduino look for it to do things. So basically I have a nested SD finder: Here is the part of the code im trying to debug.

What's your underlying goal with this? As far as I can see, the first code snippet is part of a document that could be served out by a web server but it has nothing to do with the web server saving files locally. You don't say which file you're talking about but I guessed it's alarms.txt - I don't see any code to create that anywhere. Nor is it obvious why you want to save the file locally and then go look for it, rather than just carry out whatever action is implied by the file directly during the HTTP request. Perhaps if you explained the purpose behind all this i.e. what behaviour you're trying to achieve, we can suggest how to achieve it.

Thanks for reply PeterH. What I was trying to do with reading of the file is just a way for the arduino to know when to spin a motor as well as other physical actions. I was trying to create a file inside the file that is the website because I know the code that checks to see if the files are there, and the use that as a trigger for the arduino to do things.

the websitewww.itcup.skuttcatholic.com,which is the same stored the SD card i have , has a an alarm function. All I am trying to do is get my arduino to spin motors and the such when the alarm that you set on the website "goes off". I was just using the file creation in the website itself as a trigger. As in:

if (typeof this.hourwake!="undefined"){ //if alarm is set
                        if (this.ctref.title==(this.hourwake+":"+this.minutewake+":"+this.secondwake)){
                                clearInterval(jsalarm.timer)
                                countdowntimer()
                                var object = new ActiveXObject("Scripting.FileSystemObject");
                                var file = object.CreateTextFile("alarm.txt", false); 

                        }
                }

with this being the file creation:

var object = new ActiveXObject("Scripting.FileSystemObject");
var file = object.CreateTextFile("alarm.txt", false);

If there are other ways to accomplish this it would be great if i could know it

thanks

That is Javascript code which would run in the browser, or perhaps in the web server if it is implemented as a server-side script. Since the Arduino web server does not support server side scripting there's no way that's running on the Arduino. If it ran at the client (browser), it would create the file on the PC where the browser is running, not in the Arduino. If you want to create a file on the Arduino's SD card, [u]your sketch[/u] must create the file.

If you want the existence of the file to trigger the Arduino to do something then it seems to me that it would be more sensible to trigger that directly at the point where the file is created and not go through the rigmarole of creating the file and then testing whether it existing later.