Jump to content

coding in XP, playing in Win7


sbrady
 Share

Recommended Posts

I am coding on an XP machine and everything works.

I will be using my scripts on a Win 7 machine, where nothing works.

the #3 button on the interface it what I am testing, a file rename script.

I think it has to do with how the name of the open window is interpreted.

any ideas as to what to do. I CANNOT code on the Win7 machine right now, it will be several months.

Here is the pile of code I have written that DOES WORK on this XP machine.

the file I use to test button #3 would have this name to start with:

AR123 Smith, Bob v1 FULL MIX.txt (before)

AR123 Smith, Bob FULL MIX v1.txt (after)

; GUI create

#include
#include
#include
#include

Example()

Func Example()
Local $Button_1, $Button_2, $Button_3, $Button_3, $msg
GUICreate("DAW1 Scripts", 220,220) ; will create a dialog box that when displayed is centered

;$textbox_input = GUICtrlCreateInput("AR123 Smith, Bob", 10, 35, 350, 20) ; will not accept drag&drop files
;$new_project_name = GUICtrlRead($textbox_input)

Opt("GUICoordMode", 2)
$Button_1 = GUICtrlCreateButton(" 1. Promo Prep", 20, 30, 180,30, $BS_LEFT)
$Button_2 = GUICtrlCreateButton(" 2. Make NPR Promo folder", -180, 10, 180,30, $BS_LEFT)
$Button_3 = GUICtrlCreateButton(" 3. Rename Mixes", -180, 10, 180,30, $BS_LEFT)
$Button_4 = GUICtrlCreateButton(" 4. NEXTDAY to DMG", -180, 10, 180,30, $BS_LEFT)


GUISetState() ; will display an dialog box with 2 button

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop


;BUTTON 1 Promo Prep
Case $msg = $Button_1








;BUTTON 2 Make NPR folder
Case $msg = $Button_2
; month
$the_month = @MON

;the day
$the_day = @mday

;the year
$the_year = @YEAR
$the_year2 = StringTrimLeft ($the_year,2)

$todays_promo1 = $the_month & "-" & $the_day & "-" & $the_year2 & " Promos NPR"; 10-15-12
$todays_promo2 = $the_month & "-" & $the_day & "-" & $the_year2 & " Promos"

$NPR_PROMO_FOLDER = "D:\Promos\" & $todays_promo1
DirCreate($NPR_PROMO_FOLDER) ; 10-15-12 Promo NPR
ClipPut($todays_promo2) ; 10-15-12 Promo









;Button 3 Rename Mixes
Case $msg = $Button_3
;start
Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ComErrFunc")

$aWinList=WinList("[REGEXPCLASS:^(Explore|Cabinet)WClass$]")

For $i = 1 To $aWinList[0][0]
; Get base folder and selections
$aSelection = _ExplorerWinGetSelectedItems($aWinList[$i][1])

; Display as strings
ConsoleWrite("Explorer Window: " & $aSelection[1] & " Selection(s)" & @CRLF)
For $j = 2 To $aSelection[0] + 1
ConsoleWrite(@TAB & $aSelection[$j] & @CRLF)
Next




