Necromorph Posted February 23, 2010 Share Posted February 23, 2010 i can't quite get this to work $var=FILECOPY("\\testdir\folder\file-*.exe", "*.exe") RUN($var) what am i doing wrong here? thanks Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 23, 2010 Moderators Share Posted February 23, 2010 redLabel,i can't quite get this to workHardly 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. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Minikori Posted February 23, 2010 Share Posted February 23, 2010 (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 EDIT: M23 beat me to it. But yes, READ THE DAMN HELP FILE. Edited February 23, 2010 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 Link to comment Share on other sites More sharing options...
Necromorph Posted February 23, 2010 Author Share Posted February 23, 2010 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. Link to comment Share on other sites More sharing options...
Minikori Posted February 23, 2010 Share Posted February 23, 2010 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 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 24, 2010 Moderators Share Posted February 24, 2010 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 weeksSo have you read and understood the tutorials here and here? If not, I would strongly suggest that you do before too long. 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. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Necromorph Posted February 24, 2010 Author Share Posted February 24, 2010 (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 February 24, 2010 by redLabel Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 24, 2010 Moderators Share Posted February 24, 2010 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? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Necromorph Posted February 24, 2010 Author Share Posted February 24, 2010 yes, thank you much. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now