-
Posts
104 -
Joined
-
Last visited
Reputation Activity
-
Fr33b0w reacted to AspirinJunkie in [SOLVED] Extracting all text from a file that start with >"text": "< and ends with >", "timestamp":<
The string appears to be a JSON string. Have you already tried one of the corresponding JSON UDFs? This should be easier to understand and more stable than using RegEx.
-
Fr33b0w got a reaction from Nine in [SOLVED] Extracting all text from a file that start with >"text": "< and ends with >", "timestamp":<
Sorry, didnt refresh. Yes it works great! Thank You for your help! Glad to see you again.
-
Fr33b0w reacted to Nine in [SOLVED] Extracting all text from a file that start with >"text": "< and ends with >", "timestamp":<
already done, see my edit
-
Fr33b0w reacted to Nine in [SOLVED] Extracting all text from a file that start with >"text": "< and ends with >", "timestamp":<
Global $InputDatab = StringRegExp($InputDataa, '(?<="text": )(.+?)(?|, "like_count"|, "author_id")', 3) Try this.
-
Fr33b0w reacted to Nine in [SOLVED] Extracting all text from a file that start with >"text": "< and ends with >", "timestamp":<
Replace your _FileWriteFromArray line by this one:
FileWriteLine($dir & $target, _ArrayToString($InputDatab, "|"))
-
Fr33b0w reacted to Nine in [SOLVED] Extracting all text from a file that start with >"text": "< and ends with >", "timestamp":<
Replace "|" by @CRLF
-
Fr33b0w reacted to Nine in [SOLVED] Extracting all text from a file that start with >"text": "< and ends with >", "timestamp":<
Few suggestions for your script :
1- Use _FileListToArray instead of FileFindFirstFile/FileFindNextFile. You can then use _ArrayDisplay to make sure you got all the files in the array.
2- Your second FileWriteLine should use $timestampArray instead of $textArray
3- FileClose on a named file is useless (see help file : it should be a handle)
4- You should add a consoleWrite warning when your stringBetween does not work
5- Adding traces to a script to understand what is going on is the best way to debug...
-
Fr33b0w reacted to Melba23 in FileFindNextFile fails to detect final file in subdirectory
RaySS,
Why do you insist on using FindFirst/NextFile when we have perfectly good functions (_FilListToArray/_FileListToArrayRec) which make coding so much easier? The latter of those functions will even let you search for multiple patterns within a single pass.
This appears to do what you require when I test with dummy files in my system:
#include <File.au3> #include <Array.au3> Local $sTopDirectory = "E:\Clif\DoublestarSAVED\" Global $aFilesFound[1] = [0] $aList = _FileListToArray($sTopDirectory, Default, $FLTA_FOLDERS) ;How many subdirectories in top directory? ;Allocate space for number of subdirectories. Local $aConCat[$aList[0]], $aDateTime[$aList[0] + 1], $aFiles[$aList[0] + 1], $aComment[$aList[0] + 1] If IsArray($aList) Then For $a = 1 To $aList[0] If StringInStr($aList[$a], "for lucky") Then ContinueLoop $sSubdirectoryName = $sTopDirectory & $aList[$a] ConsoleWrite(@CRLF & "Subdirectory Name: " & $sSubdirectoryName & @CRLF) $aFound = _FileListToArrayRec($sSubdirectoryName, "*_0000.fit;*_1999.fit;*-9999.fit", $FLTA_FILES) ; ;_ArrayDisplay($aFound, $aList[$a], Default, 8) ; Should you want to check If IsArray($aFound) Then ; Increase size of array $aFilesFound[0] += 1 ReDim $aFilesFound[$aFilesFound[0] + 1] ; Get time for each folder and add to array $aFilesFound[$aFilesFound[0]] = FileGetTime($sTopDirectory & $aList[$a], $FT_CREATED, $FT_STRING) & "|" & $aList[$a] & "|" & $aFound[0] EndIf Next EndIf _ArrayDisplay($aFilesFound, "Final", Default, 8)M23
-
Fr33b0w reacted to Trong in [SOLVED] Extracting all text from a file that start with >"text": "< and ends with >", "timestamp":<
I don't know how to use RegEx but you can use _StringBetween():
#include <String.au3> Local $InputData = '"text": "Some Youtube comment as example", "timestamp":346230, "text": "SomeSDGs example", "timestamp": 15833460, "text": "Some YoutFGNSFGJnt as example", "timestamp": 45634572800, "' $InputData = StringReplace($InputData, ', "', ',"') $InputData = StringReplace($InputData, '": ', '":') Local $textArray = _StringBetween($InputData, '"text":', ',"') If IsArray($textArray) Then For $i = 0 To UBound($textArray) - 1 ConsoleWrite($textArray[$i] & @CRLF) Next EndIf Local $timestampArray = _StringBetween($InputData, '"timestamp":', ',"') If IsArray($timestampArray) Then For $i = 0 To UBound($timestampArray) - 1 ConsoleWrite($timestampArray[$i] & @CRLF) Next EndIf
-
Fr33b0w reacted to Subz in [SOLVED] Extracting all text from a file that start with >"text": "< and ends with >", "timestamp":<
Or something like:
#include <Array.au3> Global $sText = '"text": "Some Youtube comment as example", "timestamp":346230, "text": "SomeSDGs example", "timestamp": 15833460, "text": "Some YoutFGNSFGJnt as example", "timestamp": 45634572800, "' Global $aText = StringRegExp($sText, '(?<=\"text\": \").*?(?=\", \"timestamp\")', 3) _ArrayDisplay($aText)
-
Fr33b0w reacted to seadoggie01 in The Missing Mouse
So I came to work today with a bit of an issue... I forgot to bring my mouse. I have a laptop as my secondary computer, but the desktop has some legacy applications I need to use everyday. The legacy apps don't have keyboard shortcuts, and navigation without a mouse could be impossible (trust me, I've tried). So I got busy and put together this script.
The script includes basic mouse movement, clicking, and a text editing mode (mouse movement is disabled). I threw it together quickly, and haven't done too much testing, but it is SUPER helpful already. Let me know if anyone is interested, and I'll keep this updated and/or add features as requested
I hope to implement a Tray menu with a GUI and some directions later (Like what keyboard shortcuts do), but what I have works for now.
Shortcut List:
Arrow Key - move the mouse in the indicated direction 30 pixels Ctrl + Arrow Key - move the mouse in the indicated direction 100 pixels Ctrl + Shift + Arrow Key - move the mouse in the indicated direction 3 pixels Ctrl + Space - Left click Ctrl + Shift + Space - Right click (because sometimes that special right-click-button doesn't work) Alt + F8 - Toggle mouse movement for text editing / other Alt + F9 - Quit (Version 1.0.0.0 source and executable attached)
Edit: A coworker told me we have spare mice... now don't I feel stupid
KeyboardMouse.au3 KeyboardMouse.exe
-
Fr33b0w reacted to monoceres in Audio Visualization with GDI+ & Bass
Depends
No, but seriously, you can use the source as long as you credit it for me
-
Fr33b0w reacted to LarsJ in UIASpy - UI Automation Spy Tool
The GUI looks like shown in the picture:
It contains a main menu, a treeview in left pane that lists UI Automation elements, a listview in right pane that displays detail information for the selected element, and a splitterbar to adjust the width of the two panes.
Detect element
The "Detect element" main menu is used to detect elements under the mouse with function keys F1 - F4.
See How to topics number 2.
Left pane
The left pane is a treeview that initially lists open programs and windows. Generally, the left pane shows UI Automation elements represented as treeview items.
Right pane
The right pane is a listview that displays detail information for the selected treeview element. The information is grouped into different types of information. Only the relevant information for each type is displayed.
Invalid elements
When a window is closed the elements in UIASpy becomes invalid. But the elements are not deleted in UIASpy and can still be handled and selected in the treeview. Detail information for an element that was calculated before the window was closed can still be seen in the listview.
In this way it's possible for UIASpy to show information for eg. a context menu that is closed as soon as it loses focus.
Listview features
Listview features
Help system
With completion of the Help system, a lot of information has been moved from this post and other posts into the Help system.
Sample code creation
Sample code creation is implemented through the UI element Detail info listview page and through the Sample code main menu.
Sample code creates code snippets based on data in one or more selected rows in the Detail info listview page or based on the clicked Sample code menu item.
UI Automation code is largely based on COM interface objects and thus on the function ObjCreateInterface(), which is one of the advanced functions in AutoIt.
The main purpose of Sample code functionality is to eliminate the complexity of ObjCreateInterface(). Sample code creation either through the Detail info listview page or through the Sample code main menu can create all the interface objects required in UI Automation code.
Another purpose is of course to make it easier and faster to implement code for simple automation tasks. Through Sample code creation, you can more or less create all code in a simple automation task:
Create UI Automation initial code Create condition and find application window Create condition and find control in window Get information about windows and controls Create pattern objects to perform actions Get information related to pattern objects Perform actions with pattern object methods Add a Sleep() statement if necessary Note that the UI element used in sample code is named after the selected element in the treeview.
Also note that both the Sample code menu items and the sections in the Detail info listview page are placed in approximately the order they are used in a simple automation task.
Sample code creation through Detail info listview page
Sample code creation through Sample code main menu
Supported applications
Most browsers including Google Chrome To be able to spy on web content in Google Chrome it's necessary to enable accessibility by entering chrome://accessibility/ in the address bar of a new tab item, and then check the five check boxes that are located in a column in upper left corner down along the left edge. Then the accessibility tab can be closed again. It's a global setting that applies to all open and new tabs until Chrome is closed.
Without accessibility enabled you are only able to investigate the outer elements of Chrome but not web content. Internet Explorer Microsoft Edge Mozilla Firefox Most Microsoft applications and applications developed with Microsoft software including Classic Windows applications based on the standard control library Modern Universal Windows Platform apps like the Windows 10 Calculator Programs implemented through .NET Framework eg. Windows Forms applications Most applications provided by major development companies
Automation issues
Automation issues
How to topics
If UI Automation or the UIASpy tool is new to you, then you should read the How to topics.
Examples
Examples that demonstrates the features of UIASpy:
Automating Notepad. Very detailed example. Automating Notepad - Windows XP Examples about Sample code creation:
Automating Notepad with Sample code - step by step Automating Notepad with Sample code - all at once Chrome - Clicking an extension. Compact summary example. Click Save As... issue in Notepad examples:
Using Expand() instead of Invoke()
Updates
Windows 8, Windows 8.1 and Windows 10 updates
Threads
UI Automation UDFs contains all include files. In Using UI Automation Code in AutoIt you can find and download examples and read information about using UIA code. UI Automation Events is about implementing event handlers and includes GUIs to detect events. IUIAutomation MS framework automate chrome, FF, IE, .... created by junkew August 2013 is the first AutoIt thread on UIA code.
Zip-file
The zip contains source files for UIASpy GUI.
Note that UI Automation UDFs must be installed in the Includes folder.
You need AutoIt 3.3.12 or later. Tested on Windows XP, Windows 7 and Windows 10.
Comments are welcome. Let me know if there are any issues.
UIASpy.7z
-
Fr33b0w reacted to jguinch in Get All Window's Controls
Great job jdelaney !
I made a similar script (without any filter), posted in the french forum : http://www.autoitscript.fr/forum/viewtopic.php?p=74100#p74100
Have a look to it : I used the RegExp method to avoid the use of Array.au3
-
Fr33b0w reacted to Decipher in FileExist - Trigger
I call this work of art the file iteration simplificationer or maybe not.
func _summary($sfile, $isdir) If stringinstr($sfile, "summary.txt") then ;Do Something with that file - $sfile is the fully qualified file path to bla endif if $isdir than ;Do something with it maybe? endif endfunc _FileListEx("C:Software", "_Summary") Func _FileList_Ex($s_Dir = @WorkingDir, $s_Func = "") ConsoleWrite(@CRLF & "!>Root Directory is set to " & $s_Dir & " and will be preserved." & @CRLF) Local $a_Directory_List[2] = ["", $s_Dir] __FileList_Ex($a_Directory_List, $s_Func) ConsoleWrite(@CRLF & "!> Search Finished!" & @CRLF & @CRLF) EndFunc ;==>_FileList_Ex Func __FileList_Ex(ByRef $a_Directory_List, $s_Func) ; Recursive Local $iFile = 0, $sDir = _ArrayPop($a_Directory_List) If Not IsArray($a_Directory_List) Then Return FileChangeDir($sDir) If FileExists($sDir) Then ConsoleWrite(@CRLF & ">Search: " & $sDir) Else Return EndIf Local $h_Files = FileFindFirstFile("*.*") While 1 Local $sFile = FileFindNextFile($h_Files) If @error Then If FileExists($sDir) Then ConsoleWrite(@CRLF & "+> " & $iFile & " File(s)" & @CRLF) If IsArray($a_Directory_List) Then __FileList_Ex($a_Directory_List, $s_Func) ExitLoop EndIf $iFile += 1 $sFile = _PathFull($sFile) Local $Is_Dir = False If StringInStr(FileGetAttrib($sFile), "D") Then _ArrayAdd($a_Directory_List, $sFile) $Is_Dir = True EndIf Call($s_Func, $sFile, $Is_Dir) WEnd FileClose($h_Files) EndFunc ;==>__FileList_Ex
I wrote this recursive function a couple of days ago, maybe you will find it of use + just call the function with your own that way you can forget about the painful loops.
*Edit
You'll need these at the top of your script for it to work.
#include <Array.au3>
#include <File.au3>
I'm really starting to hate Google Chrome....
-
Fr33b0w reacted to JohnOne in FileExist - Trigger
Here is an example of one way you could go about your task.
#include <File.au3> #include <Array.au3> ; just for testing $Path = "c:software" $Summary = "summary.txt" $iCount = 0 ; to check how many folders have been processed $AFolders = _FileListToArray($Path, "*", 2) ; lists all folders to array _ArrayDisplay($AFolders) ; just for testing While 1 ; $AFolders[0] contains the amount of folders found For $i = 1 To $AFolders[0] ; loop through all found folders If FileExists($Path & $AFolders[$i] & $Summary Then ; your summery file exists here ; you can process it, but must delete, or rename it after, or it might find it twice $iCount += 1 ; you processed a file so increase the count EndIf Next If $iCount >= $AFolders[0] Then ;you processed them all ExitLoop ; bail out of loop EndIf WEnd -
Fr33b0w reacted to Subz in [Solved] Delete subfolders from a selected folders
#include <Array.au3> #include <EditConstants.au3> #include <File.au3> #include <GUIConstantsEx.au3> #include <GuiEdit.au3> Global $sFileSelectFolder, $aFolderPaths Global $sKeepDir = "00000000000" Global $sIniFile = @ScriptDir & "\Folders.ini" Global $gLogFile = @ScriptDir & "\Deleted.ini" Global $FileLog = FileOpen($gLogFile, 1) Global $aDirList _FileReadToArray($sIniFile, $aDirList, 0) If @error Then Exit MsgBox(0,"Error","Error Reading Path!") $aDirList[0] = UBound($aDirList) - 1 #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form", 590, 419, 268, 226) GUISetBkColor(0xD7D7D2) $Input = GUICtrlCreateInput("", 16, 50, 385, 20) GUICtrlSetState($Input, $GUI_DISABLE) $Fpath = GUICtrlCreateButton("Path Folder", 400, 48, 89, 25) $Fdelte = GUICtrlCreateButton("Folder Delete", 498, 48, 89, 25) $LogView = GUICtrlCreateButton("Log Viewer", 14, 368, 97, 33) $ExitBut = GUICtrlCreateButton("Close", 497, 368, 89, 33) $g_idEdit = GUICtrlCreateEdit("", 17, 75, 568, 290, BitOr($GUI_SS_DEFAULT_EDIT, $ES_READONLY)) _GUICtrlEdit_SetLimitText($g_idEdit, 64000) _GUICtrlEdit_LineScroll($g_idEdit, 0, _GUICtrlEdit_GetLineCount($g_idEdit)) GUICtrlSetColor($g_idEdit, 0x5B0000) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $ExitBut Exit Case $LogView ShellExecute($gLogFile) Case $Fpath $sFileSelectFolder = FileSelectFolder("Select for your Folder-Source!", "::{7be9d83c-a729-4d97-b5a7-1b7313c39e0a}") If @error Then MsgBox(64, "Warning", "No folder was selected.") Back() Else GUICtrlSetData($Input, $sFileSelectFolder) GUICtrlSetState($Input, $GUI_Disable) EndIf Case $Fdelte $sInput = GUICtrlRead($Input) If FileExists($sInput) = 0 Then ContinueLoop MsgBox(4096, "Error", "Unable to find path: " & $sInput) $aFolderPaths = _FileListToArrayRec($sInput, _ArrayToString($aDirList, "*;", 1, -1, "*;", 0, 0) & "*", 2, 0, 0, 2) If @error Then ContinueLoop MsgBox(4096, "Error", "Error: " & _FileListToArrayError(@error)) For $i = 1 To $aFolderPaths[0] If FileExists($aFolderPaths[$i]) Then $aSubFolders = _FileListToArrayRec($aFolderPaths[$i], "*|" & $sKeepDir & "*", 2, 0, 0, 0) If @error Then ContinueLoop For $j = 1 To $aSubFolders[0] If StringLeft($aSubFolders[$j], StringLen($sKeepDir)) = $sKeepDir Then ContinueLoop ;~ Shouldn't exist as it's already filtered out. $_sLogData = "Delete: " & $aFolderPaths[$i] & "\" & $aSubFolders[$j] _GUICtrlEdit_AppendText ($g_idEdit, $_sLogData & @CRLF) DirRemove($aFolderPaths[$i] & "\" & $aSubFolders[$j], 1) Next EndIf Next FileWrite($FileLog, "Username: " & @UserName & @CRLF & "ProcessDate: " & @MON & "/" & @MDAY & "/" & @YEAR & @CRLF & "Time: " & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF & "====================" & @CRLF & GUICtrlRead($g_idEdit) &@CRLF& "===================="& @CRLF) MsgBox(0,"Completed","Done Processing!") Back() EndSwitch WEnd Func Back() Return EndFunc Func _FileListToArrayError($iError) Local $sError Switch $iError Case 1 $sError = "Path not found or invalid" Case 2 $sError = "Invalid Include parameter" Case 3 $sError = "Invalid Exclude parameter" Case 4 $sError = "Invalid Exclude_Folders parameter" Case 5 $sError = "Invalid $iReturn parameter" Case 6 $sError = "Invalid $iRecur parameter" Case 7 $sError = "Invalid $iSort parameter" Case 8 $sError = "Invalid $iReturnPath parameter" Case 9 $sError = "No files/folders found" Case Else $sError = "Unknown" EndSwitch Return $sError EndFunc
-
Fr33b0w reacted to Subz in Script help with Copy UDF - (Moved)
At first glance it doesn't appear you have used $Copy = 0, so it keeps copying.
-
Fr33b0w reacted to mikell in AutoIT - Check if the values or some of the values from an array are also in another array
An other way could be Scripting.Dictionary
;Local $sAlphabet = "ABCDEFGHIJKLMOPQRSTUVWXYZ" Local $sAlphabet = "ABCDEFGHIJKL" $aAlphabet = StringSplit($sAlphabet, "", 2) Local $sWord = "Hello" $aWord = StringSplit($sWord, "", 2) Local $sdAlphabet = ObjCreate("Scripting.Dictionary"), $count $sdAlphabet.CompareMode = 1 ; case insensitive For $i In $aAlphabet $sdAlphabet.Item($i) ; populate the dictionary Next For $i In $aWord If $sdAlphabet.Exists($i) Then $count += 1 ; then check Next Msgbox(0,"", $count & " values out of " & UBound($aWord) & " from $aWord exist in $aAlphabet")
-
Fr33b0w reacted to Malkey in AutoIT - Check if the values or some of the values from an array are also in another array
In this example:-
The function IsArray1SomeInArray2() answers your first question of post #1.
The function IsArray1InArray2() answers your second question of post #1.
An optional case sensitivity parameter is added to answer one of my questions.
#include <Array.au3> Local $sAlphabet = "ABCDEFGHIJKLMOPQRSTUVWXYZ" $aAlphabet = StringSplit($sAlphabet, "", 2) Local $sWord = "hello" ; "HELLO" ; "Hello" ; $aWord = StringSplit($sWord, "", 2) MsgBox(0, "IsArray1SomeInArray2()", "One or more of the elements of Array1" & (IsArray1SomeInArray2($aWord, $aAlphabet, 0) ? " are in " : " are NOT in ") & "Array2") MsgBox(0, "IsArray1InArray2()", "All the elements of Array1" & (IsArray1InArray2($aWord, $aAlphabet, 0) ? " are in " : " are NOT in ") & "Array2") ; Checks if some of the values from array1 ($word) are also in the array2 ($alphabet); also, ; Checks if some of the values from array1 ($alphabet) are also in the array2 ($word). Func IsArray1SomeInArray2($Array1, $Array2, $iCase = 0) ; $iCase = 0 (case insensitive, "h" = "H") $Array1 = _ArrayUnique($Array1, 0, 0, $iCase, $ARRAYUNIQUE_NOCOUNT) $Array2 = _ArrayUnique($Array2, 0, 0, $iCase, $ARRAYUNIQUE_NOCOUNT) Return UBound(StringRegExp(_ArrayToString($Array2), ($iCase ? "" : "(?i)") & _ArrayToString($Array1), 3)) > 0 EndFunc ;==>IsArray1SomeInArray2 ; Checks if all of the values from array1 ($word) are also in the array2 ($alphabet) Func IsArray1InArray2($Array1, $Array2, $iCase = 0) $Array1 = _ArrayUnique($Array1, 0, 0, $iCase, $ARRAYUNIQUE_NOCOUNT) $a = StringRegExp(_ArrayToString($Array2), ($iCase ? "" : "(?i)") & _ArrayToString($Array1), 3) Return UBound($Array1) = UBound($a) EndFunc ;==>IsArray1InArray2 If you do not understand something in either function, I suggest you use as many ConsoleWrite( [Insert variable here] & @CRLF)'s as needed, together with AutoIt's help file. Just as I have done, do, and will do. In SciTE, I use "cw ", that is, "cw" followed by a space - a shortcut.
-
Fr33b0w reacted to Melba23 in Marquee UDF - New release 13 Jan 2019
New version - 13 Jan 2019
- Added: 2 new functions to hide/show and existing marquee.
New UDF and example script in zip format: Marquee.zip
As always, ready for compliments and/or complaints!
M23
-
Fr33b0w reacted to Dhilip89 in NetFlare Web Server (Version 0.3)
What is NetFlare Web Server?
NetFlare is a standalone web server written in pure AutoIt3 with some features:
Virtual Hosts Server-side scripting For testing virtual host capability, editing etchosts file is required in most cases.
File: C:WindowsSystem32driversetchosts
127.0.0.1 this.is.my.dom 127.0.0.1 private.mycompany.com Souce code (Daemon Main):
#include "./Lib/Net/Http/HttpServer.au3" #include "./Lib/IO/Console.au3" _Main() Func _Main() HttpServer_SetPort(80) HttpServer_RegisterHost("this.is.my.dom") HttpServer_RegisterHost("private.mycompany.com", @ScriptDir & "\WebRoot\custompath\deeper\private.mycompany.com") ConsoleWrite("NetFlare Web Server 0.2, By Dhilip89" & @CRLF & @CRLF) ConsoleWrite("Registered virtual hosts: " & @CRLF) $HostList = HttpServer_GetRegisteredHosts() For $i = 0 To HttpServer_CountRegisteredHosts() - 1 ConsoleWrite("[" & $i+1 & "] " & $HostList[$i] & @CRLF) Next HttpServer_Start() ConsoleWrite(@CRLF & "Server is running..." & @CRLF) While 1 Sleep(1000) WEnd EndFunc -
Screenshots (0.2):
Screenshots (0.3):
Animated GIF (Stress testing, using meta refresh): <= Click or download to view
Download Links:
(Version 0.1): http://www.mediafire.com/download/an1gngni6qeh5x9/NetFlare_v0.1.zip
(Version 0.2): http://www.mediafire.com/download/3a88m1sgyrth48a/NetFlare_v0.2.zip
(Version 0.3): http://www.mediafire.com/download/q3prydlbkygl7jd/NetFlare_v0.3.zip
-
Fr33b0w reacted to caramen in Project: illogic - the illogical scrambler (a customizable word scrambler)
#include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <Array.au3> ;You extract a string into a variable. $Str = "ABC" ;You split each character from that string. $Arr = StringSplit ( $str , "" ) ;Let's check what do we got. _ArrayDisplay ($Arr) ;Now you add the wanted charactere into your splited string. ;This extra line is not needed it will replace the index 0 from our array so we're not confuse with the number 3 $Arr[0] = "" ;Let's say we want to be able to use 2 methode Global $UsedMethode = 1 ;We declare our metode in the global scope ;that will be userfull if we do a custom function with it so the value "1" will be readable inside it. ;For your understanding i'll use numbers so we can see easy what happening in our string. Local $Methode1Array [10]= [1111,2222,3333,4444,5555,6666,7777,8888,9999] Local $Methode0Array = ["9999","8888","7777","6666","5555","4444","3333","2222","1111"] $NewString = "" If $UsedMethode = 1 Then $Raws = UBound ($Arr) ;"ABC" = 3 Lines ;One solution is to make a for loop to loop on the Raws number that will allow your script to work same way even with different amount of charactere in our strings. For $i = 1 to $Raws Step 1 ;$Raws = 3 $NewString = $NewString & $Arr[$i-1] & $Methode1Array[$i-1] Next ElseIf $UsedMethode = 0 Then $Raws = UBound ($Arr) ;"ABC" = 3 Lines For $i = 0 to $Raws Step 1 ;$Raws = 3 $NewString =$NewString & $Arr[$i] & $Methode0Array [$i-1] Next EndIf ;Or ;If $UsedMethode = 1 Then ;Else ;EndIf ;Now let's try this code $usedMethode = 1 $NewString = "" ; We reset result anyway before new generation If $UsedMethode = 1 Then $Raws = UBound ($Arr) ;"ABC" = 3 Lines For $i = 1 to $Raws Step 1 ;$Arr = 3 $NewString =$NewString & $Arr[$i-1] & $Methode1Array [$i-1] Next ElseIf $UsedMethode = 0 Then $Raws = UBound ($Arr) ;"ABC" = 3 Lines For $i = 1 to $Raws Step 1 ;$Arr = 3 $NewString =$NewString & $Arr[$i-1] & $Methode0Array [$i-1] Next EndIf ;We check our string with methode 1 : MsgBox (0 , "NewString Methode1" , $NewString ) $usedMethode = 0 $NewString = "" ; We reset result anyway before new generation If $UsedMethode = 1 Then $Raws = UBound ($Arr) ;"ABC" = 3 Lines For $i = 1 to $Raws Step 1 ;$Arr = 3 $NewString =$NewString & $Arr[$i-1] & $Methode1Array [$i-1] Next ElseIf $UsedMethode = 0 Then $Raws = UBound ($Arr) ;"ABC" = 3 Lines For $i = 1 to $Raws Step 1 ;$Arr = 3 $NewString =$NewString & $Arr[$i-1] & $Methode0Array [$i-1] Next EndIf ;We check our string with methode 0 : MsgBox (0 , "NewString Methode0" , $NewString ) I did it fast the simple way for me.
There is 50 possibility to do that in different way.
Now i looked further, and there is a problem with this line.
$NewString =$NewString & $Arr[$i-1] & $Methode1Array [$i-1] I am not checking how much time i can loop $Methode1Array [$i-1]
Becose if i leave the code like that after 10 loops we will have $Methode1Array [-1]
And out array dont have an index with the value -1 how can we do ?
Answer in my next post.
-
Fr33b0w reacted to Danp2 in [(UN)SOLVED] Count how many tabs are open in firefox
You had a problem in your _FFTabClose line, but otherwise looks fine to me. Try running the following in Scite and post the complete results from the output window --
#Include <FF.au3> _FFConnect() Sleep(2000) If _FFIsConnected() Then $tabs=_FFGetLength("tabs") ConsoleWrite("$tabs=" & $tabs & @CRLF) If $tabs > 4 Then _FFTabClose("last", 'key') EndIf EndIf
-
Fr33b0w reacted to FrancescoDiMuro in How to pass parameters from xml to auto it script? - (Moved)
@Sankesh
You can compile your executable as you wish, which you can then copy wherever you want.
You don't need to have AutoIt installed on every VM; you just need it on your development one