; START SHAWN's CODE____________________________
; repeat with the selected items
For $File_Name = 1 To $aSelection
; check if file name contains "Full MIX" or "SOT MIX" or "M&E MIX"
$result = StringInStr($File_Name, "mix",0,1)
If $result > 0 Then
$filename2 = StringInStr ( $File_Name, "\" , 0 , -1) ;1st occurance from of "\" from right (47 chars in)
$the_folder_path = StringLeft ( $File_Name, $filename2 ) ; C:\Documents and Settings\sebrad\Desktop\shawn\
$file_path_len = StringLen($File_Name) ; 79 characters
$char_in_file_name = $file_path_len - $filename2 ;31
$orig_file_name = StringRight ($File_Name, $char_in_file_name) ;AR123 Smith, Bob v1 FULL MIX.txt
$new_file_name = StringRegExpReplace($orig_file_name, "(?i)(.*)(\sv.*)(\s.*\sMIX)(\.txt)", "$1$3$2$4") ;AR123 Smith, Bob FULL MIX v1.txt
;MsgBox(4096, "THE result", $new_file_name)
FileCopy ( $File_Name, ($the_folder_path & $new_file_name), 1 ) ; with overwright
FileDelete ( $the_folder_path & $orig_file_name)
EndIf

Next
; END SHAWN's CODE________________________

Next

;end

















; BUTTON 4 copy NEXTDAY to DMG PROMOS
Case $msg = $Button_4

; month
$the_month = @MON

;the day
$the_day = @mday

;the year
$the_year = @YEAR
$the_year2 = StringTrimLeft ($the_year,2)

; set the name for DMG (Digital Media Group)
$todays_promo = "NEXTDAY " & $the_month & "-" & $the_day & "-" & $the_year2 ;NEXTDAY 10-15-12

ShellExecute("\\10.100.20.40\DMG Drop Off\Streaming\PROMOS") ; open DMG folder
WinWait("PROMOS") ; wait till the drive exists
WinMove("PROMOS","",50,800,200,300) ; open the drive in lower left of the screen
$NDP_SRC = "D:\Promos\NEXTDAY.mxf"
$DEST = "\\10.100.20.40\DMG Drop Off\Streaming\PROMOS\" & $todays_promo
FileCopy ($NDP_SRC,$DEST) ;move NEXTDAY and rename to DMG














EndSelect
WEnd
EndFunc ;==>Example




; ==========================================================================================================================

; Func _ObjectSHFolderViewFromWin($hWnd)
;
; Returns an 'ShellFolderView' Object for the given Window handle
;
; Author: Ascend4nt, based on code by KaFu, klaus.s
; ==========================================================================================================================

Func _ObjectSHFolderViewFromWin($hWnd)
If Not IsHWnd($hWnd) Then Return SetError(1,0,0)
Local $oShell,$oShellWindows,$oIEObject,$oSHFolderView

; Shell Object
$oShell=ObjCreate("Shell.Application")
If Not IsObj($oShell) Then Return SetError(2,0,0)

; Get a 'ShellWindows Collection' object
$oShellWindows = $oShell.Windows()
If Not IsObj($oShellWindows) Then Return SetError(3,0,0)

; Iterate through the collection - each of type 'InternetExplorer' Object

For $oIEObject In $oShellWindows
If $oIEObject.HWND = $hWnd Then
; InternetExplorer->Document = ShellFolderView object
$oSHFolderView=$oIEObject.Document
If IsObj($oSHFolderView) Then Return $oSHFolderView
Return SetError(4,0,0)
EndIf
Next

Return SetError(-1,0,0)
EndFunc

; ==========================================================================================================================
; Func _ExplorerWinGetSelectedItems($hWnd)
;
;
; Author: klaus.s, KaFu, Ascend4nt (consolidation & cleanup, Path name simplification)
; ==========================================================================================================================

Func _ExplorerWinGetSelectedItems($hWnd)
If Not IsHWnd($hWnd) Then Return SetError(1,0,'')
Local $oSHFolderView
Local $iSelectedItems,$iCounter=2,$aSelectedItems[2] = [0, ""]

$oSHFolderView=_ObjectSHFolderViewFromWin($hWnd)
If @error Then Return SetError(@error,0,'')

; SelectedItems = FolderItems Collection object->Count
$iSelectedItems = $oSHFolderView.SelectedItems.Count

Dim $aSelectedItems[$iSelectedItems+2] ; 2 extra -> 1 for count [0], 1 for Folder Path [1]

$aSelectedItems[0]=$iSelectedItems
; ShellFolderView->Folder->Self as 'FolderItem'->Path
$aSelectedItems[1]=$oSHFolderView.Folder.Self.Path

; ShellFolderView->SelectedItems = FolderItems Collection object
$oSelectedFolderItems = $oSHFolderView.SelectedItems

#cs
; For ALL items in an Explorer window (not just the selected ones):
$oSelectedFolderItems = $oSHFolderView.Folder.Items
ReDim $aSelectedItems[$oSelectedFolderItems.Count+2]
#ce

For $oFolderItem In $oSelectedFolderItems
$aSelectedItems[$iCounter] = $oFolderItem.Path
$iCounter += 1
Next

Return SetExtended($iCounter-2,$aSelectedItems)
EndFunc ;==>_ExplorerWinGetSelectedItems

Func _ComErrFunc($oError)
ConsoleWrite("COM Error occurred:" & @CRLF & _
"Number: " & @TAB & $oError.number & @CRLF & _
"Windescription:" & @TAB & $oError.windescription & @CRLF & _
"Description is: " & @TAB & $oError.description & @CRLF & _
"Source is: " & @TAB & $oError.source & @CRLF & _
"Helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
"Helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
"Lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
"Scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
"Retcode is: " & @TAB & $oError.retcode & @CRLF & @CRLF)
EndFunc ;==>_ComErrFunc
Link to comment
Share on other sites

  • Moderators

sbrady,

Where does the code fail? At the moment you have no errorchecking at all so any one of the lines in the $Button_3 code could be the problem. :wacko:

Go and put some error checks into the code and see if you can narrow it down a bit so that we have something to work on. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

OK thanks I'll try. when I ran this on a win7 machine, it deleted the selected files, it just didnt make a copy in the same location with the new name.

StringRegExpReplace is not functioning...........hmmmm

Edited by sbrady
Link to comment
Share on other sites

  • Moderators

sbrady,

Then I suggest you check the parameters to the FileCopy function to see if you have them set correctly. You might also check if you have write permission for that folder. :)

