Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Script executes improperly

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Script executes improperly

    I have the following code:
    ---------------
    dim quit as n
    dim bckup as n
    'Backup
    bckup = ui_msg_box("Backup Program & Data","Press YES to backup your files.",3)
    IF bckup = 6
    script_play_local("Backup")
    END IF
    'end

    'Quit
    quit = ui_msg_box("QUIT!","Do you really want to quit PBS?",3)
    IF quit <> 6
    :Form.view("Main Menu")
    ELSE
    a5_close_all_windows()
    parentform.Close()
    a5.Close()
    END IF
    --------------
    The script "backup" does not execute when followed by the Quit code. HOWEVER, if I END the code before the Quit section, the backup code executes just fine. I've tried using XBASIC_WAIT_FOR_IDLE() but that doesn't do a thing in terms of code execution.

    What am I doing wrong??? Thanks.

    #2
    Re: Script executes improperly

    Steve

    What is the code behind the script "Backup"

    It may be a timing issue

    Tom Baker

    Comment


      #3
      Re: Script executes improperly

      try adding a 'then' to the end of the if statements. eg;

      IF bckup = 6 then
      script_play_local("Backup")
      END IF
      -----------------------------------------------
      Regards
      Mark Pearson
      [email protected]
      Youtube channel
      Website

      Comment


        #4
        Re: Script executes improperly

        What am I doing wrong???
        Steven, I'm no mind reader, but think maybe you're making an incorrect assumption about how Alpha processes your script.

        You may be assuming that the script will stop processing statements (i.e. pause) while your "BACKUP" script is run. You may be thinking that the script will "resume" after "BACKUP" is over.

        Because of the way Windows multi-tasks I suspect that what's happening instead is that your BACKUP script is running (or at least starts) but your main script does NOT PAUSE. As soon as you elect to QUIT Alpha shuts down, without waiting for the BACKUP sequence to conclude.

        I suggest you move your "Backup" script into a custom UDF that returns a logical result. Then "play" it like this:

        Code:
        L_result =  Backup_my_data()
        Alpha will wait for the "L_result" before resuming its march through the main script.

        Comment


          #5
          Re: Script executes improperly

          Try:
          Code:
          dim quit as n
          dim bckup as n
          bckup = ui_msg_box("Backup Program & Data","Press YES to backup your files.",3)
          IF bckup = 6
          script_play_local("Backup")
          else
          quit = ui_msg_box("QUIT!","Do you really want to quit PBS?",3)
          IF quit <> 6
          :Form.view("Main Menu")
          ELSE
          a5_close_all_windows()
          parentform.Close()
          a5.Close()
          END IF
          END IF

          Comment


            #6
            Re: Script executes improperly

            Steven, I'm very curious to know how long you've been using A5? And, if a new user, what prompted you to use the numbers in the message box codes?

            I was surprised to see you using numbers for the message box codes. Most new users seem to use the built-in variable names instead.

            There's nothing wrong with using the numbers. It was just a surprise to see someone with so few posts and a Dec. '09 date using them. In fact, I started using the variables only because I was afraid any newer user that might some day have to edit my code would be completely confused if I continued using the numbers.

            Comment


              #7
              Re: Script executes improperly

              Originally posted by Tom Cone Jr View Post
              I suggest you move your "Backup" script into a custom UDF that returns a logical result. Then "play" it like this:

              Code:
              L_result =  Backup_my_data()
              Alpha will wait for the "L_result" before resuming its march through the main script.
              Tom,
              Yes, timing is the problem. I was assuming code executing sequentially, waiting until one thing is done before continuing.

              I'm not sure where to put the "L_result" and how this would slow things down. I'v created two functions: Bckup() and Quit() which execute sequentially when the Quit button is clicked. This doesn't (probably obvious to you why) solve the problem. A little more code detail would be greatly appreciated. Thanks!

              Comment


                #8
                Re: Script executes improperly

                You say the backup script runs when the quit one is removed.
                For the backup script to run, the variable "backup" has to be 6.
                Who sets its value to 6?
                When?
                Where?

                Comment


                  #9
                  Re: Script executes improperly

                  Code:
                  dim quit as n
                  dim bckup as n
                  [COLOR="Red"]dim L_result as L[/COLOR]
                  'Backup
                  bckup = ui_msg_box("Backup Program & Data","Press YES to backup your files.",3)
                  IF bckup = 6
                      'script_play_local("Backup")
                  [COLOR="red"]    L_result = bckup()  'NOTE:  I'd rename the function.  Why use same
                                                 'name as the variable you dimmed?  Use diff names
                                                 'for everything.  You'll keep your hair longer.
                      If L_result then 
                           msgbox("Status","Backup was successful")
                      else
                           msgbox("Status","Backup failed")
                      end if[/COLOR]
                  END IF
                  'end
                  
                  'Quit
                  quit = ui_msg_box("QUIT!","Do you really want to quit PBS?",3)
                  IF quit <> 6
                      :Form.view("Main Menu")
                  ELSE
                      a5_close_all_windows()
                      parentform.Close()
                      a5.Close()
                  END IF
                  Not sure what's in your functions since you're keeping your code a secret, but this is what I had in mind.

                  Comment


                    #10
                    Re: Script executes improperly

                    Tom,

                    It works when executed directly from the Code tab in the control panel, but it does not work properly when executed from a menu button with the code script_play("Quit")
                    Interestingly, the backup only occurs after the quitall code executes. If I say "No", then files are backed up. If "Yes" the program exits (as directed by the code).

                    I'm not trying to keep my code secret. I didn't want to burden anyone with looking at unnecessary code. I've attached the relevant code and will be happy to share any other code. Thanks for your help!!!

                    Comment


                      #11
                      Re: Script executes improperly

                      Steven, the Bckup() function does not return a logical value. It should be setup like this (pseudo code follows) :

                      Code:
                      Function Bckup as[COLOR="Red"] L [/COLOR]()
                          dim result_flag as L
                          result_flag = .f.
                          'now do your processing
                          'more processing
                          'if successful do this
                          result_flag = .t.
                          'else
                          result_flag = .f.
                          'end if
                         [COLOR="red"] Bckup = result_flag[/COLOR]
                      End Function
                      Does this make sense?

                      Comment


                        #12
                        Re: Script executes improperly

                        No really. I tried implementing, but the same timing program seems to occur. What I don't understand is that the code works when executed from the Code panel, but not from a form button. I can't seem to get the program to wait for the execution of the backup to complete.

                        Comment


                          #13
                          Re: Script executes improperly

                          ok, zip the whole shebang together and email it here with sample data.

                          [email protected]

                          we'll take a looksee this evening.

                          -- tom

                          Comment


                            #14
                            Re: Script executes improperly

                            OK Cal,
                            Since you brought it up, for those that want to know what they are, here is a chart I picked up from the message board years ago.

                            Code:
                            1st Button Default       No Symbol  Stop  Question Attention  Information    Response
                            Ui_ok                       0        16     32      48          64            1 = Ok
                            Ui_ok_cancel                1	     17	    33      49          65            2 = Cancel
                            Ui_abort_retry_ignore       2        18     34      50          66            3 = Abort
                            Ui_yes_no_cancel            3        19     35      51          67            4 = Retry
                            I_yes_no                    4        20     36      52          68            5 = Ignore
                            Ui_retry_cancel             5        21     37      53          69            6 = Yes
                                                                                                          7 = No
                            2nd Button Default		
                            Ui_ok_cancel               257       273    289     305	        321		
                            Ui_abort_retry_ignore      258       274    290     306         322		
                            Ui_yes_no_cancel           259       275    291     307         323		
                            Ui_yes_no                  260       276    292     308         324
                            Ui_retry_cancel            261       277    293     309         325		
                            							
                            3rd Button Default	
                            Ui_abort_retry_ignore      514       530    546     562         578	
                            Ui_yes_no_cancel           515       531    547     563         579
                            Mike W
                            __________________________
                            "I rebel in at least small things to express to the world that I have not completely surrendered"

                            Comment


                              #15
                              Re: Script executes improperly

                              That's a pretty neat chart once I figured out how to use it. I'm going to copy it somewhere for future reference.

                              For "newbies" to these numbers, the attached screenshot shows the basics - which are also in Mike's chart once you understand how to use it. (The basic numbers were in the [much] older Help files but aren't shown anymore.) His chart shows the combined totals of the various button/symbol combinations.

                              My recommendation was always to enter each option separately such as:
                              2+64+256
                              so the next guy (usually yourself after a few months away from it) doesn't have to waste time figuring out what 322 really means. Of course, the chart makes "decompiling it" much easier.

                              On the other hand, the variables are even easier to understand and not bad to type IF you use a keyboard macro program: (Have I ever mentioned keyboard macros before?)

                              ui_abort_retry_ignore+ui_information_symbol+ui_second_button_default

                              (That took me a total of 14 keystrokes including the two "+" signs - uiar+uisi+uisb. That's more than typing the numbers but a lot less than typing the whole thing out.)

                              Sorry, I had no good way to turn that page into a text file so all I could do was attach the screenshot.

                              Comment

                              Working...
                              X