Leaderboard
Popular Content
Showing content with the highest reputation on 03/19/2019 in all areas
-
Why/how does my GuiCtrlList autosort/remove duplicates?
FrancescoDiMuro and one other reacted to Nine for a topic
I know you'll go far in programming, you are the BatMan after all2 points -
BatMan22, The default style for ListBoxes includes the $LBS_SORT style - hence sorting is default. if you want to have the ListBox unsorted, then you need to explicitly define the styles and omit the "sort" one: $List1 = GUICtrlCreateList("", 0, 0, 60, 387, BitOr($WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY)) $List2 = GUICtrlCreateList("", 60, 0, 241, 387, BitOr($WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY)) See the Setting Styles tutorial in the Wiki for more details. Using GUICtrlSetData when loading a ListBox sets any "double" values as the default - as explained in the Help file: You can always use _GUICtrlListBox_AddString to avoid this problem: ;GUICtrlSetData($List1, $arrayfinal[$i][0]) _GUICtrlListBox_AddString($List1, $arrayfinal[$i][0]) ;GUICtrlSetData($List2, $arrayfinal[$i][1]) _GUICtrlListBox_AddString($List2, $arrayfinal[$i][1]) Please ask if you have any further questions. M23 Edit: late, but more complete!2 points
-
This is NOT going to end well. I'm out.2 points
-
You do realize that Autoit is not a programming language, right? And I know Python 3.2 points
-
How to remove a group of text lines in many files
FrancescoDiMuro reacted to mikell for a topic
OK. Here is the concept, using Francesco's way. Please note that you will have to put in the correct paths, the error checking, and any other needed stuff #include <File.au3> $sFromFolder = @desktopdir $sFixedFolder = @desktopdir & "\test" ReplaceLines($sFromFolder, $sFixedFolder, "*.au3") Func ReplaceLines($sSrcFolder, $sDestFolder, $files) Local $au3files = _FileListToArray($sSrcFolder, $files, 1), $n For $i = 1 To $au3files[0] $strFileContent = FileRead($sSrcFolder & "\" & $au3files[$i]) $strFileContent = StringRegExpReplace($strFileContent, '(?s)If _OSVersion\(\).*?EndIf', "") If @extended Then $strFileContent = '#include "OSVersion.au3"' & @crlf & $strFileContent $hfile = FileOpen($sDestFolder & "\" & $au3files[$i], 1 + 8) FileWrite($hfile, $strFileContent) FileClose($hfile) $n += 1 EndIf Next Msgbox(0,"", $n & " files fixed from " & $au3files[0]) EndFunc Please keep cool1 point -
if you don't want to loop, you could use : GUICtrlSetData ($List1, _ArrayToString ($arrayfinal,"",Default,Default,"|",0,0)) GUICtrlSetData ($List2, _ArrayToString ($arrayfinal,"",Default,Default,"|",1,1)) Doesn't change much, but it is kind of cool using it like that1 point
-
Why/how does my GuiCtrlList autosort/remove duplicates?
BatMan22 reacted to FrancescoDiMuro for a topic
@BatMan22 When you create the List, by default, it has the $LBS_SORT style set, so, the sorting of your list is an expected behaviour having that style. By the way, you are making way too many (and unnecessary) steps to have all the information you are retrieving from your file; one of many, you could read your file with the @TAB separator char.1 point -
Because you need to separate your items with "|" in GUICtrlSetData (....)1 point
-
How to remove a group of text lines in many files
FrancescoDiMuro reacted to mikell for a topic
Check @extended for the number of replacements performed. If the wanted sequence is not found in $strFileContent, then no replacement occurs, the whole text is returned 'as is' and @extended is set to 01 point -
How to remove a group of text lines in many files
FrancescoDiMuro reacted to mikell for a topic
@FrancescoDiMuro A little modification for a better nice looking $strFileContent = StringRegExpReplace($strFileContent, '(?is)If _OSVersion\(\).*?EndIf', "") If @extended Then $strFileContent = '#include "OSVersion.au3"' & @crlf & $strFileContent1 point -
Get MSI Product Version and Install if newer
Earthshine reacted to Jos for a topic
Great, so what exactly is the question? Jos1 point -
Autoclick on emulator
yutijang reacted to JLogan3o13 for a topic
Throughout this entire thread you seem to be at the same time hurling thinly veiled insults at those trying to help you while at the same time showing zero effort yourself in trying to resolve the issue. You seem at once to be waiting for someone to spoon-feed the code to you while complaining because they aren't getting around to it quickly enough to suit you. You keep stating it is too complex for everyone here, yet you are here because it is too complex for you; perhaps some willingness to follow suggestions and provide decent feedback rather than "it won't work" will get you farther toward your goal. As you have seen already, several of the forum's most prolific helpers have bowed out; perhaps think about changing your approach if you would like people to continue to offer assistance. Edit: Apologies @Jos stepped on your close1 point -
I feels like you just burned you last option to get help here.... so lets close this topic and not continue it any further. Jos1 point
-
Function ProcessGetStats Failure
FrancescoDiMuro reacted to Jos for a topic
I am wondering why we think it will work with another tool while it really looks like a authorization issue ..... or am I missing something? Jos1 point -
You spent a lot of time on it. I would never know how to do all that. You must do a lot with AutoIt.1 point
-
Try this #include <File.au3> #include <Array.au3> Opt("WinWaitDelay", 100) Opt("WinTitleMatchMode", 4) Opt("WinDetectHiddenText", 1) Opt("MouseCoordMode", 0) TrayTip("clears any tray tip", "", 0) AutoItSetOption("TrayIconDebug", 1) ;0-off Global Const $sFileName = "ACTIC25.AU3" Global Const $sFromFolder = "C:\Dnload\9xAddons\" Global Const $sFixedFolder = "C:\Dnload\9xAddons\Fixed\" Global Const $sStart = "If _OSVersion" Global Const $sTo = "EndIf" ReplaceLines($sFileName, $sFromFolder, $sFixedFolder) Exit Func ReplaceLines($sFileName, $sSrcFolder, $sDestFolder) ;$objErr = ObjEvent("AutoIt.Error", "MyErrFunc") Local $sFinished = 0, $iErr = 0, $aFile Local $sSrcFile = $sSrcFolder & "\" & $sFileName Local $sDestFile = $sDestFolder & "\" & $sFileName If FileExists($sDestFile) Then FileDelete($sDestFile) EndIf _FileReadToArray($sSrcFile, $aFile, $FRTA_NOCOUNT) ;array is 0-based use UBound() to get size $iErr = @error If $iErr Or Not IsArray($aFile) Then MsgBox(0, "Error Occurred", $iErr) Return EndIf _DeleteArrayElement($aFile) $iErr = @error If $iErr Or Not IsArray($aFile) Then MsgBox(0, "Error Occurred", Hex($iErr) & ":" & $iErr) Return EndIf _FileWriteFromArray($sDestFile, $aFile, 0) EndFunc ;==>ReplaceLines Func _DeleteArrayElement(ByRef $_Array) If Not IsArray($_Array) Then Return SetError(0xBAD, 0, 0) Local $iArrayCount = UBound($_Array) Local $iStartPos = -1, $iEndPos = -1 Local $iErr = 0xDEAF ;Returned if no match found For $i = 0 To $iArrayCount If StringInStr($_Array[$i], $sStart) <> 0 Then For $j = ($i + 1) To $iArrayCount ;We Start After $sStartPos If StringInStr($_Array[$j], $sTo) <> 0 Then $iStartPos = $i $iEndPos = $j ExitLoop EndIf Next If $iStartPos >= 0 And $iEndPos > $iStartPos Then ExitLoop EndIf Next If $iStartPos >= 0 And $iEndPos > $iStartPos Then Local $sRange = $iStartPos & "-" & $iEndPos _ArrayDelete($_Array, $sRange) $iErr = @error If $iErr Then Return SetError($iErr, 0, 0) _ArrayInsert($_Array,0,'#include "OSVersion.au3"') EndIf Return SetError($iErr, 0, 0) ;Note $_Array is Byref so it doesn't need returned EndFunc ;==>_DeleteArrayElement1 point
-
You can even streamline things: $iStat = MyFunc(StringSplit("4|7", "|", $STR_NOCOUNT)) Func MyFunc ($aInputArray) ... EndFunc Bonus: this still allows you to pass an existing array in other invokations. Drawback: all array entries are string type.1 point
-
I don't know if this is faster or even cleaner than doing the stringsplit thing but here is another way Test() Test1(Call(MyArr)) Func Test($aArray = Call(MyArr)) ConsoleWrite(IsArray($aArray) & "!") _ArrayDisplay($aArray) Endfunc Func Test1($aArray) ConsoleWrite(IsArray($aArray) & "!") _ArrayDisplay($aArray) Endfunc Func MyArr() Local Const $a[5] = [1, 2, 3, 4, 5] Return $a EndFunc1 point
-
You could pass it as a string like : $iStat = MyFunc("4|7") Func MyFunc ($strInputArray) Local $aStr = StringSplit ($strInputArray, "|", $STR_NOCOUNT) EndFunc See how I use Local here - - Never mind him.1 point
-
TimerInit() and TimerDiff() Procedure.f TimerInit() ProcedureReturn ElapsedMilliseconds() EndProcedure Procedure.f TimerDiff(StartTime.f) ProcedureReturn (ElapsedMilliseconds() - StartTime)/1000 EndProcedure1 point
-
$GUI_Checked and $GUI_Unchecked
AasimPathan reacted to Nine for a topic
If you really want to reduce redundancy, you could do something like : While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $idButton_Close ExitLoop Case $idCheckbox1 to $idCheckbox10 _buttonResponse($nMsg) EndSwitch Wend1 point -
$GUI_Checked and $GUI_Unchecked
AasimPathan reacted to Jfish for a topic
Also have a look at whether or not your select statements are being triggered. There is a lot of repetitive code that you could probably do with a function - but this is a snippet with a debug msgbox to see if the function is being triggered and then un-checking it if it is a "no": $response=MsgBox($MB_YESNO, "", "Do you want to run the procedure over 022", 0, $hGUI) if $response=6 then ;Run the procedure else MsgBox(0,'','you selected no') _IsUnChecked($idCheckbox1) EndIf ;then I changed the other function to this: Func _IsUnChecked($idControlID) GUICtrlSetState($idControlID,$GUI_UNCHECKED) EndFunc ;==>_IsUnChecked I didn't test this very much, but here is an example of reducing some of the code into a function: While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idButton_Close ExitLoop Case $idCheckbox1 _buttonResponse($idCheckbox1) Case $idCheckbox2 _buttonResponse($idCheckbox2) Case $idCheckbox3 _buttonResponse($idCheckbox3) Case $idCheckbox4 _buttonResponse($idCheckbox4) Case $idCheckbox5 _buttonResponse($idCheckbox5) Case $idCheckbox6 _buttonResponse($idCheckbox6) Case $idCheckbox7 _buttonResponse($idCheckbox7) Case $idCheckbox8 _buttonResponse($idCheckbox8) Case $idCheckbox9 _buttonResponse($idCheckbox9) Case $idCheckbox10 _buttonResponse($idCheckbox10) EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example func _buttonResponse($idControlID) If _IsChecked($idControlID) Then $response=MsgBox($MB_YESNO, "", "Do you want to run the procedure over 022", 0, $hGUI) if $response=6 then ;Run the procedure else MsgBox(0,'','you selected no') _IsUnChecked($idControlID) EndIf Else ;If uncheck what should it do? EndIf EndFunc Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked Func _IsUnChecked($idControlID) GUICtrlSetState($idControlID,$GUI_UNCHECKED) EndFunc ;==>_IsUnChecked1 point -
Time spent on learning the language and further use is hundreds of times more expensive. It takes me 3 days to work to buy PureBasic, but studying and addictive will take several months. It is more difficult to pay, as it is necessary to register on PayPal. I do not think that it is necessary to make an AutoIt3 shell for PureBasic. It is better to make a table of function analogs in order to understand with the help of which function you can do the same things. I for example know the name of the function "Sleep", but I can not find its equivalent in the PureBasic help file, because the name is different.1 point
-
StringSplit ( "string", "" ) If you use an empty string "" for the delimiters, each character will be returned as an element. Procedure StrToArrLetter(Array Arr.s{1}(1), String$) Protected LenStr, i LenStr = Len(String$) If LenStr ReDim Arr(LenStr - 1) PokeS(Arr(), String$, -1, #PB_String_NoZero) EndIf EndProcedure StringSplit ( "string", " " ) Procedure StrToArr(Array Arr.s(1), String$, Sep$ = " ") Protected CountSep, n CountSep = CountString(String$ , Sep$) If CountSep = 0 ReDim Arr(1) Arr(1) = String$ Else ReDim Arr(CountSep+1) For n = 1 To CountSep+1 Arr(n) = StringField(String$, n, Sep$) Next EndIf EndProcedure StringFormat ImportC "msvcrt.lib" swprintf(*s, Format.s, Param1=0, Param2=0, Param3=0, Param4=0) EndImport num1.l = 16049884 Buff.s{100} swprintf(@Buff, "%06X", num1) Debug Buff StringTrimLeft Procedure.s TrimLeft(String$, n) ;ProcedureReturn Right(String$, Len(String$) - n) ProcedureReturn Mid(String$, n+1) EndProcedure StringTrimRight Procedure.s TrimRight(String$, n) ProcedureReturn Left(String$, Len(String$) - n) EndProcedure @ScriptDir =analog= GetPathPart(ProgramFilename()) @ScriptName =analog= GetFilePart(ProgramFilename()) @ScriptFullPath =analog= ProgramFilename() @MyDocumentsDir =analog= GetUserDirectory(#PB_Directory_Documents) @ProgramFilesDir =analog= GetUserDirectory(#PB_Directory_Programs) @DesktopCommonDir =analog= GetUserDirectory(#PB_Directory_Desktop)1 point