i have a script that selects a text file and deletes a line (text input required) in the text file selected
i have to make it remove all lines found on a file i name, toRemoveLines.txt
it has to remove lines from all text files found in a folder
this is the script that has to be modified
where it says "select file" it has to be "select folder"
where it says "line text input" it has to be all lines from a text file
#Include <File.au3> Global $success = False $file_name = FileOpenDialog("Select file", @ScriptDir, "All files (*.*)", 1+4) $line_text_input = InputBox("Line's text", "Line must contain following text:", "line contains this text") $file_count_lines = _FileCountLines($file_name) for $i = 0 to $file_count_lines $Lines_text_output = FileReadLine($file_name, $i) if StringInStr($Lines_text_output, $line_text_input) then _FileWriteToLine($file_name, $i, "", 1) $success = True ExitLoop EndIf Next if $success = True Then MsgBox(0, "Success", "Line has been deleted") Else MsgBox(0, "Failure", "Line wasn't found") EndIf
TeraCopy Timer - A program of mine, front end really, that I have been working on (on & off) for some time, but not shared here before, that I recall. Third party program TeraCopy is required.
Many of you will be familiar with TeraCopy, and it has been discussed here at AF on several occasions, in various sub forums, including Chat.
BE ADVISED - I still use an older version of TeraCopy (v2.27), a goody but an oldy, so have only tested my program with that. It may work with the newer v3.xx, or may be easily adjusted to do so, but I have not yet gone that route. Likewise, I only use it with Win 7 and Win XP, but I don't imagine there should be any issues with newer Windows. Add to that, my program being devised and created in AutoIt v184.108.40.206.
So what is TeraCopy Timer and why might you need it?
Those familiar with TeraCopy use, know you can run multiple copy or move jobs either simultaneously or concurrently (one immediately after another has finished). With the free version at least, you have no control over precise order or timing, and no way to deal (without manual interaction) with the pesky Thumbs.db files in Win XP. TeraCopy Timer allows you to do all those things, and in a batch fashion.
Some screenshots and brief explanation
This new WAIT feature is the simplest and best way to use the program generally (in my view) ... but check out the following, as it is not always the case.
Advanced Delay Window
WARNING - It should go without saying, that you take all the usual precautions. For instance, don't use move with the only copy you have of precious files. BACKUP BACKUP BACKUP! Don't hold me liable for anything, except for being a nice guy who likes to share.
TeraCopy Timer v2.8.zip (see detail at Post #34)
TeraCopy Timer v2.9.zip (see detail at Post #35)
P.S. I am not affiliated in any way with those who created and provide the excellent third party program - TeraCopy.
I'm quite new to AutoIT and I have a very big batch file that I'm trying to completely re-write in Autoit, so far it's been going well but I got stuck with a certain part, hope someone can help.
Here's the part of the batch script I'm currently stuck re-creating in AutoIT:
:BeginLangMenu if "%OptNum%" gtr "0" goto ShowLangMenu ::Next Section code based on code supplied by Aacini from stackoverflow.com :DefineLangMenu for /L %%D in (1,1,99) do ( if exist Common\Settings\Data%%D.ini for /F "eol=# tokens=1,2 delims==" %%a in (Common\Settings\Data%%D.ini) do ( set line=%%a if "!line:~2,5!" neq "clude" ( REM Define "normal" variables, i.e. Compressor, Method, etc. set %%a= ) else if "!line:~7!" neq "" ( REM Define the base array elements, i.e. D1IncludeAR=%%b, D1ExcludeAR=%%b, ... set D%%D%%a=%%b REM Set Show?? array elements with value equal 1, i.e. ShowAR=1, ... REM when anyone of DiInclude?? or DiExclude?? corresponding elements was given if defined D%%D%%a set Show!line:~7!=1 ) ) ) REM Define a list of language abbreviations, i.e. "langs=AR CZ DE ..." REM and the corresponding language names array, i.e. lang[AR]=Arabic, ... REM At same time, calculate original OptNum for %%a in ("AR=Arabic" "CZ=Czech" "DE=German" "EN=English" "ES=Spanish" "ESMX=Spanish(Mexico)" "FR=French" "HU=Hungarian" "IT=Italian" "JP=Japanese" "KR=Korean" "PL=Polish" "PR=Portuguese" "PRBR=Portuguese(Brazil)" "RU=Russian" "ZH=Chinese") do ( for /F "tokens=1,2 delims==" %%b in (%%a) do ( set "langs=!langs! %%b" set "lang[%%b]=%%c" set /A "OptNum+=Show%%b" ) ) ::NEXT 2 SECTIONS DISPLAYS THE LANGUAGE SELECTION MENU IF APPLICABLE :ShowLangMenu set /a step=%step%+1 :LangMenu if "%OptNum%"=="0" Goto checksplit echo %TIME:~0,2%:%TIME:~3,2%:%TIME:~6,2% - Showing Language Selection Menu >> "%workdir%Conversion.log" REM Show the language menu set #=0 for %%a in (%langs%) do ( if defined Show%%a ( set /A #+=1 rem echo [!#!] !lang[%%a]! echo !lang[%%a]! >> %b2eincfilepath%\Lang.txt set "option[!#!]=%%a" ) ) %MYFILES1%\DROPDOWNBOX.exe /F:"%b2eincfilepath%\Lang.txt" "Choose Which Language to Compress" "STEP %step%: Language Selection" /W:280 /RI /C:13 >nul > %b2eincfilepath%\LangAnswer.txt if %ERRORLEVEL% EQU 0 del %b2eincfilepath%\LangAnswer.txt if exist %b2eincfilepath%\LangAnswer.txt set /p "SelectLang="<%b2eincfilepath%\LangAnswer.txt if not defined SelectLang goto LangError if %SelectLang%==Arabic Set LangOpt=AR if %SelectLang%==Czech set LangOpt=CZ if %SelectLang%==German set LangOpt=DE if %SelectLang%==English set LangOpt=EN if %SelectLang%==Spanish set LangOpt=ES if %SelectLang%==Spanish(Mexico) set LangOpt=ESMX if %SelectLang%==French set LangOpt=FR if %SelectLang%==Hungarian set LangOpt=HU if %SelectLang%==Italian set LangOpt=IT if %SelectLang%==Japanese set LangOpt=JP if %SelectLang%==Korean set LangOpt=KR if %SelectLang%==Polish set LangOpt=PL if %SelectLang%==Portuguese set LangOpt=PR if %SelectLang%==Portuguese(Brazil) set LangOpt=PRBR if %SelectLang%==Russian set LangOpt=RU if %SelectLang%==Chinese set LangOpt=ZH if defined SelectLang Goto LangSet ::SETS THE LANGUAGE SELECTION ACCORDING TO USER INPUT IN LANGUAGE MENU :LangSet set "LangIs=%LangOpt%"
Basically, here's what I need to do:
Read from specific section of INI file but ONLY the Keys that have a Value. OR: A way to remove the keys without the values from the Array created by IniReadSection. A way to then take these stored values, and create a list of Languages based last 2-4 characters of the Key names. At this point, that said list is shown to user in DropDown box, after user make selection I need a way to move the Value of the Key related to the selected Language to a Variable, and ONLY the value for that specific Language. That's it basically, the rest is more or less Variable manipulation which isn't a problem.
A little Example:
My INI file have a Section like this:
[LangInclude] IncludeAR=a IncludeCZ= IncludeDE=b IncludeEN= IncludeES=c IncludeESMX= IncludeFR= IncludeHU=d IncludeIT= IncludeJP= IncludeKR=e IncludePL= IncludePR= IncludePRBR= IncludeRU= IncludeZH= I need to get Only the keys that are set, in this case: IncludeAR, IncludeDE, IncludeES, IncludeHU & IncludeKR.
I then need to convert these to a list of languages, in this example it will be (Arabic, German, Spanish, Hungarian, Korean).
That list will be turned to DropDown selection, that I can do easily once I get the list correctly.
After the user Selected, let us say for the example purpose Spanish, I need the Value of IncludeES to be moved into a Variable, like this: $Var=c
I hope somebody can help me because I'm stuck after Importing the INI section with IniReadSection, everything I tried so far failed, the best I managed to do is Sort the array to have all the keys with values either at the first rows or last rows.
I need some ideas.
Hi, I need to convert this batch, I follow microsoft specs here https://technet.microsoft.com/en-us/library/bb491005.aspx
start /b 1.exe "path\2.exe"
start /b mypgrcommand
start /b /wait 3.exe "path\4_.exe"
taskkill /F /IM 5.exe
Somethings like this...
RunWait( @COMSPEC & " /c start /b 1.exe 'path\2.exe' start /b mypgrcommand start /b /wait 3.exe 'path\4_.exe' taskkill /F /IM 5.exe", "", @SW_SHOW ) Thx
Ich hab ein Script für Windows Updates, dass nach dem OOBE aufgerufen werden soll. Run/RunOnce ist daher nicht möglich.
Stattdessen möchte ich das Script in den Autostart schreiben lasse. Wenn die OOBE beendet wird und der Administrator angemeldet wird, soll das Update-Script einmalig aufgerufen werden und sich anschl. selbst löschen.
Lang rede, kurzer Sinn:
Wie kann ich folgendes Script in den Autostart schreiben?
RunWait(@ComSpec & " /c " & "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File C:\UA\Scripts\win-updates.ps1 -MaxUpdatesPerCycle 100 -RestartRequired 1", "") Ich würde ungern eine BAT oder EXE reinkopieren, da ich es unsauber finde. Die müsste ja auch zusätzlich irgendwo liegen.