Sign in to follow this  
Followers 0
t.koridass

MsgBox and the buttons

8 posts in this topic

#1 ·  Posted (edited)

Im new to programm with Autoit and now I have a little problem. I like to move files but befor i must check if a file in the folder exist and then i get a msgbox where someone get se massage "Sorry there is any file in the folder u like to overwrit ist" und u can choose YES / NO but how can i check what someone have chosen?

If FileExists ( "C:\test\test2\*.txt") Then
                MsgBox (4, "Datei", "Datei schon vorhanden, soll Sie überschrieben werden?") 
                    FileMove ( "C:\test\1.txt", "C:\test\test 2", 1)
                        EndIf
Edited by t.koridass

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

If FileExists ( "C:\test\test2\*.txt") Then
$returnmsg = MsgBox (4, "Datei", "Datei schon vorhanden, soll Sie überschrieben werden?") 
if $msg = 1 then
FileMove ( "C:\test\1.txt", "C:\test\test 2", 1)
Endif
EndIf

i think its 1 else it would be 0

EDIT: yep its 1

Edited by zeroZshadow

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...

Share this post


Link to post
Share on other sites

Hi..

i think you must store the return value of the msgbox.

and decide upon this value what to do.. like:

If FileExists ( "C:\test\test2\*.txt") Then
   $answer=MsgBox (4, "Datei", "Datei schon vorhanden, soll Sie überschrieben werden?") 
    if $answer=1 Then
       FileMove ( "C:\test\1.txt", "C:\test\test 2", 1)
    Endif
EndIf

Share this post


Link to post
Share on other sites

and how u call that

$answer
i dont find it in the help :lmao: but i think that is what i search thx

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

@zeroZshadow: :lmao: Are you related to Dalarn? All you seem to do is like to flame. There are differences in time and when the message gets posted. You two may have been writing a reply at the same time. Yours was posted at 08:53, Domonkey posted 08:54. Frankly, your reply was only more confusing and not at all helpful when taken from a newbie's point of view as you included edited code without explaining it. Do yourself a favor, and drop the 12 year old mentality on these fourms. Thanks.

and how u call that

$answer
i dont find it in the help  o:)  but i think that is what i search thx

<{POST_SNAPBACK}>

@t.koridass

All you're telling autoit to do is store the results of the msgbox in a variable.

Anything that begins with a $ is a variable. Calling the msgbox function without a container to store the answers will not accomplish much, if anything at all.

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

Calling the msgbox function without a container to store the answers will not accomplish much, if anything at all.

Another option, but without the container (variable).

if MsgBox(4, '', 'Hello World') = 6 Then
    MsgBox(0, '', 'You pressed Yes')
EndIf

Yes = 6

No = 7

:lmao:

Share this post


Link to post
Share on other sites

oke oke i'll try to calm down. i'm allot nicer in dutch, because i just don't know how to write nice in english :lmao:

so SORRY, i deleted the post and already apoligize in the other topics.


*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Another option, but without the container (variable).

if MsgBox(4, '', 'Hello World') = 6 Then
    MsgBox(0, '', 'You pressed Yes')
EndIf

Yes = 6

No = 7

Well, yes, there is that, but storing in a variable makes using Select/Case or If/ElseIf/EndIf much easier for the 3 button boxes. :lmao:

oke oke i'll try to calm down.  i'm allot nicer in dutch, because i just don't know how to write nice in english o:)

so SORRY, i deleted the post and already apoligize in the other topics.

<{POST_SNAPBACK}>

Apology accepted....I did not realize that English was not your primary language, but some of the return replies seemed rather snappish. I guess it's just difficult to understand emotion very well over a text medium. Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0