Leaderboard
Popular Content
Showing content with the highest reputation on 12/09/2016 in all areas
-
- _____ _____ _ _ - |_ _|___ ___ ___ _ _| __|___ ___|_|___| |_ - | | | -_| -_| | | |__ | _| _| | . | _| - |_| |___|___|_|_|_ |_____|___|_| |_| _|_| - By TarreTarreTarre|___|Build '1.0.0' |_| + F5 = Run script + F6 = Build 'AU3' + F7 = Build 'EXE' + F8 = Options GUI + F10 = Exit TeenyScript All example code and documentation moved to: http://teenyscript.tarre.nu/documentation Official Github repo: http://github.com/tarreislam/teenyscript F.A.Q Q: What is TeenyScript? A: TeenyScript is a Superset of AutoIt which makes it more advanced Q: How does it work? A: TeenyScript code are parsed into native AutoiT code Q: Does it depend on anything else than AutoIt? A: Just one dependency, that is AutoitObject, the best UDF ever created for AutoIt, besides that, only Native AutoIt is used Features "Anonymous" functions Endless scope nesting OOP (powered by AutoitObject) User-friendly integration Powerful macros Namespaces Lists Project support, for easy deployment Userfriendly GUI for userfriendly Tasks for the Userfriendly person And much more To come You decide, I am happy to do requests! Install and Update TeenyScript HOW TO GET STARTED Run TeenyScript.au3 Now this should see something like this in your console Code Press F8 and navigate to the misc tab to install SciTE calltips Run \ Build \ Compile How to run with Sublime Text Here is some examples of TeenyScript code ;Basic List usage $Example_A = Func() ; Create a list Local $myList = { 'Name': 'Tarre' } ; Add \ Change data on $MyList $myList{'Age'} = 25 ; Create MySecondList Local $MySecondList = { "Name" => "John", "Age" => "00" } ; Using variable instead of a string Local $KeyName = "Age" Local $KeyVal = 1337 $MySecondList{$KeyName} = $KeyVal ; You may also pass lists to lists. however this has to be done in this fashion. Local $oList = {'myList': $myList, 'mySecondList' => $MySecondList} ; Return the objects Return $oList EndFunc();call the function on the variable ; Loop through list and print their values $Example_B = Func() Local $MyList = {'A': 'Hello FROM A', 'B': 'Hello FROM B', 'C': 'Hello FROM C'} Local $aNames = ['A', 'B', 'C'] For $i = 0 To UBound($aNames) -1 MsgBox(0,0,$myList{$aNames[$i]}) Next EndFunc #MAIN MsgBox(0,"Example A 1", $Example_A.myList.Name) MsgBox(0,"Example A 2", $Example_A.myList.Age) MsgBox(0,"Example A 3", $Example_A.mySecondList.Name) MsgBox(0,"Example A 4", $Example_A.mySecondList.Age) $Example_B(); Execute examble B Here is a non class nested function calculator example (calculator.ts.au3) $calculator = Func($a, $and, $b) $division = Func($a, $b) if Not $a or Not $b Then Return "Error dividing 0" EndIf Return $a/$b EndFunc Switch $and Case '+' Return $a + $b Case '-' Return $a - $b Case '/' Return $division($a, $b) Case '*' Return $a * $b EndSwitch Return "Unkown attribute "&$and EndFunc #MAIN ConsoleWrite($calculator(25, '*', 25)&@CRLF) ConsoleWrite($calculator(25, '/', 0) & @CRLF) ConsoleWrite($calculator(1, '^', 2) & @CRLF) teeny-script.zip (OLD) TeenyScript beta2.zip (OLD) teeny-script Beta 4.zip (OLD) teeny-script Beta 5.zip (OLD) teeny-script BETA 6.zip (OLD) TeenyScript Beta 7.zip (OLD) teeny-script Beta 8.zip (OLD) TeenyScript-master 1.0.0.zip (OLD) TeenyScript-1.1.0.zip (OLD) TeenyScript-1.2.0.zip (OLD) TeenyScript-2.0.0.zip (OLRD, Release notes) TeenyScript-2.1.3.zip (Newest 2016-09-16, Release notes)1 point
-
Hi, i think, that many scripts exist to compare arrays or strings. In my version i use object "System.Collections.ArrayList", that gives a good performances for great sets. Test it and form your own opinion. Explanation you find in function-header. EDIT 14.10.2008 - now using Default and Opt("GUIDataSeparatorChar") for $Delim - fixed a bug by using @CRLF as separator #include <array.au3> Local $1 = '1,1,2,3,3,3,4,4,5,6,7' Local $2[10] = ['5','5','5','8','8','9','12','12','3','1'] Local $ret = _GetIntersection($1, $2, 0, ',') If IsArray($ret) Then _ArrayDisplay($ret) $ret = _GetIntersection($1, $2, 1, ',') If IsArray($ret) Then _ArrayDisplay($ret) ;================================================================================================== ; Function Name: _GetIntersection($Set1, $Set2 [, $GetAll=0 [, $Delim=Default]]) ; Description:: Detect from 2 sets ; - Intersection (elements are contains in both sets) ; - Difference 1 (elements are contains only in $Set1) ; - Difference 2 (elements are contains only in $Set2) ; Parameter(s): $Set1 set 1 (1D-array or delimited string) ; $Set2 set 2 (1D-array or delimited string) ; optional: $GetAll 0 - only one occurence of every different element are shown (Default) ; 1 - all elements of differences are shown ; optional: $Delim Delimiter for strings (Default use the separator character set by Opt("GUIDataSeparatorChar") ) ; Return Value(s): Succes 2D-array [i][0]=Intersection ; [i][1]=Difference 1 ; [i][2]=Difference 2 ; Failure -1 @error set, that was given as array, is'nt 1D-array ; Note: Comparison is case-sensitiv! - i.e. Number 9 is different to string '9'! ; Author(s): BugFix (bugfix@autoit.de) ;================================================================================================== Func _GetIntersection(ByRef $Set1, ByRef $Set2, $GetAll=0, $Delim=Default) Local $o1 = ObjCreate("System.Collections.ArrayList") Local $o2 = ObjCreate("System.Collections.ArrayList") Local $oUnion = ObjCreate("System.Collections.ArrayList") Local $oDiff1 = ObjCreate("System.Collections.ArrayList") Local $oDiff2 = ObjCreate("System.Collections.ArrayList") Local $tmp, $i If $GetAll <> 1 Then $GetAll = 0 If $Delim = Default Then $Delim = Opt("GUIDataSeparatorChar") If Not IsArray($Set1) Then If Not StringInStr($Set1, $Delim) Then $o1.Add($Set1) Else $tmp = StringSplit($Set1, $Delim, 1) For $i = 1 To UBound($tmp) -1 $o1.Add($tmp[$i]) Next EndIf Else If UBound($Set1, 0) > 1 Then Return SetError(1,0,-1) For $i = 0 To UBound($Set1) -1 $o1.Add($Set1[$i]) Next EndIf If Not IsArray($Set2) Then If Not StringInStr($Set2, $Delim) Then $o2.Add($Set2) Else $tmp = StringSplit($Set2, $Delim, 1) For $i = 1 To UBound($tmp) -1 $o2.Add($tmp[$i]) Next EndIf Else If UBound($Set2, 0) > 1 Then Return SetError(1,0,-1) For $i = 0 To UBound($Set2) -1 $o2.Add($Set2[$i]) Next EndIf For $tmp In $o1 If $o2.Contains($tmp) And Not $oUnion.Contains($tmp) Then $oUnion.Add($tmp) Next For $tmp In $o2 If $o1.Contains($tmp) And Not $oUnion.Contains($tmp) Then $oUnion.Add($tmp) Next For $tmp In $o1 If $GetAll Then If Not $oUnion.Contains($tmp) Then $oDiff1.Add($tmp) Else If Not $oUnion.Contains($tmp) And Not $oDiff1.Contains($tmp) Then $oDiff1.Add($tmp) EndIf Next For $tmp In $o2 If $GetAll Then If Not $oUnion.Contains($tmp) Then $oDiff2.Add($tmp) Else If Not $oUnion.Contains($tmp) And Not $oDiff2.Contains($tmp) Then $oDiff2.Add($tmp) EndIf Next Local $UBound[3] = [$oDiff1.Count,$oDiff2.Count,$oUnion.Count], $max = 1 For $i = 0 To UBound($UBound) -1 If $UBound[$i] > $max Then $max = $UBound[$i] Next Local $aOut[$max][3] If $oUnion.Count > 0 Then $i = 0 For $tmp In $oUnion $aOut[$i][0] = $tmp $i += 1 Next EndIf If $oDiff1.Count > 0 Then $i = 0 For $tmp In $oDiff1 $aOut[$i][1] = $tmp $i += 1 Next EndIf If $oDiff2.Count > 0 Then $i = 0 For $tmp In $oDiff2 $aOut[$i][2] = $tmp $i += 1 Next EndIf Return $aOut EndFunc ;==>_GetIntersection_GetIntersection.au31 point
-
_IsPressed in a loop + abnormal conditions?
misrepresentative reacted to BrewManNH for a topic
The only alternative that would work is the WinAPI_GetAsyncState, but it's just the same as using _IsPressed except it's written to use the VK* key constants.1 point -
_IsPressed in a loop + abnormal conditions?
misrepresentative reacted to BrewManNH for a topic
@misrepresentative If you're script has a GUI, then you can use accelerator keys, they are only active when the GUI is active. If you're just monitoring for key presses using _IsPressed or _WinAPI_GetAsyncKetState then you're at the whim of the timing available to the script to read from the keyboard, this will be CPU dependent and also depends on whatever else might be running at the time. BTW, you can block any/all keyboard input very easily without ever using HotKeys, so the prohibition you have against them is ludicrous.1 point -
_IsPressed in a loop + abnormal conditions?
misrepresentative reacted to Jos for a topic
Ok, I am going to exit this conversation as it's not making much sense to me and there are way better ways to accomplish that but that isn't going to be discussed here as that can be used for malicious purposes. Good luck with your scripting! Jos1 point -
_IsPressed in a loop + abnormal conditions?
misrepresentative reacted to Jos for a topic
So back to my original question: Why? What is the difference? Jos1 point -
_IsPressed in a loop + abnormal conditions?
misrepresentative reacted to Bert for a topic
Hotkeyset is dangerous if and ONLY if you have a blanket hotkeyset that is active as long as the script is running. The trick is have in your loop on the top level this: sleep (100 if winactive then call a function that turns on the hotkeyset a sub loop after that in the function that will look for what you want AND if the window is still active or not. If the window you have the hotkeyset is no longer active - turn off the hotkeyset This type of setup is very common in many applications that has keys set to do specific functions. For example pressing the F3 key in Firefox opens the text search function.1 point -
Excel Macros and Errors
Faedien reacted to JLogan3o13 for a topic
When you cancel out are you closing Excel altogether? That error is telling you the $oExcel object (the Excel application object) no longer exists.1 point -
The index isn't returning in my trials on subitems > 0, which seems to be by design per the structure description. ;Rootx #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GuiStatusBar.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <File.au3> #include <GuiImageList.au3> #include <MsgBoxConstants.au3> #include <GuiListView.au3> Global $idListview #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 450, 192, 124) $Button1 = GUICtrlCreateButton("Button1", 16, 16, 75, 25) ;$idListview = GUICtrlCreateListView("", 16, 56, 586, 358, BitOR($GUI_SS_DEFAULT_LISTVIEW,$LVS_SORTASCENDING,$LVS_AUTOARRANGE,$LVS_SINGLESEL), BitOR($WS_EX_CLIENTEDGE,$LVS_EX_GRIDLINES)) $idListview = GUICtrlCreateListView("", 16, 56, 586, 358, BitOR($GUI_SS_DEFAULT_LISTVIEW,$LVS_SORTASCENDING,$LVS_AUTOARRANGE, $LVS_SHOWSELALWAYS), BitOR($WS_EX_CLIENTEDGE,$LVS_EX_GRIDLINES)) _GUICtrlListView_InsertColumn($idListview, 0, "Column 1", 100) _GUICtrlListView_InsertColumn($idListview, 1, "Column 2", 100) _GUICtrlListView_InsertColumn($idListview, 2, "Column 3", 100) _GUICtrlListView_AddItem($idListview, "Row 1: Col 1", 0) _GUICtrlListView_AddSubItem($idListview, 0, "Row 1: Col 2", 1, 1) _GUICtrlListView_AddSubItem($idListview, 0, "Row 1: Col 3", 2, 1) _GUICtrlListView_AddItem($idListview, "Row 2: Col 1", 1) _GUICtrlListView_AddSubItem($idListview, 1, "Row 2: Col 2", 1, 1) _GUICtrlListView_AddSubItem($idListview, 1, "Row 2: Col 3", 2,1) _GUICtrlListView_AddItem($idListview, "Row 3: Col 1", 2) _GUICtrlListView_AddSubItem($idListview, 2, "Row 3: Col 2",1, 1) _GUICtrlListView_AddSubItem($idListview, 2, "Row 3: Col 3",2, 1) $StatusBar1 = _GUICtrlStatusBar_Create($Form1) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 EndSwitch WEnd Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo, $hWndListView = $idListview If Not IsHWnd($idListview) Then $hWndListView = GUICtrlGetHandle($idListview) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $LVN_COLUMNCLICK Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) Local $iCol = DllStructGetData($tInfo, "SubItem") ;Debug ConsoleWrite("Column clicked: " & $iCol & @CRLF) Case $NM_CLICK $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) $iRow = DllStructGetData($tInfo, "Index") $iCol = DllStructGetData($tInfo, "SubItem") ConsoleWrite($iRow & @TAB & $iCol & @CRLF) ;~ $aHit = _GUICtrlListView_SubItemHitTest($hWndFrom) ;~ $LVEIP_Item = $aHit[0] ;~ $LVEIP_SubItem = $aHit[1] Local $tItem $tItem = DllStructCreate($tagLVITEM) DllStructSetData($tItem, "Mask", $LVIF_STATE) DllStructSetData($tItem, "Item", $iRow) DllStructSetData($tItem, "SubItem", $iCol) DllStructSetData($tItem, "State", $LVIS_SELECTED) DllStructSetData($tItem, "StateMask", $LVIS_SELECTED) _GUICtrlListView_SetItemEx($hWndFrom, $tItem) ;ConsoleWrite("Selected Cell " & _GUICtrlListView_GetItemText($idListview,$iRow,$iCol)&@CRLF) EndSwitch EndSwitch EndFunc edit: found this example - be sure to read the next couple posts on that thread for a cosmetic change you may want to incorporate.1 point
-
more direct method to exit explorer gracefully?
misrepresentative reacted to jguinch for a topic
ProcessClose(WinGetProcess ( "[CLASS:Shell_TrayWnd]" ))1 point -
Clicking link in IE table?
SkysLastChance reacted to rootx for a topic
_IETagNameGetCollection Returns a collection object of all elements in the object with the specified TagName or a single element by index1 point -
This line could be written like this with no change in output. $iInt = Int($iInt / $iBase)1 point
-
Hmm my code should have been more specific to remove only the " " and not other possible html special chars Msgbox(0,"", StringRegExpReplace(FileRead("1.txt"), '<.*?>\R?| ', "") )1 point
-
Form Builder beta
argumentum reacted to DjDiabolik for a topic
I thinks this is out ot developing.... koda it's oldest but actually i thinks remain the best solution.......1 point -
Listview flicker on gui resize
argumentum reacted to KaFu for a topic
You're right, it's a system-wide setting. On the other hand I've used it for years now and never had the problem that the state was not reset correctly, as the reset is fired when you let go the border. It might get stuck when your app exits while resizing; for that maybe use an exit function as outlined below. The only risk left then would be if your app crashes / the process is closed while you're resizing. ; http://www.autoitscript.com/forum/topic/55024-ho-to-set-resizing-without-displaying-window-content/#entry417869 ; by Siao #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <Misc.au3> Opt("GUIOnEventMode", 1) Const $SC_MOVE = 0xF010 Const $SC_SIZE = 0xF000 Global $i_DRAGFULLWINDOWS_Current Global $i_DRAGFULLWINDOWS_Initial = _SPI_GETDRAGFULLWINDOWS() OnAutoItExitRegister("_Reset_DRAGFULLWINDOWS") Func _Reset_DRAGFULLWINDOWS() DllCall("user32.dll", "int", "SystemParametersInfo", "int", 37, "int", $i_DRAGFULLWINDOWS_Initial, "ptr", 0, "int", 2) EndFunc ;==>_Reset_DRAGFULLWINDOWS $parent = GUICreate("GUI", 200, 400, -1, -1, $WS_SIZEBOX) ;~ GUIRegisterMsg($WM_ENTERSIZEMOVE, "WM_ENTERSIZEMOVE") GUIRegisterMsg($WM_EXITSIZEMOVE, "WM_EXITSIZEMOVE") GUIRegisterMsg($WM_SYSCOMMAND, "On_WM_SYSCOMMAND") GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $Button = GUICtrlCreateButton("Button", 50, 100, 100, 21) GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd Func On_WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam) Switch BitAND($wParam, 0xFFF0) Case $SC_MOVE, $SC_SIZE ;Const $SPI_SETDRAGFULLWINDOWS = 37 ;Const $SPI_GETDRAGFULLWINDOWS = 38 ;Const SPIF_SENDWININICHANGE = 2 $i_DRAGFULLWINDOWS_Current = _SPI_GETDRAGFULLWINDOWS() DllCall("user32.dll", "int", "SystemParametersInfo", "int", 37, "int", 0, "ptr", 0, "int", 2) EndSwitch EndFunc ;==>On_WM_SYSCOMMAND Func WM_EXITSIZEMOVE() DllCall("user32.dll", "int", "SystemParametersInfo", "int", 37, "int", $i_DRAGFULLWINDOWS_Current, "ptr", 0, "int", 2) EndFunc ;==>WM_EXITSIZEMOVE Func _Exit() Exit EndFunc ;==>_Exit Func _SPI_GETDRAGFULLWINDOWS() $tBool = DllStructCreate("int") DllCall("user32.dll", "int", "SystemParametersInfo", "int", 38, "int", 0, "ptr", DllStructGetPtr($tBool), "int", 0) Return DllStructGetData($tBool, 1) EndFunc ;==>_SPI_GETDRAGFULLWINDOWS1 point