176

(2 replies, posted in Script)

thanks!!!

177

(2 replies, posted in Script)

Hey guys, i'm looking for the command for: this:

main.cbtaxaurgencia.Checked := grayed   

i want to reset the checkbox to it's original state where's is 0 and 1 at the same time

178

(2 replies, posted in Script)

makes sence! thanks once again! big_smile

179

(2 replies, posted in Script)

Hey, i have this code:

procedure mainteste (Sender: string; Shift, Alt, Ctrl: boolean; X, Y: Integer);
var
existing_estado1_count : string;
existing_estado2_count : string;
existing_estado3_count : string;
existing_estado4_count : string;
existing_estado5_count : string;



begin
  existing_estado1_count := SQLExecute('SELECT COUNT(ID_estado) FROM assistencia WHERE upper(ID_ESTADO)=upper("1")');
  main.bxest1.Text := existing_estado1_count;
  existing_estado2_count := SQLExecute('SELECT COUNT(ID_estado) FROM assistencia WHERE upper(ID_ESTADO)=upper("2")');
  main.bxest2.Text := existing_estado2_count;
  existing_estado3_count := SQLExecute('SELECT COUNT(ID_estado) FROM assistencia WHERE upper(ID_ESTADO)=upper("3")');
  main.bxest3.Text := existing_estado3_count;
  existing_estado4_count := SQLExecute('SELECT COUNT(ID_estado) FROM assistencia WHERE upper(ID_ESTADO)=upper("4")');
  main.bxest4.Text := existing_estado4_count;
  existing_estado5_count := SQLExecute('SELECT COUNT(ID_estado) FROM assistencia WHERE upper(ID_ESTADO)=upper("5")');
  main.bxest5.Text := existing_estado5_count;
 if main.bxest1.value >3 then main.bxest1.Color := clred else main.bxest1.color := clwhite;
  if main.bxest2.value > 30 then main.bxest2.Color := clred else  main.bxest2.Color := clwhite;
   if main.bxest3.value > 30 then main.bxest3.Color := clred else  main.bxest3.Color := clwhite;
    if main.bxest4.value > 30 then main.bxest4.Color := clred else  main.bxest4.Color := clwhite;
     if main.bxest5.value > 30 then main.bxest5.Color := clred else  main.bxest5.Color := clwhite;

 end;

it's working fine, when i get a value above 3 or 30 the box changes color red, but i want to make this a range, for example from 0-3 white, from 3-6 yellow, >6 red
what would the best aproach be?
many thanks

180

(5 replies, posted in Script)

Hi Dmitry, i sent you my project, i don't know if you have received it.
I have solved the problem by using an SMTP relay  (turbosmtp it's the one i'm using)
I still have the problem for using the email like: YourName <Vascomorais@myemail.com>
Yahoo receipients ignores my email if i put it like that

181

(14 replies, posted in FAQ)

Hey Mathmathou, i implemented the code on every textbox i wanted to be checked:

Phone numbers, Emails, and even Brand Names on the database, the problem is:

Everytime i insert an item on the brand name with ' " ' char, i get a bug.
For example

MBP 13" 2010 (refering to the macbook pro 13")
I changed that to MBP13pol and i didn't had any more problems, until i wrote the follwing email today: 7star@7star.pt And it gave me another bug refering to this piece of code,

Do you know what could this be? in the meanwhile i'll just be careful when insertnig brands, and i'll deactivate the duplicate search for emails (as probably phone numbers would do just fine)

182

(9 replies, posted in Script)

Nop, sorry but it just says: Connection closed gracefully
Could it be that Portuguese ISP servers are different than your Russian ISP Server and require tunneling or something like that?
Send mail is a command written by youself right? could you implement SSL and TTL options? Check those out if you can please smile

183

(5 replies, posted in Script)

Thanks, simple stuff and works like a charm!
Almost finishing my database, still having problems with "SendMail" can't configure SSL or TTL servers, also can't send emails with my name, only with my email , this means that other people receive my emails "Vascomorais@myemail.com" instead of just "Vasco Morais"

184

(14 replies, posted in FAQ)

i guess  you can add this to a button save procedure and add the Cancel := True;  to the code right?

185

(5 replies, posted in Script)

Hello, i have a few text boxes with numbers, i would like to know if i can sum then and mutiply the sum
Many thanks

186

(2 replies, posted in Script)

weird, i tried that one before , didn't worked, now i copy paste it, worked like a charm...
Magic! smile

187

(2 replies, posted in Script)

Hello , sorry to bother you guys with (yet) another question about pascal.

What's the right syntax for filled / not empty?

if (frmAssistencia.cbestado.dbItemID = 2) and (frmassistencia.cbalocado.text =Filled )then

i want to move a state if both of these two are selected correctly and a box is filled

188

(9 replies, posted in Script)

