Sign in to follow this  
Followers 0
Necromorph

FileCopy$var

9 posts in this topic

i can't quite get this to work

$var=FILECOPY("\\testdir\folder\file-*.exe", "*.exe")
RUN($var)

what am i doing wrong here?

thanks

Share this post


Link to post
Share on other sites



redLabel,

i can't quite get this to work

Hardly surprising. What does the Help file say is returned from FileCopy? Have you checked the contents of of $var?

Do try and help yourself a little bit before posting easily resolved questions like that. :mellow:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

http://www.autoitscript.com/autoit3/docs/functions/FileCopy.htm

http://www.autoitscript.com/autoit3/docs/functions/Run.htm

Perhaps if you read those you'll see what you did wrong :mellow:

EDIT: M23 beat me to it. But yes, READ THE DAMN HELP FILE.

Edited by Minikori

For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com

Share this post


Link to post
Share on other sites

ive only been coding for about two weeks so i do apologize for my "stupid" questions and i only asked becuase i don't understand all the lang in the help file. so sorry agian.

i think i got it to work like this

FILECOPY("\\testdir\folder\*.exe", "*.exe")
$installer=FILEFINDFIRSTFILE("*.exe")
$package=FILEFINDNEXTFILE($installer)
FILECLOSE($installer)
RUN($package)

yeah, sorry again

i guess the quote "the only dumb question is the one that doesn't get asked" isn't valid. o well.

Share this post


Link to post
Share on other sites

Just remember to look more into the help file next time. So the only dumb question is the one that's answered in the help file.


For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com

Share this post


Link to post
Share on other sites

redLabel,

A question should be reserved for when you do not understand what the Help file says, or when your code does not appear to react as the Help file suggests it will.

Asking questions for something which is explained in detail in the Help file is almost certain to get the response above.

ive only been coding for about two weeks

So have you read and understood the tutorials here and here? If not, I would strongly suggest that you do before too long. :mellow:

Now, turning back to your code:

FILECOPY("\\testdir\folder\*.exe", "*.exe")
$installer=FILEFINDFIRSTFILE("*.exe")
$package=FILEFINDNEXTFILE($installer)
FILECLOSE($installer)
RUN($package)

What exactly are you trying to do here - because that is as close to gobbledygook as it is possible to get. It looks as if you are trying to copy one or more .exe files from testdir\folder to "somewhere".

First off, you need to provide a path fo the destination (just like it says in the Help file! :( ) or AutoIt will stick the files into whatever happens to be the default folder at that moment. Remember that AutoIt cannot read your mind, you need to tell it what to do!

Secondly, when you have provided a path, you will know where to find your .exe file and will not have to search for it. Anyway, the FileFindFirst/NextFile commands are not for finding files in general, but for extracting lists of matching files from paths. If you know where you copied the file, you already know where to look, no?

So you will need something like this:

FileCopy(("\\testdir\folder\*.exe", "C:\My Folder\*.exe")
Run("C:\My Folder\*.exe")

Pretty simple, eh?

Please give the tutorials a try. I know you want to start coding NOW, but a little study will save you a lot of trouble later on, believe me. :lol:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

okay, i am copying a current installer from the server ie: testpackage0-25.exe. and i am copiling my script and running from the desktop of test machines. so i want it to copy the installer right to the desktop where the .exe is running from. but when i call the file copy, i use a wild card, ie: FILECOPY("\\serverX\DIR\FOLDER\Installer-*.exe", "*.exe") so it will copy what ever installer is currrently in the path. but i want to call that a $var. then later run the $var, becuase wiht some other code, the file copy is coping one of two files, and depending on other $vars i don't know which it will be copying in every situation. so i need it to RUN($var). so the path would be @DESKTOPDIR RUN($var). so thanks agian. i do understand what you are saying and i tryed it that way, but it wouldn't run, and i think it is because of the wildcard i had it writen like this

FILECOPY("\\serverX\DIR\FOLDER\Installer-*.exe", "*.exe")

RUN("*.exe")

and it would run.

also can you look into my other post as to making a progress bar for the file copy. and maybe some "best practices" for doing so. http://www.autoitscript.com/forum/index.php?showtopic=110594

thank you again.

Edited by redLabel

Share this post


Link to post
Share on other sites

redLabel,

You cannot ask Run to use wildcards - it just does not work like that! :(

What I suggest you do is something like this:

; List the exes in the server folder into an array
Global $aList = _FileListToArray("\\testdir\folder\", "*.exe", 1)
; Check there is at least one exe file there
If @error = 4 Then
    MsgBox(0, "Error", "No files found")
    Exit
EndIf

; Check if there are more than one there
If $aArray > 1 Then
    ; You need to choose which exe to copy and run
    ; so you will need some code here to do that
EndIf

; Now copy the required exe to the desktop (assuming you are running the script from the desktop as you say)
FileCopy(("\\testdir\folder\" & $aArray[1], @ScriptDir & "\" & $aArray[1])

; And now run it
Run(@ScriptDir & "\" & $aArray[1])

Is that clear enough? :mellow:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

yes, thank you much.

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