how can i save contents of messages window to a file with name of Username from login form

Discussions related to Visual Prolog
danepa
VIP Member
Posts: 57
Joined: 29 Sep 2011 5:54

Re:

Unread post by danepa » 19 Oct 2011 16:26

Paul Cerkez wrote:modify the code I posted like this:

Code: Select all

login(Nama) :-      % now that you modified the declaration, you don't need the bound() anymore.    Nama > "", % prevents a blank filename from being used and causing a windows' file system error.     !,  % add the cut right here.     file::save(string::concat(Nama,".txt"),memor_msg_txt).   login(_) :-        !,  % add the cut right here.    stdio::write(" login file save FAILED"), % or whathever you want returned if there is an error
this should take it back to procedure.
error c603: The flow pattern '(o,i)' does not exist for '>'
Daniel

Paul Cerkez
VIP Member
Posts: 202
Joined: 6 Mar 2000 0:01

Unread post by Paul Cerkez » 20 Oct 2011 16:52

there is something else going in with your code.

please post your current code here so we can examine it in more detail. a pattern error on the > doesn't make sense. it is an operator, not a predicate.

P.
AI Rules!
P.

danepa
VIP Member
Posts: 57
Joined: 29 Sep 2011 5:54

Re:

Unread post by danepa » 20 Oct 2011 17:25

Code: Select all

predicates     login : (string Nama) procedure(o)(i).   facts - memor_msg_txt     memor_msg_txt:(string).   login(Nama) :-      % now that you modified the declaration, you don't need the bound() anymore.    Nama > "", % prevents a blank filename from being used and causing a windows' file system error.     !,  % add the cut right here.     file::save(string::concat(Nama,".txt"),memor_msg_txt).   login(_) :-        !,  % add the cut right here.    stdio::write(" login file save FAILED"), % or whathever you want returned if there is an error  
error c603: The flow pattern '(o,i)' does not exist for '>'
Daniel

Paul Cerkez
VIP Member
Posts: 202
Joined: 6 Mar 2000 0:01

Unread post by Paul Cerkez » 20 Oct 2011 17:42

unless you are expecting the login procedure to return a login "Nama," value remove the (o).

also, change the Nama > "" to Nama <> "" as it is more accurate. (Nama > "" should work but Nama <> "" isa better choice)

P.
AI Rules!
P.

danepa
VIP Member
Posts: 57
Joined: 29 Sep 2011 5:54

Re:

Unread post by danepa » 21 Oct 2011 1:29

Paul Cerkez wrote:unless you are expecting the login procedure to return a login "Nama," value remove the (o).

also, change the Nama > "" to Nama <> "" as it is more accurate. (Nama > "" should work but Nama <> "" isa better choice)

P.

Code: Select all

predicates     login : (string Nama) procedure(o)(i).   facts - memor_msg_txt     memor_msg_txt:(string).   login(Nama) :-      % now that you modified the declaration, you don't need the bound() anymore.    Nama <> "", % prevents a blank filename from being used and causing a windows' file system error.     !,  % add the cut right here.     file::save(string::concat(Nama,".txt"),memor_msg_txt).   login(_) :-        !,  % add the cut right here.    stdio::write(" login file save FAILED"), % or whathever you want returned if there is an error  
error c603: The flow pattern '(o,i)' does not exist for '<>'
Daniel

Steve Lympany
VIP Member
Posts: 119
Joined: 31 Mar 2001 23:01

Unread post by Steve Lympany » 21 Oct 2011 6:47

Hi,
Repeating what Paul has said, use this code:

Code: Select all

predicates     login : (string Nama) procedure(i).  %NO (o). It is always called with a known Nama                     %REPEAT - you must remove the (o) clauses         login(Nama) :-                 ""=string::isWhiteSpace(Nama),!,                 vpiCommonDialogs::note("you must supply a non-blank name").           login(Nama) :-%for example...  Also check out string::isName                 string::hasDecimalDigits(Nama),!,                 vpiCommonDialogs::note("you must supply a name with no numbers").           login(Nama) :-                  file::save(string::concat(Nama,".txt"),memor_msg_txt).
And also look at class <b>filename::</b>
regards
Steve

Post Reply