Does work with Windows 7, but not in Windows 10 Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
mrdigitalis
Posts: 67
Joined: 23 May 2022, 01:17

Does work with Windows 7, but not in Windows 10

Post by mrdigitalis » 23 Sep 2022, 13:55

Dear Form-Members,

I have two functions, and both functions are working perfect in Windows 7 (on a citrix server), but now the system is migrated to Windows 10.
But now these two functions don't work now. I do not have a clue why this is not working now. Does someone see why it is not working on Win 10?

Code: Select all

searchFilesAndDuplicate()
{
  Loop, Files, M:\HNG\_Shared\Breng-Planning\muurkranten\Muurkranten + Opkomststaten 308 en 151\AutoModus\*.*
  {
    FileGetTime, OutputVar, M:\HNG\_Shared\Breng-Planning\muurkranten\Muurkranten + Opkomststaten 308 en 151\AutoModus\*.*, M
    FormatTime, DateCreated, %A_LoopFileTimeCreated%, dd-M-yyyy
    FormatTime, CurrentDateTime,, dd-M-yyyy

    if (CurrentDateTime = DateCreated)
    {
      if (!instr(A_LoopFileName,"_DPL"))
      {
        if (instr(A_LoopFileName,"308_OPK"))
        {
          i=1
          Loop, 2
          {
            newFileName := substr(A_LoopFileName,1,-4)
            newFileName .= "_DPL" . i . ".pdf"
            FileCopy, % A_LoopFileFullPath, % "M:\HNG\_Shared\Breng-Planning\muurkranten\Muurkranten + Opkomststaten 308 en 151\AutoModus\" . newFileName
            i++
          }
        }
        i=1
        if (instr(A_LoopFileName,"308_WEEK"))
        {
          newFileName := substr(A_LoopFileName,1,-4)
          newFileName .= "_DPL" . i . ".pdf"
          FileCopy, % A_LoopFileFullPath, % "M:\HNG\_Shared\Breng-Planning\muurkranten\Muurkranten + Opkomststaten 308 en 151\AutoModus\" . newFileName
        }
        i=1
        if (instr(A_LoopFileName,"308_DAG"))
        {
          newFileName := substr(A_LoopFileName,1,-4)
          newFileName .= "_DPL" . i . ".pdf"
          FileCopy, % A_LoopFileFullPath, % "M:\HNG\_Shared\Breng-Planning\muurkranten\Muurkranten + Opkomststaten 308 en 151\AutoModus\" . newFileName
        }
      }
    }
  }
  searchFilesAndDuplicate_Status_Message :=
  (
    "PDFs zijn succesvol gedupliceerd
    Dit venster sluit binnen 3 seconden! "
  )
  msgbox,,PDFTK Status,%searchFilesAndDuplicate_Status_Message%,3
}

/**
 * Functie collectPDFs
 *
 * Beschrijving: Verzamel alle PDFs van een bepaalde dag
 *               en creeër 1 grote PDF-file
 *
 */
collectPDFs()
{
  oneven_bat_Path := "H:\Settings\Desktop\AutoHotkey_1.1.33.10\Bat_files\oneven.bat"
  blank_PDF_Path_Landscape := "H:\Settings\Desktop\AutoHotkey_1.1.33.10\PDFTK\blank_LS.pdf"
  blank_PDF_Path_Portrait := "H:\Settings\Desktop\AutoHotkey_1.1.33.10\PDFTK\blank_PT.pdf"
  Loop, Files, M:\HNG\_Shared\Breng-Planning\muurkranten\Muurkranten + Opkomststaten 308 en 151\AutoModus\*.*
  {
    FileGetTime, OutputVar, M:\HNG\_Shared\Breng-Planning\muurkranten\Muurkranten + Opkomststaten 308 en 151\AutoModus\*.*, M
    FormatTime, DateCreated, %A_LoopFileTimeCreated%, dd-M-yyyy
    FormatTime, CurrentDateTime,, dd-M-yyyy

    if (CurrentDateTime = DateCreated)
    {
      PDF_IN = "%A_LoopFileFullPath%"
      PDF_IN_Total .= PDF_IN A_Space

      ;checken of de file een oneven aantal paginas heeft
      RunWait, %comspec% /c H:\Settings\Desktop\AutoHotkey_1.1.33.10\Bat_files\oneven.bat %PDF_IN%, , hide
      ;msgbox ErrorLev: %ErrorLevel%
      if (ErrorLevel > 1)   ;er ging wat mis??
      {
        SoundBeep, 1500
        msgbox, something went wrong in Oneven (errorlevel for oneven.bat)
      }
      if (ErrorLevel = 1)   ;errorlevel 1 is oneven
      {
        if (instr(PDF_IN,"WEEK") or instr(PDF_IN,"DAG")) ; Week en Dagplanning worden afgedrukt in Portrait
        {
          PDF_IN_Total .= """" blank_PDF_Path_Portrait """" A_Space
        }
        else
        {
          PDF_IN_Total .= """" blank_PDF_Path_Landscape """" A_Space ; Opkomststaten worden afgedrukt in Landscape
        }
      }
    }
  }

  PDFKT_Path := "H:\Settings\Desktop\AutoHotkey_1.1.33.10\PDFTK\App\pdftkbuilder\pdftk.exe"
  DateTomorrow := Add_Days_to_CurrentDate_ShortDate(1)
  NewFile := "M:\HNG\_Shared\Breng-Planning\muurkranten\Muurkranten + Opkomststaten 308 en 151\AutoModus\" . "_Alle-PDFs-Samen-" . DateTomorrow . "_.pdf"
  RunWait, %comspec% /c ""%PDFKT_Path%" %PDF_IN_Total% "output" "%NewFile%"", ,hide
  if ErrorLevel > 0
  {
    SoundBeep, 3000
    msgbox, Something went wrong in PDF_In_Total
  }
  Else
  {
    PDFTK_Status_Message :=
    (
      "PDFs zijn succesvol verzameld
      Dit venster sluit binnen 3 seconden! "
    )
    msgbox,,PDFTK Status,%PDFTK_Status_Message%,3
  }
}

Thanks in advance for the help!

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Does work with Windows 7, but not in Windows 10

Post by swagfag » 23 Sep 2022, 14:33

clearly it's due to something in ur environment having changed. step through the script with the debugger and check what is doing that u aren't expecting. u obviously know its not doing something its supposed to

mrdigitalis
Posts: 67
Joined: 23 May 2022, 01:17

Re: Does work with Windows 7, but not in Windows 10  Topic is solved

Post by mrdigitalis » 26 Sep 2022, 01:18

Solved

I misspelled a word (forgot a capital letter).

Apparently is a path in Windows 10 case sensitive!

RussF
Posts: 1229
Joined: 05 Aug 2021, 06:36

Re: Does work with Windows 7, but not in Windows 10

Post by RussF » 26 Sep 2022, 06:26

Windows 10 by default does not have case sensitive paths. As of the April 2018 update, however, you can manually (through Powershell) configure paths for case sensitivity. As I understand it, you have to do it on a path-by-path basis - there is no global setting.

That said, are the drives you've mapped (M: and H:) located on a NAS (Network Attached Storage) device? I know TrueNAS has the ability to force case-sensitivity on a global basis - I'm sure others do as well.

Russ

Post Reply

Return to “Ask for Help (v1)”