Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2004
    Posts
    10

    Changing an on-click action

    Is it possible to have an action change the coding for another action?

    Here is what I am trying to do. On one page of my app i have a server listbox that is populated from an ini. The data for the listbox items is the ip address of the server. When the "ping" button is pushed it executes a batch file that pings the servers and writes the results to a text file. It then uses string actions to extract the pings of each server by finding the ip and moving to the the characters representing the ping. Then displays the ping next to the server in a paragraph block. Initially the app has a default list of servers listed in the ini and the batch. Two fields are used to add a server name and ip manually which updates the ini and batch as well as the listbox.

    What I cannot for the life of me figure out is how to have the ping button look for the ip of the new server and extract the ping. I was hoping when the server was added I could use a piece of code to change the code of the ping button.

    Below is the code I am using to ping the servers.
    Code:
    -- Clears the paragraph window
    Paragraph.SetText("Paragraph1", "");
    
    -- Runs the batch file to ping servers
    File.Run("AutoPlay\\Docs\\pinger.bat", "", "AutoPlay\\Docs", SW_MINIMIZE, true);
    
    --Reads the results to a string
    serverlist = TextFile.ReadToString("AutoPlay\\Docs\\serverlist.txt");
    
    -- Finds the last 3 digits of the ip plus a colon
    ping1_loc = String.Find(serverlist, "137:", 1, false);
    
    --  Finds the ping
    ping1 = String.Mid(serverlist, ping1_loc + 19, 5);
    -- An if then statement that compares two numbers
    -- The Characters " Sent" appear at that location when the destination was unreachable.
    if (ping1 == " Sent") then
    ping1 = "?????"
    end
    
    ping2_loc = String.Find(serverlist, ".64:", 1, false);
    ping2 = String.Mid(serverlist, ping2_loc + 19, 5);
    -- An if ... else statement that compares two numbers
    if (ping2 == " Sent") then
    ping2 = "?????"
    end
    
    ping3_loc = String.Find(serverlist, ".73:", 1, false);
    ping3 = String.Mid(serverlist, ping3_loc + 19, 5);
    -- An if ... else statement that compares two numbers
    if (ping3 == " Sent") then
    ping3 = "?????"
    end
    
    -- Writes all ping values to the paragraph
    Paragraph.SetText("Paragraph1", ping1 .. "\r\n" .. ping2 .. "\r\n" .. ping3);
    Last edited by brdga; 06-26-2004 at 11:14 PM.

  2. #2
    Join Date
    Jul 2003
    Posts
    712
    Hello,

    The easiest way to change a piece of code is with boolean values.

    In its basic form, let's imagine you have two buttons. When you click the first button, it will update the text in a paragraph object to say either "Button 2 has not been clicked" or "Button 2 has been clicked".

    The code you would place on button 1 would be this:
    Code:
    if bClicked then
    Paragraph.SetText("Paragraph1", "Button 2 has been clicked");
    else
    Paragraph.SetText("Paragraph1", "Button 2 has not been clicked");
    end
    The code to place on button 2:
    Code:
    bClicked = true;
    and to be safe, place the following code on the onstartup event of your project:
    Code:
     bClicked = false;
    Obviously this is something that you'll have to play with, but that's how to make code do something based on something else.

    Hope that's helpful for ya.

Similar Threads

  1. password
    By zeebaf in forum AutoPlay Media Studio 4.0
    Replies: 6
    Last Post: 04-28-2003, 07:44 PM
  2. Replies: 1
    Last Post: 12-13-2002, 03:11 PM
  3. INFO: Tips for Debugging Action Lists in AutoPlay Media Studio 4.0
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-03-2002, 08:38 AM
  4. SUF6.0.0.2 -- installer hangs.
    By jassing in forum Setup Factory 6.0
    Replies: 4
    Last Post: 12-19-2001, 11:28 PM
  5. Action on mouse click.
    By Lazerpower in forum AutoPlay Menu Studio 3.0
    Replies: 5
    Last Post: 12-10-2001, 10:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts