AzeoTech

Administrators
  • Posts

    6,432
  • Joined

Posts posted by AzeoTech

  1. You can't really change the code page from script. Even if you changed the registry (which you could probably do externally using shellExecute() and some external app), you'd have to restart DAQFactory for it to take effect.

    FormatDateTime() can format your date any way you want. %c will use whatever the current system format is, or use other % codes to do it however you want. Its just a string, so you could, technically, make that a language phrase too! The graph component, however, is fixed.

    As for &, that is a windows code for shortcut and some controls draw it that way. Try just doing &&

  2. Your version should have that feature.

    V6.00 will likely be released in small steps instead of a large release. The graphics changes are a higher priority than unicode, but unicode is still important to us as a large number of customers are international. I don't have an exact timeline but the pressure is on now for us to make some progress.

  3. I'm not really sure what the end benefit is though. If you want an SMS, just use DAQFactory's email to email your cell SMS email (usually phone Number @ provider.com). Maybe its just that I don't use twitter, but perhaps you could tell me what the end goal is, without referring to twitter (i.e. I want to get alarm info on my cell, instead of I want to post to twitter so I can see it on my cell).

  4. I'm afraid I can't tell you why it reacts that way. In general I shy away from using the knob for slow devices. However, using a variable as an intermediary is a good way to make the knob work the way you want. I wouldn't use a v channel, just use a global variable. The only thing is that you would need a little sequence that checked that variable and when it changed, set the actual output. It would be a pretty simple sequence:

    global knobval = 1000
    while(1)
       if (knobval != DM_3[0])
    	  DM_3 = knobval
       endif
       delay(0.1)
    endwhile

    You'll need to preset DM_3 to some value so the if() can evaluate the first time.

  5. I guess ASCII doesn't have the bidirectional i/o types like RTU and TCP.

    >> Is it possible to get a "Knob component" to behave the same as the "Spin button" on startup?

    No.

    >> Is there any way to initialize the "Knob component" without it first writting "0" to the channel?

    Yes, provided the knob isn't on your initial screen you should be able to simply change the value of the channel it is referencing. This is, presumably, your output channel, so do:

    read(DM_3_RD)

    DM_3.AddValue(DM_3_RD[0])

    This will read the input and set the history of DM_3 to that value, thus initializing it. Using AddValue() prevents DF from sending the command to the device. It just inserts it into the history.

  6. The knob initializes with whatever variable / channel value is set. If you haven't read the channel yet, it will init to 0. On Modbus RTU at least, you can do Read Holding and use it both as an input and output, but I'm not sure about ASCII. You can initialize it manually in an autostart sequence by doing something like:

    mychannel.addvalue(20)

    which puts the value of 20 into mychannel, which if the knob is referencing mychannel, will set it to 20.

  7. Yeah, printpage doesn't work terribly well for this sort of thing. You are better off generating a file and then printing that file with an external application. You can trigger an external app to print by using system.shellexecute() with "print" as the action. This works on many applications. As for generating the file, the easiest is a text file using just file. functions, but you can also generate a PDF using Page.PrintPDF() That function is undocumented and doesn't work with every screen control, but should work with tables and text. The prototype is Page.PrintPDF(PageName, FileName, x, y) where PageName is a string containing the name of the page to create a PDF out of, FileName is the path to the pdf file you want to create, and x and y are not used, but should be set to 1000. Once you create the PDF you should be able to trigger a print of the PDF using shellexecute() and acrobat.

  8. OK, the easiest way to do this is to simply create a file with your report and then trigger printing it. For example, if you had three channels named test, test2 and test3 you would do something like this:

    // open file for writing:
    private handle = file.Open("c:\printme.txt",0,1,0,1)
    // write header:
    file.Write(handle, "This is a report!")
    //write data
    for (private x = 0, x < numrows(test), x++)
       file.Write(handle,format("%s\t%.3f\t%.3f\t%.3f",formatdatetime("%c",test.Time[x]),test[x],test2[x],test3[x]))
    endfor
    // close
    file.Close(handle)
    // print file
    system.ShellExecute("c:\printme.txt","print")

    This assumes that you have the .txt extension associated with notepad (the default). It may work if you have it associated with something else too.

    Most of the report formatting is done in that single format() function. The %s means put a string here (in this case the date formatted using the normal date/time format), the %.3f means put a number here with 3 decimals. The \t are tab characters and will put the numbers in nice columns. Note that if you have more than 18 channels, you are going to have to use multiple format() functions as DAQFactory functions accept a max of 20 parameters. You can just concat them using + (i.e. format(...) + format(...)) in groups of 10 or so.

    I've attached a sample as well. Let it run for a 30 seconds or so to accumulate a little data, then run the printtable sequence.

    reportsimple.ctl