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

Can anyone spot a problem in this script please?

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

  • Can anyone spot a problem in this script please?

    I have been using this script with some modifications for two years. It was very kindly provided by Stan Matthews. I recently tried to change machines but after downloading a fresh version of A5V11 and copying the directory to the new maching I get "Couldnot open or create multi-user information file C:\Program Files (x86)\a5V11\Laprima\Laprima.MUF'. The file is there (Windows 10) with 0 bytes exactly as on the old machine (XP). So firstly can someone help me fix that? In the meantime I tried a minor change at the same time on the old XP machine, the change was to add a bcc_param to send the same pdf report elsewhere as a check that the file had been sent, you can see the two lines that I have changed. When I run the script, I get the message "File not found: "Your attached account covers the month of June". I'm not very familiar with scripting so it must be my mistake but it looks to me as though the script is looking for a file in the;
    if filefind.get(a5.Get_Path()+chr(92)+"Accounts "+cmonth(date()),FILE_FIND_DIRECTORY,"PN") = ""
    dir_create(a5.Get_Path()+chr(92)+"Accounts "+cmonth(date())) part but I'm sure I haven't changed that.
    I would really appreciate any help.

    'Date Created: 19-Oct-2013 03:07:47 PM
    'Last Updated: 04-Jun-2016 09:32:47 AM
    'Created By : usuario
    'Updated By : Laura Johnson
    parentform.commit()
    tbl = table.current()
    tbl.fetch_first()
    'debug(1)
    while .not. tbl.fetch_eof()
    query.filter = "cuscode = "+quote(alltrim(tbl.cuscode))
    query.order = ""
    to_param = Lookup("Clients","cuscode = "+quote(alltrim(tbl.cuscode)),"alltrim(email)")
    if alltrim(to_param) > "" 'only execute this section if an email address is found
    cc_param = a5_eval_expression("",local_variables())
    bcc_param = a5_eval_expression("carol@laprima-sl.com",local_variables())
    subject_param = "Monthly account from Laprima S.L."
    message_param = "Your attached account covers the month of "+cmonth(date())+"."
    if filefind.get(a5.Get_Path()+chr(92)+"Accounts "+cmonth(date()),FILE_FIND_DIRECTORY,"PN") = ""
    dir_create(a5.Get_Path()+chr(92)+"Accounts "+cmonth(date()))
    end if
    :report.SaveAs("AccMonthly","PDF",query.filter,query.order,a5.get_path()+chr(92)+"Accounts "+cmonth(date())+chr(92)+" Acct "+tbl.cuscode+".pdf")
    sleep(4)
    email_send(to_param,bcc_param,subject_param,message_param,a5.get_path()+chr(92)+"Accounts "+cmonth(date())+chr(92)+" Acct "+tbl.cuscode+".pdf")
    sleep(4)
    end if 'end of section to create and send email if address found
    tbl.fetch_next()
    end while
    fil.flush()
    fil.close()

    Thank you in advance,
    Trevor.

  • #2
    Re: Can anyone spot a problem in this script please?

    "Could not open or create multi-user information file C:\Program Files (x86)\a5V11\Laprima\Laprima.MUF'.
    Has nothing to do with the script. It indicates you do not have write access rights to the directory where the database is located. Windows often sets limited access until told otherwise.

    In the script itself it would seem that tbl.cuscode should be alltrim(tbl.cuscode) in both the report.saveas() lijne and the email.send() line.

    Code:
    if filefind.get(a5.Get_Path()+chr(92)+"Accounts "+cmonth(date()),FILE_FIND_DIRECTORY,"PN") = ""
     dir_create(a5.Get_Path()+chr(92)+"Accounts "+cmonth(date()))
     end if
     :report.SaveAs("AccMonthly","PDF",query.filter,query.order,a5.get_path()+chr(92)+"Accounts "+cmonth(date())+chr(92)+" Acct "+tbl.cuscode+".pdf")
     sleep(4)
    email_send(to_param,bcc_param,subject_param,message_param,a5.get_path()+chr(92)+"Accounts "+cmonth(date())+chr(92)+" Acct "+tbl.cuscode+".pdf")
    The first section checks to see if the directory to save in exists and if it doesn't, creates it.

    I would remove the leading space in both instances of +" Acct "+
    not sure Alpha would understand a file name beginning with a space.
    Last edited by Stan Mathews; 06-04-2016, 08:55 AM.
    There can be only one.

    Comment


    • #3
      Re: Can anyone spot a problem in this script please?

      Hi Stan, thank you for trying to help - again.
      O.k., my first problem is solved, I played around with the windows security settings and I can now open the database on the new machine.
      Getting back to the old machine and the second problem, I have removed the leading spaces in front of the " Acct " in both instances and added alltrim so it reads alltrim(tbl.cuscode in both instances. I also tried it with (alltrim(tbl.cuscode)) but neither work. The moment I remove the bcc address and the bcc_param in the send line, it works again (I have to remove both).
      So could the space after the Acct be causing the problem?
      I also noticed a colon at the beginning of the report.SaveAs line, is that o.k.? I would check it out but now that A5 has gone to Alpha Anywhere I can't find the syntax in the help file.
      Regards,
      Trevor.

      Comment


      • #4
        Re: Can anyone spot a problem in this script please?

        Maybe things accidentally got mangled when you made the change to the email_send(). I didn't really look at that line other than the path to the file to send. The syntax is

        Code:
         EMAIL_SEND( Send_To as C, Subject as C, Message as C [, Attachments as C [, CC as C [, BCC as C [, Store_In_Outbox as L [, Text_Type as C [, HTML_Message as C [, Profile as C [, Zip_Attach as L [, Silent as L ]]]]]]] )
        If you include a bcc you must include all the parameters before it in the proper order

        email_send(to_param,subject_param,message_param,a5.get_path()+chr(92)+"Accounts "+cmonth(date())+chr(92)+" Acct "+tbl.cuscode+".pdf","",bcc_param)
        There can be only one.

        Comment


        • #5
          Re: Can anyone spot a problem in this script please?

          Thank you so much. After a few tweaks (me, staggering about in the dark) it now works, although not yet on the new machine. Can you tell me where to find the list of functions\syntax that used to be on F1 key (A5V11 help file) please? Then I may not have to keep pestering you. The reason is that the internet connection isn't good here and after sending 27 of the 31 files, it stopped because it couldn't find the smtp server that I had specified in email settings. So I would like to try either a pause and restart but where it failed from, or at least just be able to specify what remaining files to send one by one, perhaps using 'ask'.
          Thanks again,
          Trevor.

          Comment

          Working...
          X