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

file.watch_create problem

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

    file.watch_create problem

    If I use the file.watch_create and put the file.watch_destroy after it it will
    not play the script at all. If I put file.watch_destroy before it it will play the script two times. What is wrong here.

    Thanks Willy

    #2
    Re: file.watch_create problem

    Hello pinzgauer,

    Can you be more specific, eg a code example?
    Marcel

    I hear and I forget. I see and I remember. I do and I understand.
    ---- Confusius ----

    Comment


      #3
      Re: file.watch_create problem

      Hi Marcel

      Sorry for the late answer but I did not get an email.
      Following is the script. It creates a XML File for the
      credit card company
      Thanks Willy


      'Date Created: 07-Jun-2007 11:09:17 PM
      'Last Updated: 04-Oct-2007 12:18:29 AM
      'Created By : verwalter
      'Updated By : verwalter
      ' Export Credit Card info in txt file for XML

      'message box for Ok or cancel cc charge
      code = UI_YES_NO + UI_ATTENTION_SYMBOL + UI_SECOND_BUTTON_DEFAULT
      response = ui_msg_box("Credit Card Charge", "Do You want to charge the Customer? ", code)
      if response = UI_YES_SELECTED then

      dim tbl as p
      dim xmlheader as c
      dim filename as c
      dim global filexml as c
      dim filexmlns as c
      dim accountnumber as c
      dim customername as c
      dim cardholderidcode as c
      dim expirationdate as c
      dim merchanttransid as c
      dim shared totalamount as n
      dim securitycode as c
      dim firstdigit as c

      tbl = table.get("customer")

      record_number = current_record_number()
      query.filter = "recno() = " + record_number

      'creates unique file name with seconds of the day
      filexml = "CNP" + toseconds(time())

      filename = "F:\Database\Inventory SAV\XMLSend" + chr(92) + filexml + ".xml"

      'create xml file header
      xmlheader = "<?xml version=" + chr(34)+ "1.0" + chr(34)+ "?>"
      filexmlns = "<File xmlns=" + chr(34)+ "x-schema:CNPCaptureRequestSchema.sch" + chr(34) + " UniqueFileName=" + chr(34) + filexml + chr(34) + " UseEncryption=" + chr(34) + "False" + chr(34) + " TransactionCode=" + chr(34) + "CNP" + chr(34) + " RecordType=" + chr(34) + "RQ" + chr(34) + " ProcessingCode=" + chr(34) + "CA" + chr(34) + " VNumber=" + chr(34) + "71115404" + chr(34) + ">"

      'get total amount and name of invoice
      totalamount = round(topparent:grand_total.value,2)
      customername = alltrim(tbl.firstname)+ chr(32) + alltrim(tbl.Lastname)

      'message box check customer and amount
      code = UI_OK_CANCEL + UI_ATTENTION_SYMBOL + UI_SECOND_BUTTON_DEFAULT
      response = ui_msg_box("Check Amount",customername + chr(32)+chr(32) + Transform(totalamount,"@$"), code)
      if response = UI_OK_SELECTED then

      accountnumber = alltrim(tbl.CC_Number)
      CardHolderIDCode = "@"

      'securitycode and indicator determination
      securitycode = alltrim(tbl.ccvcode)
      firstdigit = substr(tbl.CC_number,1,1)

      expirationdate = remspecial(tbl.cc_date)
      'creates unique number with cust_no and seconds of the day
      merchanttransid = substr(tbl.customer_id,4,2)+ toseconds(time())

      'create and write xml send file
      file_pointer = file.create(filename, File_RW_Shared)

      file_pointer.write(xmlheader)
      file_pointer.write_line("")
      file_pointer.write(filexmlns)
      file_pointer.write_line("")
      file_pointer.write("<Transaction>")
      file_pointer.write_line("")
      file_pointer.write("<AccountDataSource>@</AccountDataSource>")
      file_pointer.write_line("")
      file_pointer.write("<AccountNumber>" + AccountNumber + "</AccountNumber>")
      file_pointer.write_line("")
      file_pointer.write("<CardHolderIDCode>" + cardholderidcode + "</CardHolderIDCode>")
      file_pointer.write_line("")
      file_pointer.write("<CID>" + if(firstdigit = "3",securitycode,"") + "</CID>")
      file_pointer.write_line("")
      file_pointer.write("<CIDIndicator>" + if(firstdigit="3","1","0") + "</CIDIndicator>")
      file_pointer.write_line("")
      file_pointer.write("<CustomerName>" + customername + "</CustomerName>")
      file_pointer.write_line("")
      file_pointer.write("<CVC2>" + if(firstdigit = "5",securitycode,"") + "</CVC2>")
      file_pointer.write_line("")
      file_pointer.write("<CVC2Indicator>" + if(firstdigit="5","1","0") + "</CVC2Indicator>")
      file_pointer.write_line("")
      file_pointer.write("<CVV2>" + if(firstdigit = "4",securitycode,"") + "</CVV2>")
      file_pointer.write_line("")
      file_pointer.write("<CVV2Indicator>" + if(firstdigit="4","1","0") + "</CVV2Indicator>")
      file_pointer.write_line("")
      file_pointer.write("<DCID>" + if(firstdigit = "6",securitycode,"") + "</DCID>")
      file_pointer.write_line("")
      file_pointer.write("<DCIDIndicator>" + if(firstdigit="6","1","0") + "</DCIDIndicator>")
      file_pointer.write_line("")
      file_pointer.write("<ExpirationDate>" + expirationdate + "</ExpirationDate>")
      file_pointer.write_line("")
      file_pointer.write("<MerchantTransactionID>" + merchanttransid + "</MerchantTransactionID>")
      file_pointer.write_line("")
      file_pointer.write("<ShipDate>" + dtoc(date(),"6/") + "</ShipDate>")
      file_pointer.write_line("")
      file_pointer.write("<TransactionAmount>" + totalamount + "</TransactionAmount>")
      file_pointer.write_line("")
      file_pointer.write("</Transaction>")
      file_pointer.write_line("")
      file_pointer.write("</File>")
      file_pointer.flush()
      File_pointer.Close()

      'look for new file in XMLReceive
      file.watch_destroy("response")
      file.watch_create("response", "F:\Database\Inventory SAV\XMLReceive", "F", " script_play_local(\"CC ReadPrint\")")


      elseif response = UI_NO_SELECTED then

      end if

      elseif response = UI_NO_SELECTED then

      'Confirmation of not charged credit card
      code = UI_OK + UI_QUESTION_SYMBOL + UI_SECOND_BUTTON_DEFAULT

      response = ui_msg_box("Credit Card", "No Charges have been made", code)

      end if

      Comment


        #4
        Re: file.watch_create problem

        Hello Willy,

        I read your code and have some questions and remarks.

        You are creating an XML file in folder XMLSend:

        F:\Database\Inventory SAV\XMLSend" + chr(92) + filexml + ".xml

        Later you are looking in folder XMLRecieve, which differs from XMLSend, if the file is created (recieved?).

        file.watch_create("response", "F:\Database\Inventory SAV\XMLReceive", "F", " script_play_local(\"CC ReadPrint\")")

        Do you want to check if the XML file is created?

        Another thing is that "response" is used as a variable for the ui_msg_box() and as the watch name. I would change the name for the watch in w_response, just to make it unique for the watch.

        The FILE.WATCH_DESTROY() is stopping the waching process. So you first have to determine what you want to watch and also what should kill the watch process.

        Putting it before will kill an older watching process and putting it direct behind the FILE.WATCH_CREATE() will not work properly as you would expect. These type of processes are asynchronous (threads). They even can still be active after the script has closed. So a previously watch thread can be active when the script starts again. I would introduce a kind of metafore/flag that is set when CC ReadPrint has executed and than kill the watch process or let CC ReadPrint kill the watch process.

        I do not know how this script is embedded in your solution but it looks like it really sees 2 files being created. Check with FileFind.get() which files that are.

        Maybe other readers have also new insights about how file.watch_create() is working.

        ++++++++++++++

        See also Similar threads on the bottom of this page.
        Last edited by Marcel Kollenaar; 10-10-2007, 05:53 AM. Reason: Added similar threads
        Marcel

        I hear and I forget. I see and I remember. I do and I understand.
        ---- Confusius ----

        Comment


          #5
          Re: file.watch_create problem

          Hi Marcel

          Thanks for your help, but a was not able to get it to work. I am using
          now FOR,NEXT with the File.exists. This works great. An it is also easy
          to give it a max time tolook for the file. (no endless loop)

          Thanks Willy

          Comment


            #6
            Re: file.watch_create problem

            Great Willy, your solution is simpler >>> better :)
            Marcel

            I hear and I forget. I see and I remember. I do and I understand.
            ---- Confusius ----

            Comment

            Working...
            X