well..., some servers require ssl, other ssl and tunneling , and other require nothing. i have sendmail working but i am using a server that doesn't require ssl , can't configure anything other than that...
I took a look at your example, funny you use the settings on the form to configure the sendmail comand, i tought about using the same system.
Anyway, i can't use Gmail, hotmail, outlook, or even yahoo mail, they all use SSL and they all say: connection ended gracefully, but when i created a new account at a non ssl server like "portugalmail" , the server works perfercly, i suspect that this is due because i can't turn on ssl option with the "sendmail" command... sad
Another problem i am having is UTF=8, when i send an email with special characters, like: "Não" i receive on the other end "não" , but strange enough, if i attach the pdf file with my report (that also uses special chars) i receive the email perfectly.

thanks Dmitri, i'll check! smile

190

(6 replies, posted in Reports)

Hello everyone, i'm not sure if it's a bug or if i'm doing something wrong.
But, i can't change the format of anything.
For instance
I can't change the Date format, i'm stuck with the original one. And i can't change boolean questions like the default NO , YES, i want to insert Não, Sim but i can't, even if i turn on the option to use True, False , it doesn't do anything.
Is it a bug?

191

(9 replies, posted in Script)

Hello everyone, where's the SSL setting on this command? and BTW, where's TTL too?
Also, on the "sender" email, what can i do write my name instead of my email?
i tried

Myname <myemail@email.com>  but i ended up with this:

Myname <myemail@email.com> <myemail@email.com>

192

(1 replies, posted in General)

Hello everyone, and HAPPY NEW YEAR!! big_smile

I have a question:
I want to print a report in A4, but also a label on my label printer.
Is it possible to choose a default printer for each button?

Many thanks

193

(2 replies, posted in General)

no problem, i'm thrilled with your program, can't wait to have the full version with php !!! smile

This script is very useful if you want to look at a data before saving and closing a form...

Imagine you have a combobox inside a form, and you want to know what's the rest of the values on the table according to the combo box id...

you can use this simple script
i don't know if there's an easier way to do this but... here it goes:

procedure frmAssistencia_CBContacto_Oncloseup (Sender: string);

var
 result: TDataSet;

 nome: string;
 empresa: string;
 nif: string;
 morada: string;
 cont1: string;
 cont2: string;
 email: string;

sID: string;

begin

   sid := frmAssistencia.CBContacto.sqlvalue;
   SQLQuery('SELECT nome, empresa, nif, morada, email , contacto1, contacto2 FROM clientes WHERE id="'+sid+'"', Result);


   nome := result.fieldbyname('nome').AsString;
   empresa := result.fieldbyname('empresa').AsString;
   nif := result.fieldbyname('nif').AsString;
   morada := result.fieldbyname('morada').AsString;
   email := result.fieldbyname('email').AsString;
   cont1 := result.fieldbyname('contacto1').AsString;
   cont2 := result.fieldbyname('contacto2').AsString;


   frmAssistencia.bxnomecliente.text := nome  ;
   frmassistencia.bxempresacliente.Text := empresa ;
   frmassistencia.bxnifcliente.text := nif ;
   frmassistencia.bxmoradacliente.Text := morada;
   frmassistencia.bxcont1cliente.Text := cont1;
   frmassistencia.bxcont2cliente.text := cont2;
   frmassistencia.bxemailcliente.text := email;



end;

195

(2 replies, posted in General)