Incidentally, do you realise that you can use FileMove to rename files? Then you do not have to do the double Copy/Delete thing. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Not to shave too fine a point here, but the code that I pointed out earlier in this script is still written incorrectly

This will never work on XP or Windows 7.

$File_Name is going to equal a number, it will never equal a file name in this loop. $aSelection is an array, so looping to an array is not going to work, you probably want $aSelection[0] here, although I don't know the contents of $aSelection so I'm not sure.

For $File_Name = 1 To $aSelection
      ; check if file name contains "Full MIX" or "SOT MIX" or "M&E MIX"
      $result = StringInStr($File_Name, "mix", 0, 1)
      If $result > 0 Then
       $filename2 = StringInStr($File_Name, "", 0, -1) ;1st occurance from of "" from right (47 chars in)
       $the_folder_path = StringLeft($File_Name, $filename2) ; C:Documents and SettingssebradDesktopshawn
       $file_path_len = StringLen($File_Name) ; 79 characters
       $char_in_file_name = $file_path_len - $filename2 ;31
       $orig_file_name = StringRight($File_Name, $char_in_file_name) ;AR123 Smith, Bob v1 FULL MIX.txt
       $new_file_name = StringRegExpReplace($orig_file_name, "(?i)(.*)(sv.*)(s.*sMIX)(.txt)", "$1$3$2$4") ;AR123 Smith, Bob FULL MIX v1.txt
       ;MsgBox(4096, "THE result", $new_file_name)
       FileCopy($File_Name, ($the_folder_path & $new_file_name), 1) ; with overwright
       FileDelete($the_folder_path & $orig_file_name)
      EndIf
     Next

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

thanks for the tip I'll try it, but it does work on my machine, I can prove it. I'll gladly take any help. I will trying using the FileMove instead of copy 1st though. Thanks.

the contents of $aSelection are:

C;folderfolderfolderAR123 Smith, Bob v1 FULL MIX.txt

C;folderfolderfolderAR123 Smith, Bob v1 SOT MIX.txt

C;folderfolderfolderAR123 Smith, Bob v1 M&E MIX.txt

Link to comment
Share on other sites

I'll be damned if you're not right. I ran this code on my computer and monitored the contents of $File_Name while it ran through that loop and this is what I get.

Explorer Window: C:Program Files7-Zip Selection(s)

C:Program Files7-ZipHistory.txt

C:Program Files7-ZipLicense.txt

C:Program Files7-Zipreadme.txt

@@ Debug(161) : $File_Name = 1

>Error code: 0

@@ Debug(161) : $File_Name = C:Program Files7-Zip

>Error code: 0

@@ Debug(161) : $File_Name = C:Program Files7-ZipHistory.txt

>Error code: 0

@@ Debug(161) : $File_Name = C:Program Files7-ZipLicense.txt

>Error code: 0

@@ Debug(161) : $File_Name = C:Program Files7-Zipreadme.txt

>Error code: 0

From everything I've read and done with For loops before, this should NOT be happening the way it is. There appears to be a bug in the code for For/Next in that it's acting like it's a For/In/Next loop instead. I apologize for not testing this before I said the previous.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Moderators

sbrady,

So the FileCopy fails. Now we have something to work on. :)

Are the parameters correct - are you using the correct current path and new path? Do you have write permission for that folder (although as you can apparently delete you probably do)? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

sbrady,

See now how errorchecking helps? ;)

Next step - what exactly do you have as $orig_file_name? You say that the SRE I gave you works on XP - so there must be something different with the starting value on the Win7 box. What do you pass to the SRE that fails? :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

sbrady,

I not believe that the SRE engine in AutoIt is OS-sensitive. ;)

So there must be something else going wrong. Are you sure that there is absolutely no difference between the file names you feed into the SRE from the XP and Win7 boxes? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

When I ran the code above, substituting a pre-built array for the files selected from the Windows Explorer window, I get the correct results in the output.

Here's the modified code, with consolewrites for each variable along the way.

;start
    Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ComErrFunc")
    $aWinList = WinList("[REGEXPCLASS:^(Explore|Cabinet)WClass$]")
