guinness Posted December 16, 2012 Share Posted December 16, 2012 It's an array so you have to use square brackets e.g. $aNzbList[0] = 1 as the 0th element contains the total number of files. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Chimaera Posted December 16, 2012 Author Share Posted December 16, 2012 (edited) Yep i tried that as well and it still dont see it Heres the full function Func _NzbRename() $aNzbList = _FileListToArray(@ScriptDir, "*.nzb", 1) _ArrayDisplay( $aNzbList) If $aNzbList = "" Then MsgBox(64, "", " No Files To Change ", 3) Exit Else Select Case $aNzbList[0] = 1 For $i = 1 To $aNzbList[0] $sNew_Name = StringRegExpReplace($aNzbList[$i], "(?i)([^a-z0-9.]|.(?!nzb))", " ") $sNew_Name = StringStripWS($sNew_Name, 4) FileMove(@ScriptDir & "" & $aNzbList[$i], $sNew_Name, 1) Sleep(100) ClipPut($sNew_Name) Next ConsoleWrite("One" & @CRLF) Case Else For $i = 1 To $aNzbList[0] $sNew_Name = StringRegExpReplace($aNzbList[$i], "(?i)([^a-z0-9.]|.(?!nzb))", " ") $sNew_Name = StringStripWS($sNew_Name, 4) FileMove(@ScriptDir & "" & $aNzbList[$i], $sNew_Name, 1) Sleep(100) Next ConsoleWrite("Two+" & @CRLF) EndSelect EndIf EndFunc ;==>_NzbRename thew array display works correct just nothing after it it never gives the consolewrites yet it changes the file Something else ive noticed which seems weird is the script finishes before ive pressed the button about 2 secs ish Or is that normal and i havent realised Edited December 16, 2012 by Chimaera If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
guinness Posted December 16, 2012 Share Posted December 16, 2012 It would be better on this occasion to use an If statement. I also tidied up the function a little. Func _NzbRename() Local $aNzbList = _FileListToArray(@ScriptDir, '*.nzb', 1) _ArrayDisplay($aNzbList) If $aNzbList = '' Then Exit MsgBox(64, '', ' No Files To Change ', 3) Else Local $sNew_Name = '' If $aNzbList[0] = 1 Then For $i = 1 To $aNzbList[0] $sNew_Name = StringStripWS(StringRegExpReplace($aNzbList[$i], '(?i)([^a-z0-9.]|.(?!nzb))', ' '), 4) FileMove(@ScriptDir & '' & $aNzbList[$i], $sNew_Name, 1) ClipPut($sNew_Name) Next ConsoleWrite('One' & @CRLF) Else For $i = 1 To $aNzbList[0] $sNew_Name = StringStripWS(StringRegExpReplace($aNzbList[$i], '(?i)([^a-z0-9.]|.(?!nzb))', ' '), 4) FileMove(@ScriptDir & '' & $aNzbList[$i], $sNew_Name, 1) Next ConsoleWrite('Two' & @CRLF) EndIf EndIf EndFunc ;==>_NzbRename UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Chimaera Posted December 16, 2012 Author Share Posted December 16, 2012 (edited) Erm def diff to mine but still same result it doesnt trigger the consolewrite? Its weird if i just open the gui it gives an exit code: 0 even if i dont touch it Gonna have to have another look to see whats causing it not to work, the annoying bit is it changes the filename(s) just doesnt give the consolwrite? Just moved the consolewrite to the top and it still doesnt give it yet the regex works... lol Edited December 16, 2012 by Chimaera If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
guinness Posted December 16, 2012 Share Posted December 16, 2012 Try this >> #include <Array.au3> #include <File.au3> _NzbRename() Func _NzbRename() Local $aNzbList = _FileListToArray(@ScriptDir, '*.nzb', 1) If @error Then Exit MsgBox(64, '', ' No Files To Change ', 3) Else _ArrayDisplay($aNzbList) Local $sNew_Name = '' If $aNzbList[0] = 1 Then For $i = 1 To $aNzbList[0] $sNew_Name = StringStripWS(StringRegExpReplace($aNzbList[$i], '(?i)([^a-z0-9.]|.(?!nzb))', ' '), 4) FileMove(@ScriptDir & '' & $aNzbList[$i], $sNew_Name, 1) ClipPut($sNew_Name) Next ConsoleWrite('One' & @CRLF) Else For $i = 1 To $aNzbList[0] $sNew_Name = StringStripWS(StringRegExpReplace($aNzbList[$i], '(?i)([^a-z0-9.]|.(?!nzb))', ' '), 4) l FileMove(@ScriptDir & '' & $aNzbList[$i], $sNew_Name, 1) Next ConsoleWrite('Two' & @CRLF) EndIf EndIf EndFunc ;==>_NzbRename UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
guinness Posted December 16, 2012 Share Posted December 16, 2012 Just to make it clear >> Local $vTest = 0 If $vTest = '' Then ; This doesn't make a blind bit of difference, but it's best to check what the help file says is a failed result. MsgBox(4096, '', 'An error occurred.') Else MsgBox(4096, '', 'Everything is OK.') EndIf UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Chimaera Posted December 16, 2012 Author Share Posted December 16, 2012 Interesting the first one you asked me to test works but not when i put it in my script and it stays open longer than mine, leave it with me im going to rewrite from scratch and see what happens It crossed my mind whether this was a Win 8 issue but now yours works i doubt it Ill get back in a bit If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
guinness Posted December 16, 2012 Share Posted December 16, 2012 I doubt it would be a Windows 8 issue, but then again I don't have this OS to test on. Does _FileListToArray return an array? UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Chimaera Posted December 16, 2012 Author Share Posted December 16, 2012 (edited) yes every time and i change the amount of test files to check its very strange as the rest is just a no minimize gui which melba helped me with a long time ago Filenames im using Mark.Chambers.Skoolin.Anthea.VMR004.EP WEB 2012 YOU.nzb and i just make a second one when needed The only bit this is missing is the autoit wrappers expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.8.0 Author: Chimaera Script Function: NZB File Renamer #ce ---------------------------------------------------------------------------- #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <File.au3> #include <Array.au3> ;~ FileInstall(".chim_logo.jpg", @TempDir & "", 1) ; ------------------------------------------------------------------------------ Global $button1, $button2, $sNew_Name, $sNzbList, $aNzbList, $image1, $i ; ------------------------------------------------------------------------------ Local $GUI_Start = GUICreate(" Nzb File Renamer ", 220, 170, -1, -1, BitXOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX)) $button1 = GUICtrlCreateButton(" Change One File ", 30, 20, 160, 35) GUICtrlSetFont(-1, 11, 550, -1, "Tahoma") ;~ $image1 = GUICtrlCreatePic(@TempDir & "" & "chim_logo.jpg", 60, 125, 104, 25) GUISetState() Local $nMsg = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $button1 _NzbRename() EndSwitch WEnd Func _NzbRename() Local $aNzbList = _FileListToArray(@ScriptDir, '*.nzb', 1) If @error Then Exit MsgBox(64, '', ' No Files To Change ', 3) Else _ArrayDisplay($aNzbList) Local $sNew_Name = '' If $aNzbList[0] = 1 Then For $i = 1 To $aNzbList[0] $sNew_Name = StringStripWS(StringRegExpReplace($aNzbList[$i], '(?i)([^a-z0-9.]|.(?!nzb))', ' '), 4) FileMove(@ScriptDir & '' & $aNzbList[$i], $sNew_Name, 1) ClipPut($sNew_Name) Next ConsoleWrite('One' & @CRLF) Else For $i = 1 To $aNzbList[0] $sNew_Name = StringStripWS(StringRegExpReplace($aNzbList[$i], '(?i)([^a-z0-9.]|.(?!nzb))', ' '), 4) FileMove(@ScriptDir & '' & $aNzbList[$i], $sNew_Name, 1) Next ConsoleWrite('Two' & @CRLF) EndIf EndIf EndFunc ;==>_NzbRename ;~ Func _NzbRename() ;~ Local $aNzbList = _FileListToArray(@ScriptDir, '*.nzb', 1) ;~ If @error Then ;~ Exit MsgBox(64, '', ' No Files To Change ', 3) ;~ Else ;~ _ArrayDisplay($aNzbList) ;~ If $aNzbList[0] = 1 Then ;~ ConsoleWrite('One' & @CRLF) ;~ Else ;~ ConsoleWrite('Two' & @CRLF) ;~ EndIf ;~ EndIf ;~ EndFunc ;==>_NzbRename ;~ Func _NzbRename() ;~ Local $aNzbList = _FileListToArray(@ScriptDir, '*.nzb', 1) ;~ _ArrayDisplay($aNzbList) ;~ If $aNzbList = '' Then ;~ Exit MsgBox(64, '', ' No Files To Change ', 3) ;~ Else ;~ Local $sNew_Name = '' ;~ If $aNzbList[0] = 1 Then ;~ For $i = 1 To $aNzbList[0] ;~ $sNew_Name = StringStripWS(StringRegExpReplace($aNzbList[$i], '(?i)([^a-z0-9.]|.(?!nzb))', ' '), 4) ;~ FileMove(@ScriptDir & '' & $aNzbList[$i], $sNew_Name, 1) ;~ ClipPut($sNew_Name) ;~ Next ;~ ConsoleWrite('One' & @CRLF) ;~ Else ;~ For $i = 1 To $aNzbList[0] ;~ $sNew_Name = StringStripWS(StringRegExpReplace($aNzbList[$i], '(?i)([^a-z0-9.]|.(?!nzb))', ' '), 4) ;~ FileMove(@ScriptDir & '' & $aNzbList[$i], $sNew_Name, 1) ;~ Next ;~ ConsoleWrite('Two' & @CRLF) ;~ EndIf ;~ EndIf ;~ EndFunc ;==>_NzbRename ;~ Func _NzbRename() ;~ $aNzbList = _FileListToArray(@ScriptDir, "*.nzb", 1) ;~ _ArrayDisplay( $aNzbList) ;~ If $aNzbList = "" Then ;~ MsgBox(64, "", " No Files To Change ", 3) ;~ Exit ;~ Else ;~ Select ;~ If $aNzbList[0] = 1 Then ;~ For $i = 1 To $aNzbList[0] ;~ $sNew_Name = StringRegExpReplace($aNzbList[$i], "(?i)([^a-z0-9.]|.(?!nzb))", " ") ;~ $sNew_Name = StringStripWS($sNew_Name, 4) ;~ FileMove(@ScriptDir & "" & $aNzbList[$i], $sNew_Name, 1) ;~ Sleep(100) ;~ ClipPut($sNew_Name) ;~ ConsoleWrite("One" & @CRLF) ;~ Next ;~ Else ;~ For $i = 1 To $aNzbList[0] ;~ $sNew_Name = StringRegExpReplace($aNzbList[$i], "(?i)([^a-z0-9.]|.(?!nzb))", " ") ;~ $sNew_Name = StringStripWS($sNew_Name, 4) ;~ FileMove(@ScriptDir & "" & $aNzbList[$i], $sNew_Name, 1) ;~ Sleep(100) ;~ ConsoleWrite("Two+" & @CRLF) ;~ Next ;~ Endif ;~ EndIf ;~ EndFunc ;==>_NzbRename Ive left in the changes ive made so you can see and this doesnt work for me Edited December 16, 2012 by Chimaera If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
guinness Posted December 16, 2012 Share Posted December 16, 2012 (edited) What about this instead? >> FileMove(@ScriptDir & '' & $aNzbList[$i], @ScriptDir & '' & $sNew_Name, 1) It's a little late, so you could you confirm what the issue is again? What doesn't it do, but should do? Edited December 16, 2012 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Chimaera Posted December 16, 2012 Author Share Posted December 16, 2012 (edited) nope still the same as the previous one. I think id best start with rewriting the gui and try a compare Ok this is now bloody weird Ive made another gui from scratch and added your tweak of the function to it and i cant believe what makes it fail #RequireAdmin I even went back to the original and it works when i switch #RequireAdmin off both e.g. fail with it switched on wtf? Just checked another script im working on and it shuts barely as it starts with the usual exit: 0 but if i remove the #RequireAdmin It stays open Looks like we have a pattern here Edited December 16, 2012 by Chimaera If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now