Показать полную графическую версию : Запуск файлов и их сохранение
Суть в следующем. Есть папка с кучей файлов excel. Мне необходимо чтобы скрипт, находясь в папке на уровень выше, запустил все файлы excel в указанной папке, и просто их сохранил и закрыл. И так по порядку все файлы. Имена файлов произвольны и количество тоже. Спасибо.
#include <file.au3>
$sTarFolder = 'Excel'; Название папки с Excel файлами
$sTarPath = @ScriptDir & '\' & $sTarFolder
$aExcelFiles = _FileListToArray($sTarPath, '*.xls', 1); Фильтр на файлы xls. Если формат *.xlsx то ставим соответствующий фильтр
For $i = 1 to $aExcelFiles[0]
$sFile = $sTarPath & '\' & $aExcelFiles[$i]
$oExcel = ObjCreate('Excel.Application'); Запускаем экземпляр Excel
$oExcel.WorkBooks.Open($sFile); Открываем файл Excel'ем
$oExcel.ActiveWorkBook.Save; Сохраняем файл
$oExcel.Application.Quit; Выходим из Excel
$oExcel = 0; Освобождаем переменную
Next
FlatX007
17-06-2010, 00:53
;~ AutoIt Version: 3.3.6.0
#include <Excel.au3>
OnAutoItExitRegister('_ExitScr')
Global $DIR_LOAD_FILE = @ScriptDir & '\Xls'
Global $DIR_SAVE_FILE = @ScriptDir & '\Save'
DirCreate($DIR_SAVE_FILE)
$iSearch = FileFindFirstFile($DIR_LOAD_FILE & '\*.xls')
If (@error) Then Exit
While 1
$iFile = FileFindNextFile($iSearch)
If @error Then ExitLoop
ConsoleWrite($DIR_LOAD_FILE & '\' & $iFile & @CRLF)
$oExcel = _ExcelBookOpen($DIR_LOAD_FILE & '\' & $iFile)
If Not (@error) Then _ExcelBookSaveAs($oExcel, $DIR_SAVE_FILE & '\' & $iFile, 'xls')
_ExcelBookClose($oExcel)
WEnd
Func _ExitScr()
FileClose($iSearch)
EndFunc ;==>_ExitScr
kaster, а как еще сделать чтобы скрипт нажимал кнопку "Обновить", которая возникает при запуске файла? Фото прилагаю
Попробуй так
#include <file.au3>
$sTarFolder = 'Excel'; Название папки с Excel файлами
$sTarPath = @ScriptDir & '\' & $sTarFolder
$aExcelFiles = _FileListToArray($sTarPath, '*.xls', 1); Фильтр на файлы xls. Если формат *.xlsx то ставим соответствующий фильтр
For $i = 1 to $aExcelFiles[0]
$sFile = $sTarPath & '\' & $aExcelFiles[$i]
$oExcel = ObjCreate('Excel.Application'); Запускаем экземпляр Excel
$oExcel.WorkBooks.Open($sFile); Открываем файл Excel'ем
$oExcel.ActiveWorkBook.UpdateLinks; Обновляем ссылки
$oExcel.ActiveWorkBook.Save; Сохраняем файл
$oExcel.Application.Quit; Выходим из Excel
$oExcel = 0; Освобождаем переменную
Next
Pozia, я бы попробовал так:…
$oExcel = ObjCreate('Excel.Application')
$oExcel.AskToUpdateLinks = False
…
AskToUpdateLinks Property
True if Microsoft Excel asks the user to update links when opening files with links.
False if links are automatically updated with no dialog box.
Read/write Boolean.
Iska, только сейчас появилась возможность проверить. Вроде помогло. Спсибо
Pozia, ясно. Спасибо, что отписались.
Iska, вплотную сейчас работаю с этим скриптом. Надоедает его все время модифицировать. Теперь он у меня такой:
#include <file.au3>
$sTarPath1 = @ScriptDir & '\Звездочка'
$sTarPath2 = @ScriptDir & '\Муфта втулочно пальцевая\Параметры'
$sTarPath3 = @ScriptDir & '\Муфта цепная\Параметры'
$sTarPath4 = @ScriptDir & '\Редуктор\Параметры'
$sTarPath5 = @ScriptDir & '\РМ_1'
$sTarPath6 = @ScriptDir & '\Шкив'
$sTarPath7 = @ScriptDir & '\Электродвигатель'
$aExcelFiles1 = _FileListToArray($sTarPath1, '*.xlsx', 1); Фильтр на файлы xls. Если формат *.xlsx то ставим соответствующий фильтр
For $i = 1 to $aExcelFiles1[0]
$sFile = $sTarPath1 & '\' & $aExcelFiles1[$i]
$oExcel = ObjCreate('Excel.Application'); Запускаем экземпляр Excel
$oExcel.AskToUpdateLinks = False
$oExcel.WorkBooks.Open($sFile); Открываем файл Excel'ем
$oExcel.ActiveWorkBook.UpdateLinks; Обновляем ссылки
$oExcel.ActiveWorkBook.Save; Сохраняем файл
$oExcel.Application.Quit; Выходим из Excel
$oExcel = 0; Освобождаем переменную
Next
$aExcelFiles2 = _FileListToArray($sTarPath2, '*.xlsx', 1); Фильтр на файлы xls. Если формат *.xlsx то ставим соответствующий фильтр
For $i = 1 to $aExcelFiles2[0]
$sFile = $sTarPath2 & '\' & $aExcelFiles2[$i]
$oExcel = ObjCreate('Excel.Application'); Запускаем экземпляр Excel
$oExcel.AskToUpdateLinks = False
$oExcel.WorkBooks.Open($sFile); Открываем файл Excel'ем
$oExcel.ActiveWorkBook.UpdateLinks; Обновляем ссылки
$oExcel.ActiveWorkBook.Save; Сохраняем файл
$oExcel.Application.Quit; Выходим из Excel
$oExcel = 0; Освобождаем переменную
Next
$aExcelFiles3 = _FileListToArray($sTarPath3, '*.xlsx', 1); Фильтр на файлы xls. Если формат *.xlsx то ставим соответствующий фильтр
For $i = 1 to $aExcelFiles3[0]
$sFile = $sTarPath3 & '\' & $aExcelFiles3[$i]
$oExcel = ObjCreate('Excel.Application'); Запускаем экземпляр Excel
$oExcel.AskToUpdateLinks = False
$oExcel.WorkBooks.Open($sFile); Открываем файл Excel'ем
$oExcel.ActiveWorkBook.UpdateLinks; Обновляем ссылки
$oExcel.ActiveWorkBook.Save; Сохраняем файл
$oExcel.Application.Quit; Выходим из Excel
$oExcel = 0; Освобождаем переменную
Next
$aExcelFiles4 = _FileListToArray($sTarPath4, '*.xlsx', 1); Фильтр на файлы xls. Если формат *.xlsx то ставим соответствующий фильтр
For $i = 1 to $aExcelFiles4[0]
$sFile = $sTarPath4 & '\' & $aExcelFiles4[$i]
$oExcel = ObjCreate('Excel.Application'); Запускаем экземпляр Excel
$oExcel.AskToUpdateLinks = False
$oExcel.WorkBooks.Open($sFile); Открываем файл Excel'ем
$oExcel.ActiveWorkBook.UpdateLinks; Обновляем ссылки
$oExcel.ActiveWorkBook.Save; Сохраняем файл
$oExcel.Application.Quit; Выходим из Excel
$oExcel = 0; Освобождаем переменную
Next
$aExcelFiles5 = _FileListToArray($sTarPath5, '*.xlsx', 1); Фильтр на файлы xls. Если формат *.xlsx то ставим соответствующий фильтр
For $i = 1 to $aExcelFiles5[0]
$sFile = $sTarPath5 & '\' & $aExcelFiles5[$i]
$oExcel = ObjCreate('Excel.Application'); Запускаем экземпляр Excel
$oExcel.AskToUpdateLinks = False
$oExcel.WorkBooks.Open($sFile); Открываем файл Excel'ем
$oExcel.ActiveWorkBook.UpdateLinks; Обновляем ссылки
$oExcel.ActiveWorkBook.Save; Сохраняем файл
$oExcel.Application.Quit; Выходим из Excel
$oExcel = 0; Освобождаем переменную
Next
$aExcelFiles6 = _FileListToArray($sTarPath6, '*.xlsx', 1); Фильтр на файлы xls. Если формат *.xlsx то ставим соответствующий фильтр
For $i = 1 to $aExcelFiles6[0]
$sFile = $sTarPath6 & '\' & $aExcelFiles6[$i]
$oExcel = ObjCreate('Excel.Application'); Запускаем экземпляр Excel
$oExcel.AskToUpdateLinks = False
$oExcel.WorkBooks.Open($sFile); Открываем файл Excel'ем
$oExcel.ActiveWorkBook.UpdateLinks; Обновляем ссылки
$oExcel.ActiveWorkBook.Save; Сохраняем файл
$oExcel.Application.Quit; Выходим из Excel
$oExcel = 0; Освобождаем переменную
Next
$aExcelFiles7 = _FileListToArray($sTarPath7, '*.xlsx', 1); Фильтр на файлы xls. Если формат *.xlsx то ставим соответствующий фильтр
For $i = 1 to $aExcelFiles7[0]
$sFile = $sTarPath7 & '\' & $aExcelFiles7[$i]
$oExcel = ObjCreate('Excel.Application'); Запускаем экземпляр Excel
$oExcel.AskToUpdateLinks = False
$oExcel.WorkBooks.Open($sFile); Открываем файл Excel'ем
$oExcel.ActiveWorkBook.UpdateLinks; Обновляем ссылки
$oExcel.ActiveWorkBook.Save; Сохраняем файл
$oExcel.Application.Quit; Выходим из Excel
$oExcel = 0; Освобождаем переменную
Next
Могли бы вы его подправить так, чтобы он искал эксели во всех папках что находятся на одном уровне с самим скриптом, и вложенных в этих папках папки? Сейчас выскакивает ошибка, если в какой либо папке, прописанной в скрипте, нет экселя.
madmasles
05-04-2011, 20:13
чтобы он искал эксели во всех папках что находятся на одном уровне с самим скриптом, и вложенных в этих папках папки »
#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <Array.au3>
$aExcel = _FileSearch(@ScriptDir (http://www.autoitscript.com/autoit3/docs/macros.htm#@scriptdir), '*.xlsx', 1)
_ArrayDisplay (http://dundats.mvps.org/help/html/libfunctions/_arraydisplay.htm)($aExcel)
Func (http://www.autoitscript.com/autoit3/docs/keywords.htm#Func) _FileSearch($sPath, $sFileMask = '*', $iFlag = 0, $iSubdir = 1)
;фильтры для поиска нужно указывать через ;
;$iFlag = 0 - Файлы и папки (по умолчанию)
;$iFlag = 1 - Только файлы
;$iFlag = 2 - Только папки
;$iSubdir = 1 - Искать во всех подкаталогах (по умолчанию). Возвращает полные пути.
;$iSubdir = 0 - Искать только в самой папке. Возвращает только имена файлов(папок).
Local (http://www.autoitscript.com/autoit3/docs/keywords.htm#Local) $sOutBin, $sOut, $aOut, $sRead, $hDir, $sAttrib, $sSubdir, $aMasks
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) StringRight (http://www.autoitscript.com/autoit3/docs/functions/StringRight.htm)($sPath, 1) == '\' Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
$sPath = StringTrimRight (http://www.autoitscript.com/autoit3/docs/functions/StringTrimRight.htm)($sPath, 1)
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $iSubdir Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
$sSubdir = ' /S /B'
Else (http://www.autoitscript.com/autoit3/docs/keywords.htm#Else)
$sSubdir = ' /B'
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
Switch (http://www.autoitscript.com/autoit3/docs/keywords.htm#Switch) $iFlag
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) 1
$sAttrib = ' /A-D'
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) 2
$sAttrib = ' /AD'
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) Else (http://www.autoitscript.com/autoit3/docs/keywords.htm#Else)
$sAttrib = ' /A'
EndSwitch (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndSwitch)
$sOut = StringToBinary (http://www.autoitscript.com/autoit3/docs/functions/StringToBinary.htm)('0' & @CRLF (http://www.autoitscript.com/autoit3/docs/macros.htm#@crlf), 2)
$aMasks = StringSplit (http://www.autoitscript.com/autoit3/docs/functions/StringSplit.htm)($sFileMask, ';')
For (http://www.autoitscript.com/autoit3/docs/keywords.htm#For) $i = 1 To (http://www.autoitscript.com/autoit3/docs/keywords.htm#To) $aMasks[0]
$hDir = Run (http://www.autoitscript.com/autoit3/docs/functions/Run.htm)(@ComSpec (http://www.autoitscript.com/autoit3/docs/macros.htm#@comspec) & ' /U /C DIR "' & $sPath & '\' & $aMasks[$i] & '"' & $sSubdir & $sAttrib, @SystemDir (http://www.autoitscript.com/autoit3/docs/macros.htm#@systemdir), @SW_HIDE (http://www.autoitscript.com/autoit3/docs/macros.htm#@sw_hide), 6)
While (http://www.autoitscript.com/autoit3/docs/keywords.htm#While) 1
$sRead = StdoutRead (http://www.autoitscript.com/autoit3/docs/functions/StdoutRead.htm)($hDir, False (http://www.autoitscript.com/autoit3/docs/keywords.htm#False), True (http://www.autoitscript.com/autoit3/docs/keywords.htm#True))
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) @error (http://www.autoitscript.com/autoit3/docs/macros.htm#@error) Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
ExitLoop (http://www.autoitscript.com/autoit3/docs/keywords.htm#ExitLoop)
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $sRead <> "" Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
$sOut &= $sRead
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
Sleep (http://www.autoitscript.com/autoit3/docs/functions/Sleep.htm)(2)
WEnd (http://www.autoitscript.com/autoit3/docs/keywords.htm#WEnd)
Next (http://www.autoitscript.com/autoit3/docs/keywords.htm#Next)
$aOut = StringRegExp (http://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm)(BinaryToString (http://www.autoitscript.com/autoit3/docs/functions/BinaryToString.htm)($sOut, 2), '[^\r\n]+', 3)
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) @error (http://www.autoitscript.com/autoit3/docs/macros.htm#@error) Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
Return (http://www.autoitscript.com/autoit3/docs/keywords.htm#Return) SetError (http://www.autoitscript.com/autoit3/docs/functions/SetError.htm)(1)
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
$aOut[0] = UBound (http://www.autoitscript.com/autoit3/docs/functions/UBound.htm)($aOut) - 1
Return (http://www.autoitscript.com/autoit3/docs/keywords.htm#Return) $aOut
EndFunc (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndFunc) ;==>_FileSearch
_FileSearch(). (http://autoit-script.ru/index.php?topic=315.msg18672#msg18672)
madmasles, что то я не допру как этим добром пользоваться. Запустил, нашлись мои эксели. Выбрал. Нажал внизу кнопку. И ничего...
madmasles
05-04-2011, 21:16
Запустил, нашлись мои эксели »Выбирать ничего не надо. _ArrayDisplay($aExcel) только чтобы показать, что нашли. Можно его убрать вместе с #include <Array.au3> . Дальше, наверное, так, как у Вас раньше было:
;...
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $aExcel[0] Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
For (http://www.autoitscript.com/autoit3/docs/keywords.htm#For) $i = 1 To (http://www.autoitscript.com/autoit3/docs/keywords.htm#To) $aExcel[0]
$sFile = $aExcel[$i]
$oExcel = ObjCreate (http://www.autoitscript.com/autoit3/docs/functions/ObjCreate.htm)('Excel.Application'); Запускаем экземпляр Excel
$oExcel.AskToUpdateLinks = False (http://www.autoitscript.com/autoit3/docs/keywords.htm#False)
$oExcel.WorkBooks.Open($sFile); Открываем файл Excel'ем
$oExcel.ActiveWorkBook.UpdateLinks; Обновляем ссылки
$oExcel.ActiveWorkBook.Save; Сохраняем файл
$oExcel.Application.Quit; Выходим из Excel
$oExcel = 0; Освобождаем переменную
Next (http://www.autoitscript.com/autoit3/docs/keywords.htm#Next)
Else (http://www.autoitscript.com/autoit3/docs/keywords.htm#Else)
MsgBox (http://www.autoitscript.com/autoit3/docs/functions/MsgBox.htm)(16, 'Error', 'Нет файлов')
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
Попробуйте так, по идее, быстрее должно работать.
$aExcel = _FileSearch(@ScriptDir (http://www.autoitscript.com/autoit3/docs/macros.htm#@scriptdir), '*.xlsx', 1)
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $aExcel[0] Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
$oExcel = ObjCreate (http://www.autoitscript.com/autoit3/docs/functions/ObjCreate.htm)('Excel.Application'); Запускаем экземпляр Excel
$oExcel.AskToUpdateLinks = False (http://www.autoitscript.com/autoit3/docs/keywords.htm#False)
For (http://www.autoitscript.com/autoit3/docs/keywords.htm#For) $i = 1 To (http://www.autoitscript.com/autoit3/docs/keywords.htm#To) $aExcel[0]
$oExcel.WorkBooks.Open($aExcel[$i]); Открываем файл Excel'ем
$oExcel.ActiveWorkBook.UpdateLinks; Обновляем ссылки
$oExcel.ActiveWorkBook.Save; Сохраняем файл
Next (http://www.autoitscript.com/autoit3/docs/keywords.htm#Next)
$oExcel.Application.Quit; Выходим из Excel
MsgBox (http://www.autoitscript.com/autoit3/docs/functions/MsgBox.htm)(64, 'Info', 'Обработано ' & $aExcel[0] & ' файлов Excel')
Else (http://www.autoitscript.com/autoit3/docs/keywords.htm#Else)
MsgBox (http://www.autoitscript.com/autoit3/docs/functions/MsgBox.htm)(16, 'Error', 'Нет файлов')
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
Func (http://www.autoitscript.com/autoit3/docs/keywords.htm#Func) _FileSearch($sPath, $sFileMask = '*', $iFlag = 0, $iSubdir = 1)
;фильтры для поиска нужно указывать через ;
;$iFlag = 0 - Файлы и папки (по умолчанию)
;$iFlag = 1 - Только файлы
;$iFlag = 2 - Только папки
;$iSubdir = 1 - Искать во всех подкаталогах (по умолчанию). Возвращает полные пути.
;$iSubdir = 0 - Искать только в самой папке. Возвращает только имена файлов(папок).
Local (http://www.autoitscript.com/autoit3/docs/keywords.htm#Local) $sOutBin, $sOut, $aOut, $sRead, $hDir, $sAttrib, $sSubdir, $aMasks
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) StringRight (http://www.autoitscript.com/autoit3/docs/functions/StringRight.htm)($sPath, 1) == '\' Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
$sPath = StringTrimRight (http://www.autoitscript.com/autoit3/docs/functions/StringTrimRight.htm)($sPath, 1)
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $iSubdir Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
$sSubdir = ' /S /B'
Else (http://www.autoitscript.com/autoit3/docs/keywords.htm#Else)
$sSubdir = ' /B'
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
Switch (http://www.autoitscript.com/autoit3/docs/keywords.htm#Switch) $iFlag
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) 1
$sAttrib = ' /A-D'
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) 2
$sAttrib = ' /AD'
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) Else (http://www.autoitscript.com/autoit3/docs/keywords.htm#Else)
$sAttrib = ' /A'
EndSwitch (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndSwitch)
$sOut = StringToBinary (http://www.autoitscript.com/autoit3/docs/functions/StringToBinary.htm)('0' & @CRLF (http://www.autoitscript.com/autoit3/docs/macros.htm#@crlf), 2)
$aMasks = StringSplit (http://www.autoitscript.com/autoit3/docs/functions/StringSplit.htm)($sFileMask, ';')
For (http://www.autoitscript.com/autoit3/docs/keywords.htm#For) $i = 1 To (http://www.autoitscript.com/autoit3/docs/keywords.htm#To) $aMasks[0]
$hDir = Run (http://www.autoitscript.com/autoit3/docs/functions/Run.htm)(@ComSpec (http://www.autoitscript.com/autoit3/docs/macros.htm#@comspec) & ' /U /C DIR "' & $sPath & '\' & $aMasks[$i] & '"' & $sSubdir & $sAttrib, @SystemDir (http://www.autoitscript.com/autoit3/docs/macros.htm#@systemdir), @SW_HIDE (http://www.autoitscript.com/autoit3/docs/macros.htm#@sw_hide), 6)
While (http://www.autoitscript.com/autoit3/docs/keywords.htm#While) 1
$sRead = StdoutRead (http://www.autoitscript.com/autoit3/docs/functions/StdoutRead.htm)($hDir, False (http://www.autoitscript.com/autoit3/docs/keywords.htm#False), True (http://www.autoitscript.com/autoit3/docs/keywords.htm#True))
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) @error (http://www.autoitscript.com/autoit3/docs/macros.htm#@error) Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
ExitLoop (http://www.autoitscript.com/autoit3/docs/keywords.htm#ExitLoop)
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $sRead <> "" Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
$sOut &= $sRead
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
Sleep (http://www.autoitscript.com/autoit3/docs/functions/Sleep.htm)(2)
WEnd (http://www.autoitscript.com/autoit3/docs/keywords.htm#WEnd)
Next (http://www.autoitscript.com/autoit3/docs/keywords.htm#Next)
$aOut = StringRegExp (http://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm)(BinaryToString (http://www.autoitscript.com/autoit3/docs/functions/BinaryToString.htm)($sOut, 2), '[^\r\n]+', 3)
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) @error (http://www.autoitscript.com/autoit3/docs/macros.htm#@error) Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
Return (http://www.autoitscript.com/autoit3/docs/keywords.htm#Return) SetError (http://www.autoitscript.com/autoit3/docs/functions/SetError.htm)(1)
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
$aOut[0] = UBound (http://www.autoitscript.com/autoit3/docs/functions/UBound.htm)($aOut) - 1
Return (http://www.autoitscript.com/autoit3/docs/keywords.htm#Return) $aOut
EndFunc (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndFunc) ;==>_FileSearch
madmasles, мне идея со списком ваша понравилась. А могли бы вы подправить так, чтобы я в списке выбирал какие файлы сохранить?
madmasles
05-04-2011, 21:51
чтобы я в списке выбирал какие файлы сохранить? »Завтра попробую сделать.
madmasles
06-04-2011, 19:27
Pozia,
То, что у меня получилось, в прикрепленном архиве. Вроде работает, проверял на Windows XP SP3 32 и Windows 7 SP1 32, Office 2003. Пытался написать здесь, но ругается, говорит, что слишком много символов. :)
PS
Поменяйте в скрипте на 14-ой строке $sExt = '*.xls' на $sExt = '*.xlsx', а то я на 2003 проверял.
Не надо, я добавил функцию на проверку версии, должно само определить.
Добавил вариант (3_Excel.7z) с возможностью изменения папки поиска файлов.
madmasles, при попытке скомпилировать выскакивает ошибка на winAPIE.au3. типа не может открыть. Это какая то добавка которой у меня нет?
madmasles
06-04-2011, 21:37
Pozia,
Забыл дать ссылку: Расширение стандартной AutoIt библиотеки WinAPI.au3 (http://autoit-script.ru/index.php?topic=47.0). :sorry:
madmasles, разобрался. Клева работает. Спасибо за помощь. Очень упростили мои мучения. По ходу юзания появилась еще хотелка. Если не сложно, сделайте вверху над всеми птичками еще одну общую птичку, которой можно было бы снять со всего или на все повесить. Если файлов много, а нужно выбрать несколько, то так будет удобнее. И если это возможно, сделайте возможность сортировки если нажимать вверху по Имя файла или Папка файла. Спасибо!!!
madmasles
06-04-2011, 22:06
Pozia,
Птичку сделал, сортировку добавил, только не по нажиманию по заголовку ListView, а перед заполнением таблицы.
© OSzone.net 2001-2012
vBulletin v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.
Available in ZeroNet 1osznRoVratMCN3bFoFpR2pSV5c9z6sTC