Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

FileClose Issue

$
0
0
Plain Text         
               Case $Num_PC                   Local $MyNum_PC = InputBox("Nump_PC", "Que voulez vous comme numéro de pc?"&@CRLF &"Pour Planitec 2.0")                   Local Const $NumPCPath = "C:\windows\system32\Num_PC.reg"                   _FileCreate ( $NumPCPath )                   Local $hFileOpen = FileOpen($NumPCPath, $FO_APPEND)                         If $hFileOpen = -1 Then                               MsgBox($MB_SYSTEMMODAL, "", "An error occurred when reading the file.")                         Return False                         EndIf                   FileOpen ($NumPCPath)                   FileWriteLine($hFileOpen, "Windows Registry Editor Version 5.00")                   FileWriteLine($hFileOpen, @CRLF)                   FileWriteLine($hFileOpen, "[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment]")                   FileWriteLine($hFileOpen,@CRLF)                   FileWriteLine($hFileOpen,'"NUM_PC"="'&$MyNum_PC&'"')                   FileClose ($NumPCPath)                   NumpRunDeletion ()

i got this case in my switch

 

I think if i understand good.... the "Case" keep the file open even if i do FileClose ($NumPCPath) until the "Case" is not ended

 

so i cant run the NumpRunDeletion () function properly becose i got a file usef error this is the commandprompt error message

(i see the file in my system32 and yes he is used becose i cant delet it while the script is running  )

E:\>C:\Windows\System32\cmd.exe /k C:\WINDOWS\System32\reg.exe Import Num_Pc.reg ERROR: Error opening the file. There may be a disk or file system error.

missed to give you the fonction :

Func NumpRunDeletion ()    ShellExecute (@ScriptDir & "\NUM-PC.bat")    FileDelete ($NumPCPath) EndFunc

the strange thing is shellexecute does not work

filedelete work... hmmmmmmmmmmm

 

 

I add this : if i close my script and try again  NumpRunDeletion () it s working


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>