Search the Community
Showing results for tags '@scriptdir'.
Found 2 results
Hi guys, I'm either going crazy or AutoIT is.. Basically I need to get to the parent folder of @scriptdir, to do that, I used: $parentFolder=StringLeft(@ScriptDir, StringInStr(@ScriptDir, "\", 0, -1)) So far, all good. When I use MsgBox to show $parentfolder, I'm indeed able to see the folder above @scriptdir. Now, I've added a subfolderfile to the string with: $PPID_Bulk_Big_printers_csv_path=$parentFolder&'Printers\printers_PPID_Big.csv' And also here, all fine, MsgBox shows me the file location correctly. Now, for some weird reason, $PPID_Bulk_Big_printers_csv_path changes again! See the complete part of the script below: ; CSV to 2D array $parentFolder=StringLeft(@ScriptDir, StringInStr(@ScriptDir, "\", 0, -1)) ;Goes one folder up MsgBox(0,'',@ScriptDir&'----'&$parentFolder&'Printers\printers_PPID_Big.csv') $PPID_Bulk_Big_printers_csv_path=$parentFolder&'Printers\printers_PPID_Big.csv' ;CSV location Dim $PPID_Bulk_Big_printers $PPID_Bulk_Big_filereadtoarray_result = _FileReadToArray($PPID_Bulk_Big_printers_csv_path, $PPID_Bulk_Big_printers) ;$PPID_Bulk_Big_filereadtoarray_result will contain any error (if there's any) - $printers is an array which contains the list of printers MsgBox(0,'',$PPID_Bulk_Big_printers_csv_path) ; Still shows correct path ;Check if there was any error with the _FileReadToArray If $PPID_Bulk_Big_filereadtoarray_result <> 0 Then ;If no error reading the file ;Do Something Else ;If there was an error reading the CSV file MsgBox(0,'hhh',"msg="&$PPID_Bulk_Big_printers_csv_path) MsgBox(48,'Problem detected!','The file "'&$PPID_Bulk_Big_printers_csv_path&'" was not found. Software will exit!') Sleep (50) Exit EndIf So what's happening here is, I'm getting into the ELSE part of the script, so there was an error with reading the file and I'm getting indeed the message box with "Problem detected!" but NOT the message box above?? Why? Cheers