1 - Create a table with a valid name: example: Table
2 - (don't know if you need this step or not) , create values inside that table
3 - Change name to an invalid name eg. Table (1) with spaces

The program will tell you it's an invalid name but it will show up table (1)

on that point on, the table you created is gone from the system, you would need to manualy repair it from tables.ini

196

(3 replies, posted in Script)

Ok, i got it to work, this is how i did it for future reference for everyone tongue

procedure main_btemailfo_OnAfterClick (Sender: string);
var
    resultid: TDataSet;
    resultemail: TDataSet;

    sFile: string;
    sEmailid: string;
    sID: string;
    sEmail: string;


begin

    sID := main.tabela_main.sqlvalue;
    SQLQuery('SELECT id_clientes FROM assistencia WHERE id="'+sid+'"', Resultid);
    semailid := resultid.fieldbyname('id_clientes').AsString;
    SQLQuery('SELECT Email FROM clientes WHERE id="'+semailid+'"', Resultemail);
    semail := resultemail.fieldbyname('email').AsString;



   main.btemailfo.Enabled := False;
   main.btemailfo.Caption := 'Please wait...';


   sFile := main.frxPDFExport1.FileName;

   if FileExists(sFile) then
       if SendMail('smtp.yourisp.com', 'yourusername@yourisp.com', 'xxxxxx', 465 , 'your name <youremail>', sEmail , 'subject', 'main text', sFile) then
           ShowMessage('Message sent');

   main.btemailfo.Enabled := true;
   main.btemailfo.Caption := 'Email ';


end;
     begin
     main.frxPDFExport1.OpenAfterExport := False;

     end.

Many thanks

197

(3 replies, posted in Script)

Almost...

Clientes.Email is located at table clientes

But Tablegrid1 gets its values from table assistencias , where i have clientes_ID

When i use your string i get the correct value for the ID that is located at table clientes, but i mean to get the value for clientes_ID.

So maybe... something like:

Getting the ID at ID_Clientes value

i think that will get me the job done! smile

198

(3 replies, posted in Script)

Dear all,i am building an autofill for my sendmail, so when i select a value on a tablegrid i can click a button and it should send an automatic email

Right now my code is stuck at:

procedure main_btemailfo_OnAfterClick (Sender: string);
var
    sFile: string;
    sEmail: string;
    sID: string;





begin
    main.btemailfo.Enabled := False;
    main.btemailfo.Caption := 'Please wait...';
    semail := SQLexecute ('SELECT clientes.email FROM clientes where main.Tabela_Main.sqlValue');
    sid := main.Tabela_Main.sqlValue;
    sFile := main.frxPDFExport1.FileName;

    if FileExists(sFile) then
        if SendMail('smtp.portugalmail.pt', 'xxxxxxxxxxxx@portugalmail.pt', 'xxxxxxxxxx1', 465 , 'xxxxxxxxx@portugalmail.pt', 'sEmail' , 'subject', 'your text', sFile) then
            ShowMessage('Message sent');

    main.btemailfo.Enabled := true;
    main.btemailfo.Caption := 'Email ';


end;

sEmail is the value i am looking for, i created an sID because if i use sqlvalue on main.Tabela_main i get the right ID for the job.
What i am trying to acomplish is retreiving an SQLexecute statement that uses this ID to fetch clientes.email data from table clientes

Can anyone help me?

Thanks

199

(11 replies, posted in Script)

Hi, thanks, i have been reading a lot about pascal, i managed to create lots of stuff...
I can't however, send emails, i think gmail is closing my connections instantly, and i have already turned on the "less secure apps" option on my gmail.

i am using this script dimitry send:

procedure Form1_bReport_OnAfterClick (Sender: string);
var
    sFile: string;
begin
    Form1.bReport.Enabled := False;
    Form1.bReport.Caption := 'Please wait...';

    sFile := Form1.frxPDFExport1.FileName;

    if FileExists(sFile) then
        if SendMail('smtp.gmail.com, 'username@gmail.com', 'password', 465 , 'my name', 'destination email', 'Subject', 'Message', sFile) then
            ShowMessage('Message sent');

    Form1.bReport.Enabled := false;
    Form1.bReport.Caption := 'Send PDF to e-mail ';
end;

begin
    Form1.frxPDFExport1.OpenAfterExport := false;
end.

it gives me "connection ended gracefully (lol)

My intention is to have this code working, and then adding something like:

sEmail := Form1.edit1.text; on the "destination email" so it could send an email automatic to the email that is on this specific field

could you guys give me an hand? thanks


EDIT: it seems that it doesn't work with either Yahoo, Gmail or Outlook, but... i created an email @ portugalmail, it uses port 465 too but it doesn't use ssl that's the only difference, i was able to configure the script correctly...
Could this be that the command for sending the email (sendmail) doesn't have a field for ssl connections?

EDIT2: Need an extra help with something:

I am able to get a string from a textbox to send my email, here's the code i used:

procedure main_btemailfo_OnAfterClick (Sender: string);
var
    sFile: string;
    sEmail: string;



begin
    main.btemailfo.Enabled := False;
    main.btemailfo.Caption := 'Please wait...';

    sFile := main.frxPDFExport1.FileName;
    sEmail := frmassistencia.BxClienteEmail.sqlValue;
    if FileExists(sFile) then
        if SendMail('smtp.portugalmail.pt', 'xxxxxxxxxxxx@portugalmail.pt', 'xxxxxxxxxx', 465 , 'xxxxxxxxxxr@portugalmail.pt', 'xxxxxxxxxxxx@gmail.com' , 'subject', semail, sFile) then
            ShowMessage('Message sent');

    main.btemailfo.Enabled := true;
    main.btemailfo.Caption := 'Email ';
end;

Now... picture this:

I have two tables: one named table1, and another one named table2
I have linked the table1 table with the table2 table, and i have a table1_id value
I have the email value on the table1 , and i have a combo box on (lets imagine) form1
this combobox is the table2.table1_id , and i have choosen to pick them using their phone (names would be too long, emails some people don't have, etc... etc...)
in form1 i have a text box pointing to table1 "email" value , it doesn't get updated automatic when i choose the combo box related to the customer i want, but when i reopen form1 after i save it, it will show up there...

My question is: is there a way to automatic update the form1 ? i mean... i guess i have to save it contantly and retrive it (save & show) probably....

Otherwise:

Is there another way to pick the "email" data that's on the right customer associated to the right combobox value ?
I hope you understand my question smile
Many thanks

p.s. i know the "semail value" on my code is on the "message field" but i was trying to debug and see what's going on each time i switched it arround, so i would get an email showing that value i was getting each time i changed my selection,  i know i could use a simple "show message" text but i only remembered it later...

200

(11 replies, posted in Script)

Nevermind...
As you guys probably figured out, i'm new to programming, but i know what the problem was
I didn't specified the procedure to the button...
Just added frmAssistencia_BTGRAVAR_OnClick to the "onclick" field on the button and the script now works perfectly.

Many thanks dimitry and mathmathou