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.
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 v18.104.22.168.
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)
P.S. I am not affiliated in any way with those who created and provide the excellent third party program - TeraCopy.
With this script you can print Unicode text in the CMD screen
the script is easy to use
just you write the text that contains Unicode in the first input
and the script automatically reflect the code in the second input
you can copy the text to the clipboard
or you can try printing the text in the CMD window
I apologize to everyone for colors and shape if not appropriate
I'm a blind man and I do not see
Thank you for your understanding
Greetings to all of youCmdUtM.au3
Thanks to this post (https://www.autoitscript.com/forum/topic/189553-writing-to-cmd/?do=findComment&comment=1361142) I can now write a helpfile to the cmd when for instance passing parameter -h or -help at cmd. But then cmd is blocked by the script (I had to free it with CTRL+BREAK):
#include <WinAPI.au3> _WinAPI_AttachConsole() $hConsole = _WinAPI_GetStdHandle(1) _WinAPI_WriteConsole($hConsole, "Print helpfile................" & @CRLF) Inside MSDN Library then I found this sentence: A process can use the FreeConsole function to detach itself from its console.
But I don't find something like _WinAPI_FreeConsole(). How can I do it in another way?
A fullscreen console with custom commands!
This funny project started as a question in the help section:
I'd like to share this script with everyone that is interested.
Why would I want it?
You like the old style fullscreen console (like in the old day's), You can add custom commands, You can customize the font a lot more compared to cmd.exe, You can share ideas or add tweaks to the script.
Still to do:
Write a simple custom programming language to implement this tool. Writing a little help file / pdf to describe my little programming language. Add little sound effects like a beep if there is a syntax error (optional). Clean up and modify Console.Au3 content. Add an option to have to type a login password (optional). Make an optional installer that also gives scripts for this tool a custom icon and open with command. ...Call Neo?
xxaviarxx: debugging, some ideas. jguinch: debugging, adding a bunch of tweaks and ideas. kylomas: debugging, new ideas.
Edits and updates:
Added usage of tab key in edit control Edit has focus now on startup I'm currently rewriting a simple custom programming language to implement this tool.
UDF download: Console.au3