Good evening everyone
First, I want to apologize with you for the title not very clear, but I thought a little bit on which title to set at the thread, and this is the one that came in mind.
Now, let me explain what I'm trying to understand.
I am making an application ( with n clients ), with an SQLite Database, which has a Main form, and n sub-forms...
Since these sub-forms are called several times, because they are used to add or update records to the Database, I put the code that generates the GUI of these sub-forms in Functions.
There are two sub-forms which are "treated" as two main forms, since even them have n sub-forms, which perform various tasks.
Where am I stucked?
For the Main form I created a Status Bar, in order to display messages ( add/delete/update/search results ), and it works perfectly with all the forms which don't have other sub-forms.
For the two forms, which indeed have n sub-forms, I created two separated Status Bars, which are (re)created everytime I call the function that then displays the form.
Practically, I can't set icons to these two Status Bars, and I don't know why.
I'm really sorry that I don't feel clear enough, so, here you are an example of what I am saying.
I recreated exactly what my script does:
#include <GuiButton.au3> #include <GUIConstantsEx.au3> #include <GuiStatusBar.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Global $frmSubForm, _ $txtSubFormField, _ $sbSubFormStatusBar, _ $objSB_IconError = _WinAPI_LoadShell32Icon(109), _ $objSB_IconInformation = _WinAPI_LoadShell32Icon(277) #Region ### START Koda GUI section ### Form= $frmMainForm = GUICreate("Main Form", 300, 300, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "ExitApplication") $sbMainStatusBar = _GUICtrlStatusBar_Create($frmMainForm) $btnCreateSubForm = GUICtrlCreateButton("Create Sub Form", 105, 110, 75, 41, BitOR($BS_CENTER,$BS_VCENTER,$BS_MULTILINE)) GUICtrlSetOnEvent(-1, "GenerateSubForm") GUICtrlSetFont(-1, 10, 400, 0, "Arial") _GUICtrlStatusBar_SetSimple($sbMainStatusBar) _GUICtrlStatusBar_SetText($sbMainStatusBar, "") GUISetState(@SW_SHOW, $frmMainForm) #EndRegion ### END Koda GUI section ### While 1 Sleep(100) WEnd Func ExitApplication() Exit EndFunc Func GenerateSubForm() #Region ### START Koda GUI section ### Form= $frmSubForm = GUICreate("Sub-Form", 300, 300, -1, -1, -1, -1, $frmMainForm) GUISetOnEvent($GUI_EVENT_CLOSE, "DeleteSubForm") $txtSubFormField = GUICtrlCreateInput("", 0, 0, 100, 20) $btnCheckSubFormField = GUICtrlCreateButton("Check Field", 105, 110, 75, 41, BitOR($BS_CENTER,$BS_VCENTER,$BS_MULTILINE)) GUICtrlSetOnEvent(-1, "CheckSubFormField") GUICtrlSetFont(-1, 10, 400, 0, "Arial") $sbSubFormStatusBar = _GUICtrlStatusBar_Create($frmSubForm) _GUICtrlStatusBar_SetSimple($sbSubFormStatusBar) _GUICtrlStatusBar_SetText($sbSubFormStatusBar, "") GUISetState(@SW_SHOW, $frmSubForm) GUISetState(@SW_DISABLE, $frmMainForm) #EndRegion ### END Koda GUI section ### EndFunc Func DeleteSubForm() ; Declared Globally => $frmSubForm GUIDelete($frmSubForm) GUISetState(@SW_ENABLE, $frmMainForm) EndFunc Func WriteToStatusBar($sbStatusBar, $objSB_Icon, $strText) _GUICtrlStatusBar_SetIcon($sbStatusBar, 0, $objSB_Icon) _GUICtrlStatusBar_SetText($sbStatusBar, $strText) ConsoleWrite("Icon Handle: " & $objSB_Icon & @CRLF) EndFunc Func CheckSubFormField() ; Declared Globally => $txtSubFormField If GUICtrlRead($txtSubFormField) = "" Then ; Declared Globally => $sbStatusBar WriteToStatusBar($sbSubFormStatusBar, $objSB_IconError, "Field NOK.") Else WriteToStatusBar($sbSubFormStatusBar, $objSB_IconInformation, "Field OK.") EndIf EndFunc The text is set, but icon is not.
Could someone please tell me why?
Thanks everyone in advance
I look for GUI whose behavior similar to the message of an email client or antivirus
In other words:
Any PC screen able to calculate the size
To consider the Task bar size
To find the lower corner on the right/below and to nestle on it
In GUI the GUICtrlCreateEdit field (as option) - that can be received and displayed through variable information
Thanks a lot
I use the translator, excuse if something is not clear
I found this function in the Internet
It is to play audio files from the compiled script
I did not understand just one thing on this function
func play($name, $wait = 0) local Const $SND_RESOURCE = 0x00040004 local Const $SND_ASYNC = 1 ; Play the file - the script will pause as it sounds if $wait = 0 then DllCall("winmm.dll", "int", "PlaySound", "str", $name, "hwnd", 0, "int", BitOR($SND_RESOURCE, $SND_ASYNC)) else DllCall("winmm.dll", "int", "PlaySound", "str", $name, "hwnd", 0, "int", $SND_RESOURCE) endIf return 1 endFunc What I did not understand was this variable
local Const $SND_RESOURCE = 0x00040004 I know that this variable is contains the resource name
But what if I want to change the name of the resource what i'll do?
can i do that?
Thanks in advance
I'd like to show a progress bar for an operation performed by an external program my script is running silently, I want to show it in a GUI I created using the GUICtrlCreateProgress but I have no idea how to do it.
The important thing to point out is that there's no way of knowing how long the external program will run, as it is a file splitter and it depends on the size of file it splits and the split parts size.
Can someone point me in the right direction or give me an example how to do so?
This is my RunWait command:
RunWait($MYFILES1 & '\fsplit.exe -split ' & $Size & ' mb ' & $File & " -f " & $File & "." & $extension) It uses multiple variables declared and set earlier in the script, how will I got about having the progress of that command shown using GUICtrlCreateProgress ? Is it possible?
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.