Jump to content
Sign in to follow this  
advance

Bit of trouble?

Recommended Posts

I know this might look weird, but this is what I have:

#include <GuiConstants.au3>

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("Sync v2.0", 410, 138,(@DesktopWidth-410)/2, (@DesktopHeight-138)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

GuiCtrlCreateGroup("Source", 10, 0, 290, 50)
GuiCtrlCreateGroup("Destination", 10, 70, 290, 50)
GuiCtrlCreateButton("Go", 310, 6, 90, 114)
$source = c:\source
$dest = c:\dest

DirCopy($source & $source\*.*,$dest & "$dest\*.*)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;
    EndSelect
WEnd
Exit

I Want the GUI (the GUI is fine) to pop up, have the user imput the directories, click go, and then they will "sync" and then exit. I will probaly add a msg box popup, or if I knew how, I would rrecreate the copy dialog with the process bar.

Share this post


Link to post
Share on other sites

You basicly forgot the " around source/dest values:

#include <GuiConstants.au3>

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("Sync v2.0", 410, 138,(@DesktopWidth-410)/2, (@DesktopHeight-138)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

GuiCtrlCreateGroup("Source", 10, 0, 290, 50)
GuiCtrlCreateGroup("Destination", 10, 70, 290, 50)
$go = GuiCtrlCreateButton("Go", 310, 6, 90, 114)
$source = "c:\source"
$dest = "c:\dest"


GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $go
        do_copy()
    EndSelect
WEnd
Exit

Func do_copy()
    DirCopy($source,$dest,1)
EndFunc

For the copy progress bar, you will have to sum up the sourc file count/or size, this is 100% for the progressbar. Then copy file per file, and increase the progressbar value after each successful copy.

ciao

Xandl

Share this post


Link to post
Share on other sites

I tried to add imput, and this is what I got:

#include <GuiConstants.au3>

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("Sync v1.5", 392, 138,(@DesktopWidth-392)/2, (@DesktopHeight-138)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Group_S = GuiCtrlCreateGroup("Source", 10, 0, 290, 50)
$Group_D = GuiCtrlCreateGroup("Destination", 10, 70, 290, 50)
$go = GuiCtrlCreateButton("Go", 310, 6, 70, 114)
$Input_D = GuiCtrlCreateInput("", 20, 20, 270, 20)
$Input_S = GuiCtrlCreateInput("", 20, 90, 270, 20)

    $source = GUICtrlRead ($Input_S)
    $dest = GUICtrlRead ($Input_D)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $go
        read_sd()
        do_copy()
    EndSelect
WEnd
Exit


Func read_sd()
    $source = GUICtrlRead ($Input_S)
    $dest = GUICtrlRead ($Input_D)
EndFunc


Func do_copy()
    DirCopy($source,$dest)
EndFunc

I tried adding a function, and it is still nto working. Help?

Share this post


Link to post
Share on other sites

I tried to add imput, and this is what I got:

-snip-

I tried adding a function, and it is still nto working.  Help?

<{POST_SNAPBACK}>

DirCopy works right ?

What isn't working ?


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I tried to add imput, and this is what I got:

#include <GuiConstants.au3>

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("Sync v1.5", 392, 138,(@DesktopWidth-392)/2, (@DesktopHeight-138)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Group_S = GuiCtrlCreateGroup("Source", 10, 0, 290, 50)
$Group_D = GuiCtrlCreateGroup("Destination", 10, 70, 290, 50)
$go = GuiCtrlCreateButton("Go", 310, 6, 70, 114)
$Input_D = GuiCtrlCreateInput("", 20, 20, 270, 20)
$Input_S = GuiCtrlCreateInput("", 20, 90, 270, 20)

    $source = GUICtrlRead ($Input_S)
    $dest = GUICtrlRead ($Input_D)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $go
        read_sd()
        do_copy()
    EndSelect
WEnd
Exit
Func read_sd()
    $source = GUICtrlRead ($Input_S)
    $dest = GUICtrlRead ($Input_D)
EndFunc
Func do_copy()
    DirCopy($source,$dest,1);if you add ,1 it works - I think the documentation 
                                        ;in the help is wrong.
EndFunc

I tried adding a function, and it is still nto working.  Help?

<{POST_SNAPBACK}>

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

I think maybe the documentation for DirCopy is wrong because if you try

DirCopy($source,$dest,1) it will work.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

If you try DirCopy($source,$dest,1) it will work.

From help file

DirCopy ( "source dir", "dest dir" [, flag])

Thats is the example in the helpfile, so how could it be wrong ? Edited by Nova

Share this post


Link to post
Share on other sites

even after that it dosnt work..

<{POST_SNAPBACK}>

It worked for me so there must be something else wrong. See if DirCopy sets error to 1 (It must do I guess) in which case the directory you're inputting as the source might be wrong. Maybe you could try checking that the source really exists or use a drag and drop into the source input box so that you really get the path correct.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...