forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Help with SAVE and MSGBOX
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
filip
Valued Contributor
Valued Contributor


Joined: 07 Aug 2004
Posts: 340

PostPosted: Sat Dec 17, 2005 10:50 pm    Post subject: Help with SAVE and MSGBOX Reply with quote

:SaveBUTTON
%%UN = @regread(HCU,Software\Microsoft\Windows\CurrentVersion\Explorer,Logon User Name)
%%CPUN = @regread(LOCAL,Hardware\Description\System\CentralProcessor\0,VendorIdentifier)

%f = @filedlg("Text File (*.txt)|*.txt",Save as,%%UN-%%CPUN,Save)
if @null(%f)
goto loop
else
goto save
end

:SAVE
if @Equal(@FILE(%f))
%R = @MSGBOX(@PATH(%f)@NAME(%f)"."txt already exists.@CR()Do you want to replace it?,Sava As,$034)
elsif
if @equal(%R,1)
goto loop
if @equal(%R,2)
LIST SAVEFILE,list3,%f.txt
end

I like to save and check if file alredy exist...
This is my best shot...
Back to top
View user's profile Send private message Send e-mail
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Sun Dec 18, 2005 12:23 am    Post subject: Reply with quote

i think this will help, off the top of my head

Code:
:SaveBUTTON
  %%UN = @regread(HCU,Software\Microsoft\Windows\CurrentVersion\Explorer,Logon User Name)
  %%CPUN = @regread(LOCAL,Hardware\Description\System\CentralProcessor\0,VendorIdentifier)

  %f = @filedlg("Text File (*.txt)|*.txt",Save as,%%UN-%%CPUN,Save)
  if %f
    goto save
  end
  goto loop


:SAVE
  if @FILE(%f)
    %R = @MSGBOX(@PATH(%f)@NAME(%f)"."txt already exists.@CR()Do you want to replace it?,Sava As,$034)
    if @equal(%R,2)
      LIST SAVEFILE,list3,%f.txt
    end
  end
  goto loop

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
filip
Valued Contributor
Valued Contributor


Joined: 07 Aug 2004
Posts: 340

PostPosted: Sun Dec 18, 2005 12:53 am    Post subject: Reply with quote

Nope list save too far back

Don't do any thing don't save don't get to check...

My original code was (This save and overwrite file) hard to add check for file if it's already there...

Code:
:SaveBUTTON
   %%UN = @regread(HCU,Software\Microsoft\Windows\CurrentVersion\Explorer,Logon User Name)
   %%CPUN = @regread(LOCAL,Hardware\Description\System\CentralProcessor\0,VendorIdentifier)
   
   %f = @filedlg("Text File (*.txt)|*.txt",Save as,%%UN-%%CPUN,Save)
   if @null(%f)
   goto loop
   else
   LIST SAVEFILE,list3,%f.txt
   goto loop
   end
Back to top
View user's profile Send private message Send e-mail
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Sun Dec 18, 2005 1:51 am    Post subject: Reply with quote

the problem might be in the line

Code:
 LIST SAVEFILE,list3,%f.txt


you may end up with file names such as test.txt.txt

you will need to test %f to see if it includes the .txt extension

- if it does, then use LIST SAVEFILE,list3,%f

- if it doesn't, then use LIST SAVEFILE,list3,%f.txt

serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
filip
Valued Contributor
Valued Contributor


Joined: 07 Aug 2004
Posts: 340

PostPosted: Sun Dec 18, 2005 11:43 am    Post subject: Reply with quote

Now finally it works all by my self masterpiece...coding

Code:
:SaveBUTTON
  %%UN = @regread(HCU,Software\Microsoft\Windows\CurrentVersion\Explorer,Logon User Name)
  %%CPUN = @regread(LOCAL,Hardware\Description\System\CentralProcessor\0,VendorIdentifier)

  %f = @filedlg("Text File (*.txt)|*.txt",Save as,%%UN-%%CPUN,Save)
  if @null(%f)
  goto loop
  else
 
  %F = @path(%F)@name(%F).TXT
  if @file(%f)
  %R = @MSGBOX(@PATH(%f)@NAME(%f)"."txt already exists.@CR()Do you want to replace it?,Sava As,$034)
   elsif @equal(%R,1)
   LIST SAVEFILE,list3,%f
   wait
  else
  LIST SAVEFILE,list3,%f
  wait
  end
  end
  goto loop
