Sign in to follow this  
Followers 0
Robin

Something wrong with this script?

8 posts in this topic

#1 ·  Posted (edited)

I can't seem to copy "selected" files...I can highlight it, but it just doesnt want to copy. Individual files copy like a breeze...Could anyone here help plse?

here is my script ====

Local $message, $Select5, $var1

$Select5 = FileOpenDialog($message, "", "(*.*)", 1 + 4)

$var1 = FileCopy($Select5, "c:\new\", 9)

If $var1 = 0 Then

MsgBox(0, "", "Failed")

EndIf

thx a bunch :D Edited by Robin

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I can't seem to copy "selected" files...I can highlight it, but it just doesnt want to copy. Could anyone here help plse?

here is my script ====

Look at the results you are getting from the FileOpenDialog

Local $message, $Select5, $var1

$Select5 = FileOpenDialog($message, "", "(*.*)", 1 + 4)
MsgBox(0,"Select5",$Select5)

I bet it is not what you are expecting

Edited by SpookMeister

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

Look at the results you are getting from the FileOpenDialog

Local $message, $Select5, $var1

$Select5 = FileOpenDialog($message, "", "(*.*)", 1 + 4)
MsgBox(0,"Select5",$Select5)

I bet it is not what you are expecting

It shows the correct files...I think it has something to do with the "pipes" in between uh?

Share this post


Link to post
Share on other sites

Yeah "C:\test|file1.txt|file2.txt" is not a valid path. You will need to detect if there are pipes in the string, then split the string accordingly and make a file copy for each file found.

Look at StringInStr and StringSplit in the help file


[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

Yeah "C:\test|file1.txt|file2.txt" is not a valid path. You will need to detect if there are pipes in the string, then split the string accordingly and make a file copy for each file found.

Look at StringInStr and StringSplit in the help file

Thx SpookMeister...will have a look at it.

Share this post


Link to post
Share on other sites

Thx SpookMeister...will have a look at it.

last question...Is it possible to get all the "pipes" out when a user is going to select "random" files to copy?...sorry, but i'm really not familiar with StringSplit...If i may ask...If you had these 3 files --->

settings1.txt(pipe)settings2.txt(pipe)settings3.txt...how would you go about it?

Share this post


Link to post
Share on other sites

Local $message = "Select Files", $Select5, $var1

$Select5 = FileOpenDialog($message, "", "(*.*)", 1 + 4)

If StringInStr($Select5, "|") Then
    $a_files = StringSplit($Select5, "|")
    For $x = 2 To $a_files[0]
        $path = $a_files[1] & "\" & $a_files[$x]
        MsgBox(0, "Multiple Files Selected #" & $x - 1, $path)
    Next
Else
    MsgBox(0, "One File", $Select5)
EndIf


[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Local $message = "Select Files", $Select5, $var1

$Select5 = FileOpenDialog($message, "", "(*.*)", 1 + 4)

If StringInStr($Select5, "|") Then
    $a_files = StringSplit($Select5, "|")
    For $x = 2 To $a_files[0]
        $path = $a_files[1] & "\" & $a_files[$x]
        MsgBox(0, "Multiple Files Selected #" & $x - 1, $path)
    Next
Else
    MsgBox(0, "One File", $Select5)
EndIf
HOLY MACARONI.......lol

This is DEF a code/workaround for the toolbox...Honestly i doubt if i would ever have gotten there.

Thanks SpookMeister...let me dig in :D

Edited by Robin

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