Announcement

Collapse
No announcement yet.

File.Move - how can i fix that problem?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • File.Move - how can i fix that problem?

    I am trying to move some selected files from folder "Install" to folder "Checked".
    So when i selected some applications from listbox i use this code to create list:
    Code:
    local tChecked = ListBox.GetChecked("ListBox1", BST_CHECKED);
    if tChecked then
    for i = 1, #tChecked do
    local sFileName = ListBox.GetItemText("ListBox1", tChecked[i]);
    TextFile.WriteFromString("Install\\checked.txt", sFileName.."\r\n", true);
    end
    end
    After i tried to use this code to move selected apps to folder:

    Code:
    File.Move("Install\\..sFileName..", "\\Install\\Checked\\", true, true, false, false, nil);
    But it doesnt work for me...

    From Autoplay help i can't get enouth information about file.move action.

    By using cmd script i can do that.
    Code:
    set "input=%cd%\Install"
    set "output=%cd%\Install\Checked"
    set "list=%cd%\Install\checked.txt"
    for /f "usebackq tokens=* delims=" %%a in ("%list%") do (
    xcopy "%input%\%%a" "%output%\" && del /f /q "%input%\%%a"
    )
    exit

    I would like to perform these actions exclusively by means of AMS
    Can somebody help me please ?

  • #2
    Hi adam2014,
    You have set a file name + extn in your cmd script
    set "list=%cd%\Install\checked.txt"
    but you only have filename in file.move script try
    Code:
    sXtn =".txt"
    File.Move("Install\\..sFileName..sXtn", "\\Install\\Checked\\", true, true, false, false, nil);
    Also you need full path to your Install - Checked Directories
    Source = "Folder Full Path + Filename + Extension"
    Destination = "Folder Full Path"

    Click image for larger version

Name:	_filemove.png
Views:	132
Size:	5.6 KB
ID:	309799
    Cheers

    Comment


    • #3
      Try this example
      FileMove.apz

      Comment


      • #4
        Originally posted by colc View Post
        Try this example
        [ATTACH]n309801[/ATTACH]
        Tank's Colc
        I tried this and that and it still doesn't work for me... I will try your FileMove project later. Thank you!
        So i found solution like this:
        I Create Object Richtext1 with position left =1, Top=1, width=1, Height=1
        And in text field i put this code and save it.

        Code:
        set "input=%cd%\Install"
        set "output=%cd%\Install\Checked"
        set "list=%cd%\Install\checked.txt"
        for /f "usebackq tokens=* delims=" %%a in ("%list%") do (
        xcopy "%input%\%%a" "%output%\" && del /f /q "%input%\%%a"
        )
        exit
        In button select applications i add this:

        Code:
        local tChecked = ListBox.GetChecked("ListBox1", BST_CHECKED);
        if tChecked then
        for i = 1, #tChecked do
        local sFileName = ListBox.GetItemText("ListBox1", tChecked[i]);
        TextFile.WriteFromString("Install\\checked.txt", sFileName.."\r\n", true);
        end
        end​
        MySetups = RichText.GetText("Richtext1", false);
        TextFile.WriteFromString("Install\\Run.bat", MySetups, false);
        Application.Sleep(1000);
        Shell.Execute("Install\\Run.bat", "open", "", "", SW_HIDE, true);
        File.Delete("Docs\\Run.bat", false, false, false, nil);​
        And all my checked applications moved to "Checked" folder.

        When installation is completed i use another bat file to move these files back with the same way.

        move "%cd%\Install\Checked\*.exe" "%cd%\Install"
        exit /b

        Cheers​

        Comment

        Working...
        X
        😀
        🥰
        🤢
        😎
        😡
        👍
        👎