Back to top
View user's profile Send private message Send e-mail
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Mon Dec 19, 2005 1:24 am    Post subject: Reply with quote

well done Very Happy

serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
filip
Valued Contributor
Valued Contributor


Joined: 07 Aug 2004
Posts: 340

PostPosted: Mon Dec 19, 2005 8:49 am    Post subject: Reply with quote

Almost Serge

Im getting some funny results with Step by Step running script

The txt is saved OK

If TXT allready there @MSGBOX OK but don't overwrite the file...?
Back to top
View user's profile Send private message Send e-mail
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Mon Dec 19, 2005 9:03 am    Post subject: Reply with quote

just had a look at your code and the way you have it, it will not work because of the way you have used your IF's

Code:
 %F = @path(%F)@name(%F).TXT
    if @file(%f)
      %R = @MSGBOX(@PATH(%f)@NAME(%f)"."txt already exists.@CR()Do you want to replace it?,Sava As,$034)
    elsif @equal(%R,1)
      LIST SAVEFILE,list3,%f
      wait
    else
      LIST SAVEFILE,list3,%f
      wait
    end


you should have

Code:
 
%F = @path(%F)@name(%F).TXT
    if @file(%f)
      %R = @MSGBOX(@PATH(%f)@NAME(%f)"."txt already exists.@CR()Do you want to replace it?,Sava As,$034)
    if @equal(%R,1)
      LIST SAVEFILE,list3,%f
      wait 1
else
goto loop
end
end

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
filip
Valued Contributor
Valued Contributor


Joined: 07 Aug 2004
Posts: 340

PostPosted: Sun Dec 25, 2005 1:50 pm    Post subject: Reply with quote

This still don't work how is that possible
This code is very logical...?

When the same file is found goto SAVE2

when 2 (No) stop end

when 1 (Yes) write goto loop

Code:
:Save2
if @equal(@MSGBOX(@PATH(%f)@NAME(%f)"."txt already exists.@CR()Do you want to replace it?,Sava As,$034),2)
    stop
    end
    elsif @equal(@MSGBOX(@PATH(%f)@NAME(%f)"."txt already exists.@CR()Do you want to replace it?,Sava As,$034),1)
    LIST SAVEFILE,list3,%f
    wait
    list close,list3
    goto loop
Back to top
View user's profile Send private message Send e-mail
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Mon Dec 26, 2005 1:05 am    Post subject: Reply with quote

the problem with your code is the use of the END, it should be:



Code:
:Save2
  if @equal(@MSGBOX(@PATH(%f)@NAME(%f)"."txt already exists.@CR()Do you want to replace it?,Sava As,$034),2)
    goto loop
elsif @equal(@MSGBOX(@PATH(%f)@NAME(%f)"."txt already exists.@CR()Do you want to replace it?,Sava As,$034),1)
  LIST SAVEFILE,list3,%f
  wait
  list close,list3
end
  goto loop

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
filip
Valued Contributor
Valued Contributor


Joined: 07 Aug 2004
Posts: 340

PostPosted: Mon Dec 26, 2005 7:03 am    Post subject: Reply with quote

When the same file is found i get twice @MSGBOX and don't save...when using yes or no button...?

Code:
:SaveBUTTON
   %f = @filedlg("Text File (*.txt)|*.txt",Save as,,Save)
    if @null(%f)
    goto loop
    else
    goto Save1
    end
 
  :Save1
     %F = @path(%F)@name(%F).txt
     if @file(%f)
     goto save2
     else
     LIST SAVEFILE,list3,%f
     wait
     list close,list3
     end
     goto loop
   
 :Save2
    if @equal(@MSGBOX(@PATH(%f)@NAME(%f)"."txt already exists.@CR()Do you want to replace it?,Sava As,$034),2)
    goto loop
    elsif @equal(@MSGBOX(@PATH(%f)@NAME(%f)"."txt already exists.@CR()Do you want to replace it?,Sava As,$034),1)
    LIST SAVEFILE,list3,%f
    wait
    list close,list3
    end
    goto loop
