Leaderboard
Popular Content
Showing content with the highest reputation on 07/12/2017 in all areas
-
this is a known issue and will not be fixed. see Trac ticket. workaround: use only 32x32 icons. and in this case, it will make the GUI look a lot nicer. just make the buttons slightly smaller. and in general, try to use a more consistent icon design for grouped buttons of similar functionality.2 points
-
Drag and Drop with Explorer
davidacrozier reacted to ProgAndy for a topic
Here i have created an example for Drag and Drop interaction with the Windows Explorer. It uses my COM UDFs including a modified MemoryDLLCall from Ward. I hope i'll find the time to extend the IDataObject-interface for more functionality. The download is located here: DoDragDrop and COM in AutoIt Downloads: //Edit: I forgot to mention that this will only work on Win XP and newer. I was too lazy to implement an IEnumFORMATETC interface and used SHCreateStdEnumFmtEtc instead. //Edit2: This UDF makes it possible to Drag a file from an AutoIt-GUI to the Explorer or other drop-enabled applications.1 point -
Rotate animation
Parsix reacted to haijie1223 for a topic
#NoTrayIcon #RequireAdmin #My QQ No: 29535065 #QQ group: 477266297 #include <GDIPlus.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Global $iSleepTime = 80 Global $hGUI = GUICreate("GDI+旋转动画", 400, 280) Global $Pic_Animation = GUICtrlCreatePic('', 5, 5, 256, 256) Global $Btn_Type1 = GUICtrlCreateButton('旋转方式一', 275, 35, 100, 30) Global $Btn_Type2 = GUICtrlCreateButton('旋转方式二', 275, 85, 100, 30) Global $Btn_Type3 = GUICtrlCreateButton('旋转方式三', 275, 135, 100, 30) Global $Slider_Time = GUICtrlCreateSlider(275, 185, 100, 45) GUICtrlSetLimit($Slider_Time, 500, 50) GUISetState() GUISetIcon('shell32.dll',322,$hGUI) GUISetOnEvent(-3, '_GuiEvent') GUICtrlSetOnEvent($Btn_Type1, '_GuiEvent') GUICtrlSetOnEvent($Btn_Type2, '_GuiEvent') GUICtrlSetOnEvent($Btn_Type3, '_GuiEvent') GUICtrlSetOnEvent($Slider_Time, '_GuiEvent') _AnimationInit(ControlGetHandle($hGUI, '', $Pic_Animation), 1) _GDIPlus_Startup() ; While 1 Sleep($iSleepTime) _NextFlash() WEnd Func _GuiEvent() Switch @GUI_CtrlId Case -3 _DeleteCache() Exit Case $Btn_Type1 _ResetAniType(1, 2) Case $Btn_Type2 _ResetAniType(2, 0) Case $Btn_Type3 _ResetAniType(3, 0) Case $Slider_Time $iSleepTime=GUICtrlRead($Slider_Time) EndSwitch EndFunc ;==>_GuiEvent Func _AnimationInit($hHwd, $SpaceSec) Global $m_hWnd = $hHwd Global $m_nWidth, $m_nHeight Global $m_AnimationIndex = 0, $m_AnimationType = 0, $m_AnimationCount = 12 Global $m_ItemSize, $m_MarginAngle Global $m_hCacheDC, $m_hCacheBitmap, $m_hCacheOldBitmap Global $m_Rect = DllStructCreate($tagRECT) Global $m_ColorBack = _WinAPI_GetSysColor($COLOR_BTNFACE) Global $m_ColorBasic[2] = [0x808080, 0xC0C0C0] Global $m_ColorFore1 = [0x1FF4FB, 0x07F98C, 0x91A804, 0xCC9302, 0xAF5801, 0x9C426B, 0x9744A7, 0x9841E4, 0x241BEE, 0x2472F5, 0x2190F4, 0x12C2FF] Global $m_ColorFore2 = [0x34F5FF, 0x3CFDA3, 0xA5B833, 0xD8A733, 0xB67636, 0xAD6988, 0xAD68B9, 0xAC66E9, 0x514AEF, 0x4E8DF5, 0x4BA5FA, 0x3ECEFE] Global $m_AnimationArray[$m_AnimationCount] Local $i For $i = 0 To $m_AnimationCount - 1 $m_AnimationArray[$i] = _AnimationItem() DllStructSetData($m_AnimationArray[$i], 1, _RGB2ARGB($m_ColorBasic[0], 255)) DllStructSetData($m_AnimationArray[$i], 2, _RGB2ARGB($m_ColorBasic[1], 255)) Next _Resize() _ResetAniType($m_AnimationType, $SpaceSec) EndFunc ;==>_AnimationInit Func _RGB2ARGB($RGBColor, $Alpha) Return BitOR(Binary('0x' & Hex($RGBColor, 6)), BitShift($Alpha, -24)) EndFunc ;==>_RGB2ARGB Func _Resize() _DeleteCache() Local $rc = _WinAPI_GetClientRect($m_hWnd) $m_nWidth = DllStructGetData($rc, 3) - DllStructGetData($rc, 1) $m_nHeight = DllStructGetData($rc, 4) - DllStructGetData($rc, 2) If $m_nWidth > $m_nHeight Then DllStructSetData($m_Rect, 3, ($m_nHeight - 10)) Else DllStructSetData($m_Rect, 3, ($m_nWidth - 10)) EndIf ;~ DllStructSetData($m_Rect, 3, ($m_nWidth > $m_nHeight) ? ($m_nHeight - 10) : ($m_nWidth - 10)) DllStructSetData($m_Rect, 4, DllStructGetData($m_Rect, 3)) DllStructSetData($m_Rect, 1, ($m_nWidth - DllStructGetData($m_Rect, 3)) / 2) DllStructSetData($m_Rect, 2, ($m_nHeight - DllStructGetData($m_Rect, 4)) / 2) $m_ItemSize = 20 EndFunc ;==>_Resize Func _ResetAniType($AniType, $SpaceSec = 0) Local $i $m_AnimationIndex = 0 Switch $AniType Case 0 $m_AnimationType = 0 Case 1 $m_AnimationType = 1 Case 2 $m_AnimationType = 2 For $i = 0 To $m_AnimationCount - 1 DllStructSetData($m_AnimationArray[$i], 1, _RGB2ARGB($m_ColorFore1[$i], 255)) DllStructSetData($m_AnimationArray[$i], 2, _RGB2ARGB($m_ColorFore2[$i], 255)) Next Case 3 $m_AnimationType = 3 For $i = 0 To $m_AnimationCount - 1 DllStructSetData($m_AnimationArray[$i], 1, _RGB2ARGB($m_ColorFore1[$i], 255)) DllStructSetData($m_AnimationArray[$i], 2, _RGB2ARGB($m_ColorFore2[$i], 255)) Next Case Else _ResetAniType(0) Return EndSwitch $m_MarginAngle = $SpaceSec If $m_MarginAngle > 10 Then $m_MarginAngle = 10 If $m_MarginAngle < 0 Then $m_MarginAngle = 0 EndFunc ;==>_ResetAniType Func _NextFlash() Local $i Switch $m_AnimationType Case 0 For $i = 0 To $m_AnimationIndex - 1 DllStructSetData($m_AnimationArray[$i], 1, _RGB2ARGB($m_ColorFore1[$i], 255)) DllStructSetData($m_AnimationArray[$i], 2, _RGB2ARGB($m_ColorFore2[$i], 255)) Next $m_AnimationIndex += 1 If ($m_AnimationIndex > $m_AnimationCount) Then $m_AnimationType = 1 $m_AnimationIndex = 0 EndIf Case 1 For $i = 0 To $m_AnimationIndex - 1 DllStructSetData($m_AnimationArray[$i], 1, _RGB2ARGB($m_ColorBasic[0], 255)) DllStructSetData($m_AnimationArray[$i], 2, _RGB2ARGB($m_ColorBasic[1], 255)) Next $m_AnimationIndex += 1 If ($m_AnimationIndex > $m_AnimationCount) Then $m_AnimationType = 0 $m_AnimationIndex = 0 EndIf Case 2 local $item=$m_AnimationArray[11] For $i = 0 To $m_AnimationCount - 2 $m_AnimationArray[$m_AnimationCount - $i - 1] = $m_AnimationArray[$m_AnimationCount - $i - 2] Next $m_AnimationArray[0] = $item Case 3 $m_AnimationIndex = $m_AnimationIndex + 1 If ($m_AnimationIndex > $m_AnimationCount) Then $m_AnimationIndex = 0 EndSwitch _Draw() EndFunc ;==>_NextFlash Func _Draw() Local $hDC = _WinAPI_GetDC($m_hWnd) If $m_hCacheDC = 0 Then $m_hCacheDC = _WinAPI_CreateCompatibleDC($hDC) $m_hCacheBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $m_nWidth, $m_nHeight) $m_hCacheOldBitmap = _WinAPI_SelectObject($m_hCacheDC, $m_hCacheBitmap) EndIf _FillSolidRect($m_hCacheDC, _CRect(0, 0, $m_nWidth, $m_nHeight), $m_ColorBack) _DrawPie($m_hCacheDC) _WinAPI_BitBlt($hDC, 0, 0, $m_nWidth, $m_nHeight, $m_hCacheDC, 0, 0, 0x00CC0020) _WinAPI_ReleaseDC($m_hWnd, $hDC) EndFunc ;==>_Draw Func _CRect($Left, $Top, $Right, $Bottom) Local $Rect = DllStructCreate($tagRECT) DllStructSetData($Rect, 1, $Left) DllStructSetData($Rect, 2, $Top) DllStructSetData($Rect, 3, $Right) DllStructSetData($Rect, 4, $Bottom) Return $Rect EndFunc ;==>_CRect Func _FillSolidRect($hDC, $lpRect, $clr) _WinAPI_SetBkColor($hDC, $clr) _ExtTextOut($hDC, 0, 0, 2, $lpRect, Chr(0), 0, 0) EndFunc ;==>_FillSolidRect Func _DrawPie($hDC) Local $i Local $nStartAngle Local $nSweepAngle Local $pGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC) _GDIPlus_GraphicsSetSmoothingMode($pGraphics, 4) Local $pBrush = _GDIPlus_BrushCreateSolid(_RGB2ARGB(0, 255)) Local $rcOut = DllStructCreate($tagRECT) DllStructSetData($rcOut, 1, DllStructGetData($m_Rect, 1)) DllStructSetData($rcOut, 2, DllStructGetData($m_Rect, 2)) DllStructSetData($rcOut, 3, DllStructGetData($m_Rect, 3)) DllStructSetData($rcOut, 4, DllStructGetData($m_Rect, 4)) Local $rcIn = DllStructCreate($tagRECT) DllStructSetData($rcIn, 1, DllStructGetData($rcOut, 1)) DllStructSetData($rcIn, 2, DllStructGetData($rcOut, 2)) DllStructSetData($rcIn, 3, DllStructGetData($rcOut, 3)) DllStructSetData($rcIn, 4, DllStructGetData($rcOut, 4)) _InflateRectF($rcIn, -1 * $m_ItemSize) $nSweepAngle = 360 / $m_AnimationCount $nStartAngle = -90 For $i = 0 To $m_AnimationCount - 1 _GDIPlus_BrushSetSolidColor($pBrush, DllStructGetData($m_AnimationArray[$i], 1)) _GDIPlus_GraphicsFillPie($pGraphics, DllStructGetData($rcOut, 1), DllStructGetData($rcOut, 2), DllStructGetData($rcOut, 3), DllStructGetData($rcOut, 4), _ $nStartAngle, $nSweepAngle - $m_MarginAngle, $pBrush) $nStartAngle += $nSweepAngle Next $nSweepAngle = 360 / $m_AnimationCount $nStartAngle = -90 For $i = 0 To $m_AnimationCount - 1 _GDIPlus_BrushSetSolidColor($pBrush, DllStructGetData($m_AnimationArray[$i], 2)) _GDIPlus_GraphicsFillPie($pGraphics, DllStructGetData($rcIn, 1), DllStructGetData($rcIn, 2), DllStructGetData($rcIn, 3), DllStructGetData($rcIn, 4), _ $nStartAngle, $nSweepAngle - $m_MarginAngle, $pBrush) $nStartAngle += $nSweepAngle Next If ($m_AnimationType = 3) Then If $m_AnimationIndex > 0 Then $nStartAngle = -90 $nStartAngle = $nStartAngle + $m_AnimationIndex * $nSweepAngle _GDIPlus_BrushSetSolidColor($pBrush, _RGB2ARGB(0xFFFFFF, 150)) _GDIPlus_GraphicsFillPie($pGraphics, DllStructGetData($rcOut, 1), DllStructGetData($rcOut, 2), DllStructGetData($rcOut, 3), DllStructGetData($rcOut, 4), _ $nStartAngle, $nSweepAngle - $m_MarginAngle, $pBrush) EndIf EndIf _InflateRectF($rcIn, -1 * $m_ItemSize) _GDIPlus_BrushSetSolidColor($pBrush, _RGB2ARGB($m_ColorBack, 255)) _GDIPlus_GraphicsFillPie($pGraphics, DllStructGetData($rcIn, 1), DllStructGetData($rcIn, 2), DllStructGetData($rcIn, 3), DllStructGetData($rcIn, 4), 0, 360, $pBrush) _GDIPlus_BrushDispose($pBrush) _GDIPlus_GraphicsDispose($pGraphics) EndFunc ;==>_DrawPie Func _InflateRectF($rc, $dx, $dy = 0) If $dy = 0 Then $dy = $dx DllStructSetData($rc, 1, DllStructGetData($rc, 1) - $dx) DllStructSetData($rc, 2, DllStructGetData($rc, 2) - $dy) DllStructSetData($rc, 3, DllStructGetData($rc, 3) + $dx * 2) DllStructSetData($rc, 4, DllStructGetData($rc, 4) + $dy * 2) EndFunc ;==>_InflateRectF Func _DeleteCache() If $m_hCacheDC <> 0 Then _WinAPI_SelectObject($m_hCacheDC, $m_hCacheOldBitmap) _WinAPI_DeleteObject($m_hCacheBitmap) _WinAPI_DeleteDC($m_hCacheDC) _GDIPlus_Shutdown() $m_hCacheDC = 0 $m_hCacheBitmap = 0 $m_hCacheOldBitmap = 0 EndIf EndFunc ;==>_DeleteCache Func _ExtTextOut($hDC, $x, $y, $wOptions, $lpRect, $lpString, $nCount, $lpDx) If Not IsPtr($lpRect) Then $lpRect=DllStructGetPtr($lpRect) Local $Ret = DllCall('GDI32.dll', 'BOOL', 'ExtTextOutW', 'HANDLE', $hDC, 'INT', $x, 'INT', $y, 'UINT', $wOptions, 'PTR', $lpRect, 'WSTR', $lpString, 'UINT', $nCount, 'INT', $lpDx) If @error Then Return SetError(@error, 0, 0) Return $Ret[0] EndFunc ;==>_ExtTextOut Func _AnimationItem() Return DllStructCreate('INT;INT;') EndFunc ;==>_AnimationItem1 point -
Resolved - Resource Icons
vagabond719 reacted to Neutro for a topic
As explained here you can solve this problem using ResourcesEX.au3 Changes made to your script were using this AutoIt3Wrapper to add icon files: #AutoIt3Wrapper_Res_File_Add=images\unix_vvw_icon.ico, RT_ICON, UNIX, 0 and this function to set the icon in the button when using compiled script: _Resource_SetToCtrlID(-1, 'UNIX', $RT_ICON) You need to put the attached file ResourcesEx.au3 in your AutoIT\include folder for this to work. A working version can be found in the EOR.zip filed joined as well. Enjoy1 point -
Well, your ControlClick() statements are wrong for sure now I look at them. The first 2 parameters should be Title and Text, which are missing! Jos1 point
-
Resolved - Resource Icons
vagabond719 reacted to Neutro for a topic
No it's not working properly Trong The icon size in ressource hacker is 64x64, the icon size in the compiled exe shown in your screenshot is 32x32. If it was working properly the image in each buttons of the software should have the full button size and not just show in the middle as 32x32. I think it's a bug from the GUICtrlSetImage function. Try it out with this code: #Region ;************ Includes ************ #include <GUIConstantsEx.au3> #include <GuiButton.au3> #EndRegion ;************ Includes ************ $test = GUICreate("test", 600, 300) Global $hIcon1 = GUICtrlCreateIcon("", Default, 20, 20, 240, 240) Global $button1 = GUICtrlCreateButton("", 300, 20, 240, 240, $BS_ICON ) GUICtrlSetImage($hIcon1, "shell32.dll", 22) GUICtrlSetImage($button1, "shell32.dll", 22) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd When GuiCtrlSetImage is used on an icon it uses the biggest size possible whereas when used on a button it uses 32x32 or 16x16 only.1 point -
@Trong Nop. Like this: https://www.autoitscript.com/wiki/Best_coding_practices Saludos1 point
-
You're welcome Locked or not it's never a good idea to use control interactions as it's not very reliable. Always try to find a way to do what you want with a reliable method (command line, file copy, ect...). Use control interaction as a last resort if you really have no other way to do it1 point
-
Hello Mag91 and welcome to the AutoIT forums You can use GUICtrlRead to check if a checkbox is checked or not. Here is the related code: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Test", 237, 142, 230, 134) $Button1 = GUICtrlCreateButton("Start", 16, 96, 201, 33) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 16, 16, 193, 25) $Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 16, 40, 193, 25) $Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 16, 64, 177, 33) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Run("notepad.exe") Local $hWnd = WinWait("[CLASS:Notepad]", "", 2) WinMove($hWnd, "", 1177, 0, 743, 1040) if GUICtrlRead($Checkbox1) = $GUI_CHECKED then send("A") if GUICtrlRead($Checkbox2) = $GUI_CHECKED then send("B") if GUICtrlRead($Checkbox3) = $GUI_CHECKED then send("C") EndSwitch WEnd Enjoy1 point
-
Sending Command According to ComboBox
Xiengsaephan reacted to quickbeam for a topic
You are indenting the if-then statements as if they are nested. Is that true? As written, I don't see a problem but if those statements are nested, your "After S" test would never be reached because it would first fail the "After A" test. Hmm, I think what you're saying is that the 4 lines in the second part are actually intermixed in the code above. In that case, maybe you need to add short delays so the OS has time to pick up the key presses (a space is like any other key, and there's debounce going on to eliminate double-reads and such, so a timeout is needed before the next key comes along).1 point -
Download and read file help
swatsapkraz reacted to Neutro for a topic
Hello swatsapkraz, What you want to do can be translated to search for "1" in the file and proceed if found, otherwise do nothing (searching for 0 is not needed if 1 is not found). I created 2 dropbox links, the first one links to a file which contains 1 and the other do not: https://www.dropbox.com/s/c27k3gv5oanhjvc/file_to_proceed.txt?dl=1 https://www.dropbox.com/s/g76mnemzg2lai4z/file_to_NOT_proceed.txt?dl=1 Use the following code to download the above files (change $file_url with the link you want to test) and check if they need to be proceeded or not: #include <File.au3> $file_url = "https://www.dropbox.com/s/g76mnemzg2lai4z/file_to_NOT_proceed.txt?dl=1" ;downloading the file $download_result = InetGet($file_url, @scriptdir & "\downloaded_file.txt", 3) if $download_result <> 0 Then ;if the download worked ;checking if there is 1 or 0 inside the file $file_content = "" _FileReadToArray(@scriptdir & "\downloaded_file.txt", $file_content) if IsArray($file_content) then ;if the file is not empty we search inside for 1 $search_for_number_one = _ArraySearch($file_content, "1", "", "", "", 1) if $search_for_number_one <> -1 then ; the number 1 has been found inside the file so it must be proceeded msgbox("","","file contains 1 and must be proceeded") else msgbox("","","file does NOT contain 1 and must NOT be proceeded") EndIf EndIf endif Enjoy1 point -
Get per-monitor DPI scaling factor
footswitch reacted to InnI for a topic
#include <WinAPIGdi.au3> ; enum _PROCESS_DPI_AWARENESS Global Const $PROCESS_DPI_UNAWARE = 0 Global Const $PROCESS_SYSTEM_DPI_AWARE = 1 Global Const $PROCESS_PER_MONITOR_DPI_AWARE = 2 ; enum _MONITOR_DPI_TYPE Global Const $MDT_EFFECTIVE_DPI = 0 Global Const $MDT_ANGULAR_DPI = 1 Global Const $MDT_RAW_DPI = 2 Global Const $MDT_DEFAULT = $MDT_EFFECTIVE_DPI _WinAPI_SetProcessDpiAwareness($PROCESS_PER_MONITOR_DPI_AWARE) $aMonitors = _WinAPI_EnumDisplayMonitors() If Not IsArray($aMonitors) Then Exit MsgBox(0, "", "EnumDisplayMonitors error") For $i = 1 To $aMonitors[0][0] $aDPI = _WinAPI_GetDpiForMonitor($aMonitors[$i][0], $MDT_DEFAULT) $_ = IsArray($aDPI) ? MsgBox(0, "", $aDPI[0] & ":" & $aDPI[1]) : MsgBox(0, "", "error") Next Func _WinAPI_SetProcessDpiAwareness($DPIAware) DllCall("Shcore.dll", "long", "SetProcessDpiAwareness", "int", $DPIAware) If @error Then Return SetError(1, 0, 0) EndFunc Func _WinAPI_GetDpiForMonitor($hMonitor, $dpiType) Local $X, $Y $aRet = DllCall("Shcore.dll", "long", "GetDpiForMonitor", "long", $hMonitor, "int", $dpiType, "uint*", $X, "uint*", $Y) If @error Or Not IsArray($aRet) Then Return SetError(1, 0, 0) Local $aDPI[2] = [$aRet[3],$aRet[4]] Return $aDPI EndFunc1 point -
Hello r0ash and welcome to the AutoIT forums Skype contacts are linked to the skype account they were added to. Skype accounts details including contacts are saved in Microsoft's cloud. This means if the computer where skype is installed is completely destroyed, just setup a new computer, install skype, log in with the same skype user ID and password and the contacts will still be there. So why do you try to backup the contacts manually? Anyway if you still need to do it you just have to backup the file main.db located in %appdata%/roaming/skype/<user skype ID>/main.db It contains all contacts and all chat log. You can view what's inside with http://sqlitebrowser.org/ or any other SQL lite database viewer. Here is an example of how to backup the main.db file automaticly with AutoIT: #include <File.au3> $save_location = "C:\" ;change this to anywhere you want the file to be saved ; find the main.db in the user profile $database_filepath = _FileListToArrayrec(@UserProfileDir & "\AppData\roaming\skype", "main.db", 5, 1) if IsArray($database_filepath) Then ;if the file main.db was found then we save it $database_filepath = @UserProfileDir & "\AppData\roaming\skype\" & $database_filepath[1] filecopy($database_filepath, $save_location, 1) EndIf PS: When a computer is locked, any GUI interaction like ControlSend() will most likely fail because the Windows lock is kinda made to disable them as a security system. So it's better to use another way when you want to automate things (like the example above).1 point
-
Detect and Switch Monitor Orientation Between Portrait and Landscape
argumentum reacted to EmilyLove for a topic
Hope no one minds the necro. I found this really useful and decided to rework it to fit my needs. Basically, I made it use CTRL+ALT+<ArrowKey> to rotate the display. Basically exactly the same as Intel's solution, except it works on all graphics card Windows can rotate. For me personally, my laptop uses a G-Sync panel which the monitor must be hard wired to the Nvidia GPU. Because I cannot use the integrated graphics, the hotkeys for Intel's solution do not work. That's where this script comes in. This rotates only the primary monitor (#1 in window's display settings). Also, to answer @lalder's question, if you happen to still be hanging out here (doubt it), you can swap the primary monitors temporarily to the one you want to rotate, then swap back once you rotated them. I hope this helps anyone looking for this. #include <APIGdiConstants.au3> #include <WinAPIGdi.au3> #include <Misc.au3> opt("TrayIconHide",1) ;I dont like having unnecessary icons on my tray. Feel free to disable. $wintitle="Display Rotator" _Singleton($wintitle) RegWrite("HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $wintitle, "REG_SZ", @ScriptFullPath) ;AutoStart with Windows HotKeySet("^!{up}", "_upsidedown") HotKeySet("^!{down}", "_Down") HotKeySet("^!{left}", "_Left") HotKeySet("^!{right}", "_Right") While 1 Sleep(60000) WEnd Func _WinAPI_ChangeDisplaySettings($tDevMode, $dwFlags) Local $aRet = DllCall("user32.dll", "LONG", "ChangeDisplaySettingsW", "ptr", DllStructGetPtr($tDevMode), "DWORD", $dwFlags) If @error Then Return SetError(@error, @extended, 0) Return $aRet[0] EndFunc ;==>_WinAPI_ChangeDisplaySettings ; #FUNCTION# ==================================================================================================================== ; Author.........: Yashied ; Modified.......: jpm, Mat ; =============================================================================================================================== Func _WinAPI_EnumDisplaySettingsEx($sDevice, $iMode) Local $sTypeOfDevice = 'wstr' If Not StringStripWS($sDevice, $STR_STRIPLEADING + $STR_STRIPTRAILING) Then $sTypeOfDevice = 'ptr' $sDevice = 0 EndIf Local $tDevMode = DllStructCreate($tagDEVMODE_DISPLAY) DllStructSetData($tDevMode, 'Size', DllStructGetSize($tDevMode)) DllStructSetData($tDevMode, 'DriverExtra', 0) Local $aRet = DllCall('user32.dll', 'bool', 'EnumDisplaySettingsW', $sTypeOfDevice, $sDevice, 'dword', $iMode, _ 'struct*', $tDevMode) If @error Or Not $aRet[0] Then Return SetError(@error + 10, @extended, 0) Return $tDevMode EndFunc ;==>_WinAPI_EnumDisplaySettingsEx Func _Right() _WinAPI_ChangeDisplaySettings(_SetOrientation("Right"), 0) EndFunc ;==>_Right Func _Left() _WinAPI_ChangeDisplaySettings(_SetOrientation("Left"), 0) EndFunc ;==>_Left Func _upsidedown() _WinAPI_ChangeDisplaySettings(_SetOrientation("Up"), 0) EndFunc ;==>_upsidedown Func _Down() _WinAPI_ChangeDisplaySettings(_SetOrientation("Down"), 0) EndFunc ;==>_Down Func _SetOrientation($direction) ;$direction = {0 = Down, 1 = Right, 2 = Up, 3 = Left} Switch $direction Case "Left" $direction = 3 Case "Right" $direction = 1 Case "Up" $direction = 2 Case "Down" $direction = 0 EndSwitch $tDM2 = _WinAPI_EnumDisplaySettingsEx("", $ENUM_CURRENT_SETTINGS) $tDM2.Fields = BitOR($tDM2.Fields, $DM_DISPLAYORIENTATION) $tDM2.DisplayOrientation = $direction Select Case ($direction = 1) Or ($direction = 3) If $tDM2.PelsWidth > $tDM2.PelsHeight Then $v=$tDM2.PelsWidth $tDM2.PelsWidth = $tDM2.PelsHeight $tDM2.PelsHeight = $v Else $tDM2.PelsWidth = $tDM2.PelsWidth $tDM2.PelsHeight = $tDM2.PelsHeight EndIf Case ($direction = 0) Or ($direction = 2) If $tDM2.PelsWidth > $tDM2.PelsHeight Then $tDM2.PelsWidth = $tDM2.PelsWidth $tDM2.PelsHeight = $tDM2.PelsHeight Else $v=$tDM2.PelsWidth $tDM2.PelsWidth = $tDM2.PelsHeight $tDM2.PelsHeight = $v EndIf EndSelect Return $tDM2 EndFunc ;==>_SetOrientation Note: This writes to registry for current user to allow script to auto starts with windows. It also starts without a tray icon. Just personal preference, but you can change it as needed. P.S. I'm curious if there is an easier or better way to do the select statement in _SetOrientation().1 point -
You will need\should use _FileReadToArrayEx , It must be faster and it will have to do exactly All what you want them to do #include <Array.au3> #include "_FileReadToArrayEx.au3" Local $aArray $fTimerDiff = TimerInit() $aArray = _FileReadToArrayEx(@DesktopDir & '\ZZj2_Test.Won.Two.csv', ",", $FRTA_ARRAYFIELD + 0 + $FRTA_STRIPALL + $FRTA_CHECKSINGEQUOTE) ;$aArray = _FileReadToArrayEx(@DesktopDir & '\Test.inf', ",", 0 + 1 + 16 + 12) $fTimerDiff = TimerDiff($fTimerDiff) ConsoleWrite("_FileReadToArrayEx() : " & $fTimerDiff & @CRLF) _ArrayDisplay($aArray) _ArrayDisplay(($aArray[1])) _ArrayDisplay(($aArray[6])) #include <Array.au3> #include "_FileReadToArrayEx.au3" Local $aArray, $sData $aArray = _FileReadToArrayEx(@DesktopDir & '\ZZj2_Test.Won.Two.csv', ",", BitOR($FRTA_NOCOUNT, $FRTA_ARRAYFIELD, $FRTA_STRIPALL)) If Not @Error Then ;;Local $iaArray = UBound($aArray) - 1 ; or $iaArray = @Extended For $i = 0 To UBound($aArray) - 1 For $y = 0 To UBound($aArray[$i]) - 1 $sData &= ($aArray[$i])[$y] & "," Next $sData = StringTrimRight($sData, 1) & @CRLF Next EndIf ConsoleWrite($sData & @LF) ;Or $aArray = _FileReadToArrayEx(@DesktopDir & '\ZZj2_Test.Won.Two.csv', ",", BitOR($FRTA_ARRAYFIELD, $FRTA_STRIPALL, $FRTA_CHECKSINGEQUOTE)) If Not @Error Then ;;Local $iaArray = UBound($aArray) - 1 ; or $iaArray = @Extended For $i = 1 To ($aArray)[0] For $y = 1 To ($aArray[$i])[0] $sData &= ($aArray[$i])[$y] & "," Next $sData = StringTrimRight($sData, 1) & @CRLF Next EndIf ConsoleWrite($sData & @LF) Ciao.1 point
-
I wanted to start using SDL2 libraries in C++. This is a Hello World project that covers some of the essentials of programming with SDL2. I will use it when I forget how to create an SDL2 project. Loads a scrolling background image for world. Mouse position, left click, and double click example. Hotkeys and cooldown timers to prevent hotkey spam. Plays background music. (ALT + P) Plays sound effects changing sprite type. (numpad: /, *, -, +) Features a Player class for multiplayer. Player collision detection. Uses a Window class from Lazyfoo for maximize button, fullscreen ext.. Built using MSVS 2013 (free). All dlls and libraries included and linked (for MSVS) using relative paths. You can probably run the SDL2_HelloWorld.sln without setting up any libraries. Note SDL_Net is setup but not used. Delta time used to create consistent frame rate across machines. Player animation sprite sheet: Demo: Slimy's First Kiss Download Source and project: http://songersoft.com/programming/sdl2_helloworld/sdl2_helloworld_about.phtml This isn't meant to be amazing. It's just to help get started with SDL2. I will consider any criticism. main.cpp // This example HelloWorld followed this video: // https://www.youtube.com/watch?v=M4Jgz0wEQxY // Turned into this // https://www.youtube.com/watch?v=yRpen8jOa08&list=PL77-op_SRaiEuC0YC43ZAUJJwL_G_C2z8&index=15 // Window class was copied from Lazyfoo // http://lazyfoo.net/tutorials/SDL/35_window_events/index.php #include <iostream> #include <string> #include "SDL.h" #include "SDL_image.h" #include "SDL_ttf.h" #include "SDL_mixer.h" #include "SDL_net.h" #include "Player.h" #include "Window.h" using namespace std; // Prototypes SDL_Texture *LoadTexture(string filepath, SDL_Renderer *renderTarget); void logSDLError(const string); SDL_Rect sdlrect(int, int, int, int); SDL_Surface *OptimizedSurface(string filepath, SDL_Surface *windowSurface); // if(okAlt) either Alt key is pressed OrKeyALT #define okAlt (k[SDL_SCANCODE_RALT] || k[SDL_SCANCODE_LALT]) int main(int argc, char *argv[]) { // Needed for the initialize block Window window; SDL_Renderer *renderTarget = nullptr; // Initialize SDL2 if (SDL_Init(SDL_INIT_EVERYTHING) < 0) { logSDLError("SDL_Init "); } // Initialize SDL_image if (!(IMG_Init(IMG_INIT_PNG) & IMG_INIT_PNG)) { cout << "Could not initialize SDL_image: " << IMG_GetError() << std::endl; SDL_Delay(5500); } // Initialize TTF if (TTF_Init() < 0) cout << "TTF_Init " << TTF_GetError() << endl; //Create window if (!window.init("SDL2 Hello World", 640, 480, "../../Graphics/iconbmp.bmp")) { printf("Window could not be created! SDL Error: %s\n", SDL_GetError()); } else { //Create renderer for window renderTarget = window.createRenderer(); if (renderTarget == NULL) { printf("Renderer could not be created! SDL Error: %s\n", SDL_GetError()); } } // Audio if (Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 2048) < 0) { cout << "Mix_OpenAudio: " << Mix_GetError() << endl; } // Load sounds: Run chunk if less than 10 sec, music if greater (generally) //Mix_Music *bgm = Mix_LoadMUS("../../Sounds/overworld.mid"); // Can't Pause MIDI Mix_Music *bgm = Mix_LoadMUS("../../Sounds/bensound-goinghigher.mp3"); cout << Mix_GetError() << endl; // Font and text SDL_Texture *text_texture = nullptr; SDL_Color textColor = { 144, 77, 255, 255 }; TTF_Font *font = TTF_OpenFont("../../Graphics/Fonts/VCR_OSD_MONO.ttf", 20); if (font) { SDL_Surface *textSurf = TTF_RenderText_Solid(font, "Hello world", textColor); text_texture = SDL_CreateTextureFromSurface(renderTarget, textSurf); SDL_FreeSurface(textSurf); } else cout << TTF_GetError() << endl; SDL_Rect textRect = { 0, 0, 0, 0 };// Position of text on window // Get the size of the text_texture SDL_QueryTexture(text_texture, NULL, NULL, &textRect.w, &textRect.h); const int playerMax = 8; int players = 2; float prevTime = 0, currentTime = 0, deltaTime = 0; bool fullscreen_toggle = 0; int i = 0, ii = 0; int redraw = 1; bool done = 0; // Load player sprite sheet and background texture SDL_Texture *spritesheet_texture = LoadTexture("../../Graphics/DW3_Char_SpriteSheet.png", renderTarget); SDL_Texture *bg_texture = LoadTexture("../../Graphics/dw3-over.png", renderTarget); int bg_texture_w = 0, bg_texture_h = 0; // Point k to Keyboard state (only needs done here, not in main loop) const Uint8 *k = SDL_GetKeyboardState(NULL); SDL_Event windowEvent; // Stop keys spamming (like music ON / OFF) float key_cooldown_timer_max = 500.0f, key_cooldown_timer = 0; SDL_Rect cameraRect = { 0, 0, window.getWidth(), window.getHeight()}; // Construct default players Player player[playerMax]; // Customize players (texture and position) for (i = 0; i < players; i++)//(sprite texture, position x, position y) player[i].Player_new(spritesheet_texture, window.getWidth() / 2 + i * 16, window.getHeight() / 2); // Get the size of bg_texture SDL_QueryTexture(bg_texture, NULL, NULL, &bg_texture_w, &bg_texture_h); // Main message loop while (!done) { prevTime = currentTime; currentTime = SDL_GetTicks(); deltaTime = (currentTime - prevTime) / 1000.0f; while (SDL_PollEvent(&windowEvent) != 0) { // Check for events if (windowEvent.type == SDL_QUIT) { // Window Exit done = 1; } else if(windowEvent.type == SDL_MOUSEBUTTONDOWN) { // Mouse buttons if (windowEvent.button.clicks == 2) { // Double left click redraw = 1; } else if (windowEvent.button.button == SDL_BUTTON_LEFT) { // Single left click redraw = 1; } // Output mouse position cout << "Mouse: " << windowEvent.button.x << " " << windowEvent.button.y << endl; } }// if(SDL_PollEvent(&windowEvent)) if (okAlt) { // Either ALT key if (k[SDL_SCANCODE_RETURN]) { // ALT + ENTER, toggle fullscreen // Consider matching current window resolution to closest preset array of valid full screen resolutions. fullscreen_toggle = 1; } if (k[SDL_SCANCODE_P]) { if (SDL_GetTicks() - key_cooldown_timer > key_cooldown_timer_max) { // Action cooldown timer is ready. Avoids ON / OFF flicker // Play Music if (!Mix_PlayingMusic()) { cout << "PLAY"; Mix_PlayMusic(bgm, -1); } else if (Mix_PausedMusic()) { cout << "RESUME"; Mix_ResumeMusic(); } else { cout << "PAUSE"; Mix_PauseMusic(); } key_cooldown_timer = SDL_GetTicks(); } }// SDL_SCANCODE_P if (k[SDL_SCANCODE_S]) { // Stop Music Mix_HaltMusic(); } }// okAlt //Handle window events fullscreen_toggle = window.handleEvent(windowEvent, renderTarget, fullscreen_toggle); // Player Update and IntersectsWith for (i = 0; i < players; i++) { player[i].Update(deltaTime, k); for (ii = 0; ii < players; ii++) { if(i != ii)// Not self player[i].IntersectsWith(player[ii]); } } // Camera cameraRect.x = player[0].GetOriginX() - window.getWidth() / 2; cameraRect.y = player[0].GetOriginY() - window.getHeight() / 2; // Normalize if (cameraRect.x < 0) cameraRect.x = 0; if (cameraRect.y < 0) cameraRect.y = 0; if (cameraRect.x + cameraRect.w >= bg_texture_w) cameraRect.x = bg_texture_w - window.getWidth(); if (cameraRect.y + cameraRect.h >= bg_texture_h) cameraRect.y = bg_texture_h - window.getHeight(); redraw = 1; // Don't judge me if (redraw) { // Redraw should definatly pretty much be at the end of loop // Clear window SDL_RenderClear(renderTarget); // Copy camera from bg_texture SDL_RenderCopy(renderTarget, bg_texture, &cameraRect, NULL); // Draw players for (i = 0; i < players; i++) player[i].Draw(renderTarget, cameraRect); // Print text SDL_RenderCopy(renderTarget, text_texture, NULL, &textRect); // Show the rendered content SDL_RenderPresent(renderTarget); redraw = 0; }// if(redraw) }// while(true) // Free windows window.free(); SDL_DestroyTexture(bg_texture); SDL_DestroyTexture(spritesheet_texture); SDL_DestroyTexture(text_texture); TTF_CloseFont(font); // Free Renderers SDL_DestroyRenderer(renderTarget); // Free music Mix_FreeMusic(bgm); // Close systems Mix_Quit(); TTF_Quit(); IMG_Quit(); SDL_Quit(); return EXIT_SUCCESS; }// main() SDL_Texture *LoadTexture(string filepath, SDL_Renderer *renderTarget) { // Create texture SDL_Texture *texture = nullptr; // Load surface SDL_Surface *surface = IMG_Load(filepath.c_str()); if (surface == NULL) { // surface didn't load logSDLError("LoadTexture surface "); } else { SDL_SetColorKey(surface, SDL_TRUE, SDL_MapRGB(surface->format, 0, 0, 0)); texture = SDL_CreateTextureFromSurface(renderTarget, surface); //SDL_SetTextureColorMod(texture, 120, 150, 140); if (texture == NULL) logSDLError("LoadTexture texture "); } SDL_FreeSurface(surface); return texture; } void logSDLError(const string msg){ cout << msg << " Error: " << SDL_GetError() << endl; SDL_Delay(4000); } SDL_Rect sdlrect(int x, int y, int w, int h) { SDL_Rect rect = {x, y, w, h}; return rect; } SDL_Surface *OptimizedSurface(string filepath, SDL_Surface *windowSurface) { SDL_Surface *optimizedSurf = nullptr; SDL_Surface *surface = IMG_Load(filepath.c_str()); if (surface == NULL) { cout << "Error: " << endl; } else { optimizedSurf = SDL_ConvertSurface(surface, windowSurface->format, 0); if (optimizedSurf == NULL) cout << "Error: " << endl; } SDL_FreeSurface(surface); return optimizedSurf; } Player.h #pragma once #include <iostream> #include "SDL.h" #include <String> #include "SDL_mixer.h" using namespace std; enum player_control { ePlayer_control_up, ePlayer_control_down, ePlayer_control_left, ePlayer_control_right, ePlayer_control_type_minus, ePlayer_control_type_plus }; class Player { private: SDL_Rect cropRect; SDL_Texture *texture; int spritesheet_texture_w, spritesheet_texture_h;//size of spritesheet texture bool isActive;//animation timer SDL_Scancode keys[6]; int frame_w, frame_h;//16, 16 float frameTimerMax; float frameTimer;//0..frameTimerMax int frame;//0..1 int frameMax;//2 int way;//0..3 int classType;//0..53 float moveSpeed; float cast_cooldown_max; Mix_Chunk *soundEffect; int originX, originY; int radius; Uint32 key_cooldown_timer; string name; public: void Player_new(SDL_Texture *spritesheet_texture, int x, int y); Player(); ~Player(); void Update(float delta, const Uint8 *keyState); void Draw(SDL_Renderer *renderTarget, SDL_Rect cameraRect); bool IntersectsWith(Player &p); int GetOriginX(); int GetOriginY(); int GetRadius(); SDL_Rect positionRect; }; Player.cpp #pragma once #include "Player.h" #include "SDL_image.h" #include "SDL_mixer.h" #include <iostream> #include <String> #include <cmath> using namespace std; Player::Player() { cropRect = {0, 0, 16, 16}; texture = nullptr; spritesheet_texture_w = spritesheet_texture_h = 0;//size of spritesheet texture isActive = false;//animation timer keys[6]; frame_w = frame_h = 16;//16, 16 frameTimerMax = 0.5f; frameTimer = 0;//0..frameTimerMax frame = 0;//0..1 frameMax = 2;//2 way = 0;//0..3 classType = 0;//0..53 moveSpeed = 200.0f; radius = frame_w / 2; soundEffect = nullptr; key_cooldown_timer = 0; cast_cooldown_max = 190.0f; static int playerNumber = 0; playerNumber++; name = "Player:" + to_string(playerNumber); // Setup keys for player 1 // ** I see the enum didn't exist when this was written ** if (playerNumber == 1) { keys[0] = SDL_SCANCODE_W; keys[1] = SDL_SCANCODE_S; keys[2] = SDL_SCANCODE_A; keys[3] = SDL_SCANCODE_D; keys[4] = SDL_SCANCODE_KP_MINUS; keys[5] = SDL_SCANCODE_KP_PLUS; } else { // Setup keys all other players (not 1) keys[0] = SDL_SCANCODE_UP; keys[1] = SDL_SCANCODE_DOWN; keys[2] = SDL_SCANCODE_LEFT; keys[3] = SDL_SCANCODE_RIGHT; keys[4] = SDL_SCANCODE_KP_DIVIDE; keys[5] = SDL_SCANCODE_KP_MULTIPLY; } }//Player::Player() void Player::Player_new(SDL_Texture *spritesheet_texture, int x, int y) { // This is new player isActive = false; // Read size of spritesheet texture SDL_QueryTexture(spritesheet_texture, NULL, NULL, &spritesheet_texture_w, &spritesheet_texture_h); texture = spritesheet_texture; // spritesheet rect cropRect = { 0, 0, 16, 16 }; // player screen position positionRect = { x, y, 16, 16 }; // Defaults moveSpeed = 200.0f; radius = frame_w / 2; frameTimer = 0; frame = 0; frameMax = 2; way = 0; classType = 0; originX = frame_w / 2; originY = frame_h / 2; soundEffect = Mix_LoadWAV("../../Sounds/whipcrack1.wav"); cout << "Name: " << name << endl; }//Player::Player_new() void Player::Update(float delta, const Uint8 *keyState) { isActive = true; if (keyState[keys[ePlayer_control_up]]) { way = 0; positionRect.y -= moveSpeed * delta; cropRect.x = (way * cropRect.w * frameMax) + (frame * cropRect.w); } if (keyState[keys[ePlayer_control_down]]) { way = 1; positionRect.y += moveSpeed * delta; cropRect.x = (way * cropRect.w * frameMax) + (frame * cropRect.w); } if (keyState[keys[ePlayer_control_left]]) { way = 3; positionRect.x -= moveSpeed * delta; cropRect.x = (way * cropRect.w * frameMax) + (frame * cropRect.w); } if (keyState[keys[ePlayer_control_right]]) { way = 2; positionRect.x += moveSpeed * delta; cropRect.x = (way * cropRect.w * frameMax) + (frame * cropRect.w); } if (keyState[keys[ePlayer_control_type_minus]]) { if (SDL_GetTicks() - key_cooldown_timer > cast_cooldown_max) { key_cooldown_timer = SDL_GetTicks(); Mix_PlayChannel(-1, soundEffect, 0); classType--; if (classType < 0) classType = spritesheet_texture_h / cropRect.h - 1; cropRect.y = classType * cropRect.h; } } if (keyState[keys[ePlayer_control_type_plus]]) { if (SDL_GetTicks() - key_cooldown_timer > cast_cooldown_max) { key_cooldown_timer = SDL_GetTicks(); Mix_PlayChannel(-1, soundEffect, 0); classType++; if (classType >= spritesheet_texture_h / cropRect.h) classType = 0; cropRect.y = classType * cropRect.h; } } if (isActive) { frameTimer += delta; if (frameTimer >= frameTimerMax){ frameTimer = 0; cropRect.x = (way * cropRect.w * frameMax) + (frame * cropRect.w); if (frame >= frameMax - 1) frame = 0; else frame++; } } else { frameTimer = 0; } }//Player::Update() void Player::Draw(SDL_Renderer *renderTarget, SDL_Rect cameraRect) { SDL_Rect drawingRect = { positionRect.x - cameraRect.x, positionRect.y - cameraRect.y, positionRect.w, positionRect.h }; SDL_RenderCopy(renderTarget, texture, &cropRect, &drawingRect); } bool Player::IntersectsWith(Player &p){ if (sqrt(pow(GetOriginX() - p.GetOriginX(), 2) + pow(GetOriginY() - p.GetOriginY(), 2)) >= radius + p.GetRadius()) { SDL_SetTextureColorMod(texture, 255, 255, 255); return false; } SDL_SetTextureColorMod(texture, 255, 0, 0); return true; } Player::~Player() { SDL_DestroyTexture(texture); Mix_FreeChunk(soundEffect); } int Player::GetOriginX() { return positionRect.x + originX; } int Player::GetOriginY() { return positionRect.y + originY; } int Player::GetRadius() { return radius; }1 point
-
Hi. I completely agree with @Neutro. You should try to find the reason for this error message. But if you don't want or can't find take his code. But I would change some little thing. I would change both "There was a temporary problem" with "(-3212)". You know why? Otherwise your tool is kicking every "there was a temporary problem"-problem. But what if there is another completely different iTunes error? Don't you want to know about it? With "(-3212)" you only kick this iTunes error message. Regards, Conrad1 point
-
For the fun, another way #include <File.au3> #include <Array.au3> $edfd=@ScriptDir &"\result\" If not FileExists($edfd) Then DirCreate($edfd) $arr = _FileListToArray(@ScriptDir, '*.txt', 1) For $a = 1 To UBound($arr) - 1 Local $finar[0] $res = StringRegExpReplace(FileRead(@ScriptDir &"\"& $arr[$a]), '(?s).*BB(.*?)CC.*', "$1") If not @extended Then ContinueLoop $res = StringStripWS($res, 3) if $res <> "" Then _ArrayAdd($finar, $res) ConsoleWrite($res&@CRLF) endif _ArrayDisplay($finar,"") _FileWriteFromArray($edfd & $arr[$a], $finar) Next1 point
-
@jjohn Your script nearly worked. I added some comments It's usually a better way to separate the instructions and place some error checking, this makes the script much easier to debug #include <File.au3> #include <Array.au3> Dim $arr2 $edfd=@ScriptDir &"\result\" If FileExists($edfd) = 0 Then DirCreate($edfd) $arr = _FileListToArray(@ScriptDir, '*.txt', 1) For $a = 1 To UBound($arr) - 1 Local $finar[0] ; declare $finar as an array to get _ArrayAdd to work (and reinitialize it) _FileReadToArray(@ScriptDir &"\"& $arr[$a], $arr2) $start = _ArraySearch($arr2, "BB", 0, 0, 0, 1)+1 ; maybe it's more secure to do a partial search If @error Then ContinueLoop ; better use this. if _ArraySearch fails then the whole script crashes $end = _ArraySearch($arr2, "CC", 0, 0, 0, 1)-1 ; same If @error Then ContinueLoop for $a2 = $start to $end $txt = StringStripWS($arr2[$a2],3) if StringLen($txt)<>0 Then _ArrayAdd($finar, $txt) ConsoleWrite($txt&@CRLF) endif Next _ArrayDisplay($finar,"") _FileWriteFromArray($edfd & $arr[$a], $finar) Next1 point