13 posts in this topic
As they're opinion-based to some degree; how are AutoIt's best practices decided and do suggestions get considered?
Some suggestions :
For...To...Step...Next -loop variable-naming like $iN ($i1, $i2, etc.) : conforms to recommended naming convention, identifies level (albeit inverted to ExitLoop and ContinueLoop's convention) and enables SciTE selection-highlighting (requires minimum of 3 characters). Minimize logic in global scope, separate data & settings from logic, use of vertical space, project organization (folder structure, resource- and include file management). Example (loop variable-naming, minimizing logic in global scope and separation of settings from logic) :
#include <Array.au3> Global Enum $RANDOM_RETURNFLOAT, _ $RANDOM_RETURNINTEGER Global Enum $EXITCODE_NONE Global Const $g_sChar0 = '-' Global Const $g_sChar1 = '+' Global Const $g_iAmountX = 10 Global Const $g_iAmountY = $g_iAmountX Main() Func Main() Local $aArray[$g_iAmountY][$g_iAmountX] For $i1 = 0 To $g_iAmountY - 1 For $i2 = 0 To $g_iAmountX - 1 $aArray[$i1][$i2] = Random(0, 1, $RANDOM_RETURNINTEGER) ? $g_sChar1 : $g_sChar0 Next Next _ArrayDisplay($aArray) Exit $EXITCODE_NONE EndFunc Example (project organization) :
+ project_folder + bak [backup files] + bin [distributed binaries and dependencies] + inc [non-standard include files] + res [resource files (icons, file+install files, etc.)] + usr [configuration files, databases, etc.] - script.au3 - script.exe Example (use of vertical space) :
Func _DigitalRoot($iNum) Local $sNum = '' Local $aNum While $iNum > 9 $sNum = String($iNum) $aNum = StringSplit($sNum, '') $iNum = 0 For $i1 = 1 To $aNum $iNum += Int($aNum[$i1]) Next WEnd Return $iNum EndFunc
I wonder if
AutoIt3Wrapper_run_debug_mode = Y can include run information about functions which are called within the main code. So far I noticed in the console that the function itself is called but no specific run information from inside the function is provided. Is there a chance to show the entire debug log including functions in the console?
I furthermore noticed a stop of information when a loop is entered. What could be the reason for that?
Thanks for help.
I need this for a project and I don't find a method for the next problem.
I want when I click a button to create a variable ("$variable1") so if I press one more time to create one more ("$variable2") and create more and more how many times you press the button.
Do you have an idea ?
Thank you for your attention !
Is this possible:
Executing a function from an include, but taking the function name from a gui input and then executing that function using the include:
#include <Something.au3> ;input reads "Tree" $functionName = GuiCtrlRead($input1) $functionName(1) And the include is gonna have
Func Tree($x) If $x = 1 Then $this = "text" MsgBox(0,$this,"whatever") EndFunc is it possible?
Hello, i'm making a little script that lets users enter a question and if the script can't answer to, it ask what would be the answer (a bit like siri on IPhones). And I try to display the "supposed array" I still have an error.. I searched on Google and got nothing looked in the help file too.. I'm here to know if someone have a solution to my error please.
Here is where $a and $b should become arrays :
Dim $dossier = @AppDataDir & "\Siri2" Dim $chemin = $dossier & "\data.ini" Global $a = _InfoRead($chemin, 0) Global $b = _InfoRead($chemin, 1) with this function :
Func _InfoRead($path, $mode = 0) If DirGetSize($dossier) = -1 Then Return SetError(-4) If Not FileExists($chemin) Then Return SetError(-5) Local $readed = IniReadSection($path, "data") If @error Then Return SetError(-3) $size = $readed Local $return[$size] For $i = 1 To $size Step 1 $return[$i - 1] = $readed[$i][$mode] Next Return $return EndFunc and the thing that i don't understand is that, after _InfoRead return affected to $a, I can't use _ArrayDisplay because of error 1 "$aArray is not an array" (and same fpr the variable $b)..
Can please someone help me to understand why is it doing this ?