;~  For $i = 1 To $aWinList[0][0]
     ; Get base folder and selections
;~   $aSelection = _ExplorerWinGetSelectedItems($aWinList[$i][1])
     Global $aSelection[3] = ["C:folderfolderfolderAR123 Smith, Bob v1 FULL MIX.txt", "C:folderfolderfolderAR123 Smith, Bob v1 SOT MIX.txt", "C:folderfolderfolderAR123 Smith, Bob v1 M&E MIX.txt"]
     ; Display as strings
     ConsoleWrite("Explorer Window: " & $aSelection[1] & " Selection(s)" & @CRLF)
     For $j = 2 To $aSelection[0] + 1
      ConsoleWrite(@TAB & $aSelection[$j] & @CRLF)
     Next
     ; START SHAWN's CODE____________________________
     ; repeat with the selected items
     For $File_Name = 1 To $aSelection
      ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $File_Name = ' & $File_Name & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
      ; check if file name contains "Full MIX" or "SOT MIX" or "M&E MIX"
      $result = StringInStr($File_Name, "mix", 0, 1)
      If $result > 0 Then
       $filename2 = StringInStr($File_Name, "", 0, -1) ;1st occurance from of "" from right (47 chars in)
       ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $filename2 = ' & $filename2 & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
       $the_folder_path = StringLeft($File_Name, $filename2) ; C:Documents and SettingssebradDesktopshawn
       ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $the_folder_path = ' & $the_folder_path & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
       $file_path_len = StringLen($File_Name) ; 79 characters
       ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $file_path_len = ' & $file_path_len & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
       $char_in_file_name = $file_path_len - $filename2 ;31
       ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $char_in_file_name = ' & $char_in_file_name & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
       $orig_file_name = StringRight($File_Name, $char_in_file_name) ;AR123 Smith, Bob v1 FULL MIX.txt
       ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $orig_file_name = ' & $orig_file_name & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
       $new_file_name = StringRegExpReplace($orig_file_name, "(?i)(.*)(sv.*)(s.*sMIX)(.txt)", "$1$3$2$4") ;AR123 Smith, Bob FULL MIX v1.txt
       ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $new_file_name = ' & $new_file_name & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
       ;MsgBox(4096, "THE result", $new_file_name)
;~     FileCopy($File_Name, ($the_folder_path & $new_file_name), 1) ; with overwright
;~     FileDelete($the_folder_path & $orig_file_name)
      EndIf
     Next
     ; END SHAWN's CODE________________________
;~  Next
    ;end

This is the code from the $button_3 section of the While loop. here is the output I get.

Explorer Window: C:folderfolderfolderAR123 Smith, Bob v1 SOT MIX.txt Selection(s)

@@ Debug(161) : $File_Name = 1

>Error code: 0

@@ Debug(161) : $File_Name = C:folderfolderfolderAR123 Smith, Bob v1 SOT MIX.txt

>Error code: 0

@@ Debug(166) : $filename2 = 24

>Error code: 0

@@ Debug(168) : $the_folder_path = C:folderfolderfolder

>Error code: 0

@@ Debug(170) : $file_path_len = 55

>Error code: 0

@@ Debug(172) : $char_in_file_name = 31

>Error code: 0

@@ Debug(174) : $orig_file_name = AR123 Smith, Bob v1 SOT MIX.txt

>Error code: 0

@@ Debug(176) : $new_file_name = AR123 Smith, Bob SOT MIX v1.txt

>Error code: 0

@@ Debug(161) : $File_Name = C:folderfolderfolderAR123 Smith, Bob v1 M&E MIX.txt

>Error code: 0

@@ Debug(166) : $filename2 = 24

>Error code: 0

@@ Debug(168) : $the_folder_path = C:folderfolderfolder

>Error code: 0

@@ Debug(170) : $file_path_len = 55

>Error code: 0

@@ Debug(172) : $char_in_file_name = 31

>Error code: 0

@@ Debug(174) : $orig_file_name = AR123 Smith, Bob v1 M&E MIX.txt

>Error code: 0

@@ Debug(176) : $new_file_name = AR123 Smith, Bob M&E MIX v1.txt

>Error code: 0

+>14:36:06 AutoIT3.exe ended.rc:0

>Exit code: 0 Time: 5.063

As you can see, the first file name is missing due to the way you have your For loop set up, but all the others are working as expected.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Moderators

sbrady,

I did not ask if the scripts were different - I asked if the values passed to the SRE are different. Certain folders are named differently in different OSes (particularly if you have an x32/x64 mismatch) and that might be the cause of the problem. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...