Back to top
View user's profile Send private message Send e-mail
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Mon Dec 26, 2005 7:44 am    Post subject: Reply with quote

i am confused as to what you are doing ... the code i gave/edited did the whole thing for you

Code:

:saveBUTTON
 %F = @path(%F)@name(%F).TXT
  if @file(%f)
    %R = @MSGBOX(@PATH(%f)@NAME(%f)"."txt already exists.@CR()Do you want to replace it?,Sava As,$034)
    if @equal(%R,1)
      LIST SAVEFILE,list3,%f
      wait 1
    else
      goto loop
    end
  end
goto loop


serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
filip
Valued Contributor
Valued Contributor


Joined: 07 Aug 2004
Posts: 340

PostPosted: Mon Dec 26, 2005 10:37 am    Post subject: Reply with quote

I'm sorry

It must be some code incompatibility

A child window is opened with list and data is collected and showed in this list...but still this do not work for rewriting the file

Thanks anyway...

MODEL:
LIST
SAVE LIST
OVERWRITE LIST

Code:
:SaveBUTTON
   %f = @filedlg("Text File (*.txt)|*.txt",Save as,,Save)
    if @null(%f)
    goto loop
    else
    goto Save1
    end
 
  :Save1
     %F = @path(%F)@name(%F).txt
     if @file(%f)
     goto save2
     else
     LIST SAVEFILE,list3,%f
     wait
     list close,list3
     end
     goto loop
   
 :Save2
  %F = @path(%F)@name(%F).TXT
  if @file(%f)
    %R = @MSGBOX(@PATH(%f)@NAME(%f)"."txt already exists.@CR()Do you want to replace it?,Sava As,$034)
    if @equal(%R,1)
      LIST SAVEFILE,list3,%f
      wait 1
    else
      goto loop
    end
  end
  goto loop
Back to top
View user's profile Send private message Send e-mail
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Tue Dec 27, 2005 4:20 pm    Post subject: Reply with quote

%R = @MSGBOX(@PATH(%f)@NAME(%f)"."txt already exists.@CR()Do you want to replace it?,Sava As,$034)
That will return 6 or 7... not 1:
Code:

1   OK
2   Cancel
3   Abort
4   Retry
5   Ignore
6   Yes
7   No

_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
filip
Valued Contributor
Valued Contributor


Joined: 07 Aug 2004
Posts: 340

PostPosted: Tue Dec 27, 2005 5:19 pm    Post subject: Reply with quote

Thanks SnarlingSheep you are a real life saver Laughing Embarassed Laughing

I still do not understand MSGBOX designer

Where did you get this:
1 OK
2 Cancel
3 Abort
4 Retry
5 Ignore
6 Yes
7 No

This will go to my VDS 5 Sampler too...
http://forum.vdsworld.com/viewtopic.php?t=3597&highlight=sampler

Code:
:SaveBUTTON
   %f = @filedlg("Text File (*.txt)|*.txt",Save as,,Save)
    if @null(%f)
    goto loop
    else
    goto Save1
    end
 
  :Save1
     %F = @path(%F)@name(%F).txt
     if @file(%f)
     goto save2
     else
     LIST SAVEFILE,list3,%f
     wait
     list close,list3
     end
     goto loop
   
 :Save2
  %F = @path(%F)@name(%F).TXT
  if @file(%f)
    %R = @MSGBOX(@PATH(%f)@NAME(%f)"."txt already exists.@CR()Do you want to replace it?,Sava As,$031)
    if @equal(%R,1)
      LIST SAVEFILE,list3,%f
      wait 1
    else
      goto loop
    end
  end
  goto loop
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group