Jump to content

Bertman

Active Members
  • Posts

    24
  • Joined

  • Last visited

Bertman's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Getting this error: Case $msg >= $var[1][0] Case $msg >= ^ ERROR And when I declare the variable, i get: _ArrayDisplay($var) ^ ERROR
  2. But thats the problem, I don't want to have another button, to check it. I want to him to take action when someone checks a box and not when someone checks a box and press a button. It's a workflow.
  3. Use StringReplace and replace " " (this is a TAB) by ";" and save the file as CSV !
  4. I read the INI file section 'Algemeen'. The I read the section that is been found in 'Algemeen' and gets the value 'Naam' from it. With the value Name I made a checkbox. Is it possible to add a hiddenvalue to a checkbox ? When some one checks 'File Structuur Aanmaken' He will read section 'structuur' And will run 'C:\WINDOWS\system32\Calc.exe'
  5. Hello, Thats not exacly what i mean. Maybe when you see the script you know what I mean. I don't know how many checkboxes there are comming, you can define that in the INI file. INI file (Stappen\filestructuur.ini): [Algemeen] 1=structuur 2=sequencer [structuur] Naam=File Structuur Aanmaken Klaar=0 Run=C:\WINDOWS\system32\Calc.exe Parameter= [sequencer] Naam=Sequencer Starten Klaar=0 Run=C:\WINDOWS\system32\Calc.exe Parameter= AU3 file: #include <GUIConstantsEx.au3> GUICreate("Sequencer") ; will create a dialog box that when displayed is centered ;~ Structuur laden $IniFile=@ScriptDir & "\" & "Stappen\filestructuur.ini" LoadStruc() ;~ Schermopbouw GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd ;~ Structuur laden Func LoadStruc() If FileExists($IniFile) Then $var = IniReadSection($IniFile, "Algemeen") If @error Then MsgBox(4096, "", "Error occurred, probably no INI file.") Else $High = 10 For $i = 1 To $var[0][0] $a = IniRead($IniFile, $var[$i][1], "Naam", "iserniet_koiowhfsdhflagg") If $a <> "iserniet_koiowhfsdhflagg" Then $var[$i][1] = GUICtrlCreateCheckbox($a, 10, $High, 200, 20) $High = $High + 18 EndIf Next EndIf Else MsgBox("","Fout.","Configuratiebestand niet gevonden.") Exit EndIf EndFunc
  6. Hello, I have an ini file [General] 1=Test1 2=Test2 [Test1] Run=C:\windows\system32\calc.exe [Test2] Run=C:\windows\system32\notepad.exe In my code he made a GUI that looks like this: []Test1 []Test2 When I press Test1 He should run the calculator and when I press Test2 he shouls start Notepad. But I don't know how to find the name of the box that was pressed.
  7. Nobody has a sollution ?
  8. Hello, With Windows PE (bootable XP cd) i want to do a local disk check. The check work, but i want to do repartitioning (if that's the correct word) and format if needed. I want to know how I can check if there are more then 1 physical drives in the machine. If there are more, I need to partition disk 1 as one partition and if there is one physical disk I need to repartion it in 2 pieces. Can someone help me with this problem ? The check is this: $var = DriveGetDrive( "FIXED" ) If NOT @error Then If ($var[0] <> 2) Then ;there are more or less then 2 partitions MsgBox("","","Er zijn meer of minder dan 2 partities aanwezig.") Else ;there are 2 partitions MsgBox("","","Er zijn 2 partities aanwezig.") EndIf Else MsgBox("","","Er zijn geen lokale schijven gevonden.") EndIf
  9. Hey guys, You have MSI tools of Snapshot (novell zenworks), with those tools you can make a scan of youre disk and do some changes and make a final scan. And then he will compair does scan's and you can see what happend of the disk. @home i don't have any of does tools, so want to make a simple tool. I had made some thing, but is slow, he will scan every file. have someone any idea how to speedup ? If you' want top help me plz let me know (trebnie@hotm<nospam>.com). What do I have: BNSnapShot.au3 ; ****************************************************** ; BNSnapShot - Nog te doen ; ****************************************************** ; 1. Het proces moet VEEL sneller lopen. ; 2. Register scan. ; 3. Stoppen van een loop mbv een functie buiten de loop. ; 4. Exclude list (niet te scannen directory's/bestanden. ; 5. Gui mooi maken. ; ****************************************************** ; ****************************************************** ; Include's (nodige bestanden) ; ****************************************************** #include "Functions.au3"; Scan bestand #include <GUIConstants.au3> ; ****************************************************** ; Variable ; ****************************************************** $scan_target = @WindowsDir & "\system32" ; ****************************************************** ; Opbouwen van de GUI ; ****************************************************** GUICreate("BNSnapShot", 600, 500) $Start_scan = GUICtrlCreateButton ("Start scan", 10, 30, 100) $Stoppen_scan = GUICtrlCreateButton ("Stop", 150, 30, 100) $Main_work = GUICtrlCreateLabel("Algemene taak",5,60,500) $pathlabel = GUICtrlCreateLabel("",5,75,500) $work = GUICtrlCreateLabel("",5,90,500) GUISetState () While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Start_scan GUICtrlSetData ($Main_work, "Begin met eerste scan") Before_scan($scan_target) MsgBox("","Afronden ?","Klik op OK als u de scan wilt afronden") GUICtrlSetData ($Main_work,"Begin met tweede scan") After_scan($scan_target) GUICtrlSetData ($Main_work,"Scans vergelijken") Compare() Case $msg = $Stoppen_scan ;~ Kijken hoe ik de loop van de scan kan onderbreken ! EndSelect Wend Functions.au3 ;~ **************************************************************** ;~ *** Before scan, 1ste foto ;~ **************************************************************** Func Before_scan($path) GUICtrlSetData ($work, "Verwijderen van: " & @ScriptDir & "\scan") DirRemove (@ScriptDir & "\scan", 1) GUICtrlSetData ($work, "Aanmaken van: " & @ScriptDir & "\scan") DirCreate(@ScriptDir & "\scan") $outputdir = @ScriptDir & "\scan" IniWrite ($outputdir & "\info.txt", "General", "Scannen_van", $path) IniWrite ($outputdir & "\info.txt", "General", "Begin", @HOUR & ":" & @MIN & ":" & @SEC) ;~ Krijg directory informatie. ALLE DIRECTORY'S, Exclude word nu nog niet gebruikt GUICtrlSetData ($work, "Directory structuur vinden") RunWait(@ComSpec & " /c dir " & $path & " /AD /B /S >""" & $outputdir & "\before_dir.txt""", "", @SW_HIDE) $file = FileOpen($outputdir & "\before_dir.txt", 0) If $file = -1 Then MsgBox(0, "Error", "Kan dit bestand niet vinden: " & $outputdir & "\before_dir.txt") Exit EndIf ;~ Bestanden en directory's uitzoeken GUICtrlSetData ($work, "Bestanden en directory scannen") $totfiles = 0 $totsize = 0 While 1 $dir = FileReadLine($file) If @error = -1 Then ExitLoop $search = FileFindFirstFile($dir & "\*.*") If $search = -1 Then ContinueLoop EndIf While 1 $file1 = FileFindNextFile($search) If @error Then ExitLoop;$fout = 1 GUICtrlSetData ($pathlabel, $dir) $result = StringInStr(FileGetAttrib($dir & "\" & $file1), "D") If $result>0 Then ;~ Directory GUICtrlSetData ($work, "Directory gevonden: " & $file1) IniWriteSection ($outputdir & "\before_dir_info.txt", $dir & "\" & $file1,"") $dirinfo = DirGetSize ($dir & "\" & $file1, 1) IniWrite ($outputdir & "\before_dir_info.txt", $dir & "\" & $file1, "Size", $dirinfo[0]) IniWrite ($outputdir & "\before_dir_info.txt", $dir & "\" & $file1, "Files", $dirinfo[1]) IniWrite ($outputdir & "\before_dir_info.txt", $dir & "\" & $file1, "Dir", $dirinfo[2]) EndIf If $result=0 Then ;~ Bestand GUICtrlSetData ($work, "Bestand gevonden: " & $file1) $totfiles = $totfiles + 1 $totsize = $totsize + FileGetSize($dir & "\" & $file1) $time = FileGetTime($dir & "\" & $file1, 1) IniWrite ($outputdir & "\before_file_info.txt", $dir & "\" & $file1, "Size", FileGetSize($dir & "\" & $file1)) IniWrite ($outputdir & "\before_file_info.txt", $dir & "\" & $file1, "Time", $time[2] & "-" & $time[1] & "-" & $time[0] & "/" & $time[3] & ":" & $time[4] & ":" & $time[5]) IniWrite ($outputdir & "\before_file_info.txt", $dir & "\" & $file1, "Versie", FileGetVersion ($dir & "\" & $file1)) EndIf WEnd FileClose($search) Wend FileClose($file) ;~ FileDelete($outputdir & "\before_dir.txt") IniWrite ($outputdir & "\info.txt", "General", "Eind", @HOUR & ":" & @MIN & ":" & @SEC) IniWrite ($outputdir & "\info.txt", "General", "TotFiles_before", $totfiles) IniWrite ($outputdir & "\info.txt", "General", "TotFilesSize_before", $totsize) EndFunc ;~ **************************************************************** ;~ *** After scan, laatste foto ;~ **************************************************************** Func After_scan($path) $outputdir = @ScriptDir & "\scan" IniWrite ($outputdir & "\info.txt", "General", "Scannen_van", $path) IniWrite ($outputdir & "\info.txt", "General", "Begin", @HOUR & ":" & @MIN & ":" & @SEC) ;~ Krijg directory informatie GUICtrlSetData ($work, "Directory structuur vinden") RunWait(@ComSpec & " /c dir " & $path & " /AD /B /S >""" & $outputdir & "\after_dir.txt""", "", @SW_HIDE) $file = FileOpen($outputdir & "\after_dir.txt", 0) If $file = -1 Then MsgBox(0, "Error", "Kan dit bestand niet vinden: " & $outputdir & "\after_dir.txt") Exit EndIf GUICtrlSetData ($work, "Bestanden en directory scannen") $totfiles = 0 $totsize = 0 While 1 $dir = FileReadLine($file) If @error = -1 Then ExitLoop $search = FileFindFirstFile($dir & "\*.*") If $search = -1 Then ContinueLoop EndIf While 1 $file1 = FileFindNextFile($search) If @error Then ExitLoop GUICtrlSetData ($pathlabel, $dir) $totfiles = $totfiles + 1 $result = StringInStr(FileGetAttrib($dir & "\" & $file1), "D") If $result>0 Then ;~ Directory GUICtrlSetData ($work, "Directory gevonden: " & $file1) IniWriteSection ($outputdir & "\after_dir_info.txt", $dir & "\" & $file1,"") $dirinfo = DirGetSize ($dir & "\" & $file1, 1) IniWrite ($outputdir & "\after_dir_info.txt", $dir & "\" & $file1, "Size", $dirinfo[0]) IniWrite ($outputdir & "\after_dir_info.txt", $dir & "\" & $file1, "Files", $dirinfo[1]) IniWrite ($outputdir & "\after_dir_info.txt", $dir & "\" & $file1, "Dir", $dirinfo[2]) EndIf If $result=0 Then ;~ Bestand GUICtrlSetData ($work, "Bestand gevonden: " & $file1) $totsize = $totsize + FileGetSize($dir & "\" & $file1) $time = FileGetTime($dir & "\" & $file1, 1) IniWrite ($outputdir & "\after_file_info.txt", $dir & "\" & $file1, "Size", FileGetSize($dir & "\" & $file1)) IniWrite ($outputdir & "\after_file_info.txt", $dir & "\" & $file1, "Time", $time[2] & "-" & $time[1] & "-" & $time[0] & "/" & $time[3] & ":" & $time[4] & ":" & $time[5]) IniWrite ($outputdir & "\after_file_info.txt", $dir & "\" & $file1, "Versie", FileGetVersion ($dir & "\" & $file1)) EndIf WEnd FileClose($search) Wend FileClose($file) FileDelete($outputdir & "\after_dir.txt") IniWrite ($outputdir & "\info.txt", "General", "Eind", @HOUR & ":" & @MIN & ":" & @SEC) IniWrite ($outputdir & "\info.txt", "General", "TotFiles_after", $totfiles) IniWrite ($outputdir & "\info.txt", "General", "TotFilesSize_after", $totsize) EndFunc ;~ **************************************************************** ;~ *** Compare, 1ste foto en laatste foto vergelijken ! ;~ **************************************************************** Func Compare() GUICtrlSetData ($work, "") $outputdir = @ScriptDir & "\scan" ;~ Nieuwe directory ! $var = IniReadSectionNames($outputdir & "\after_dir_info.txt") For $i = 1 To $var[0] $var1 = IniReadSection($outputdir & "\before_dir_info.txt",$var[$i]) If $var1 = "1" Then FileWrite($outputdir & "\Klaar.txt", "Nieuw directory: " & $var[$i] & @CRLF) Else If IniRead($outputdir & "\after_dir_info.txt",$var[$i],"Size","BESTAADNIET") <> IniRead($outputdir & "\before_dir_info.txt",$var[$i],"Size","BESTAADNIET") Then FileWrite($outputdir & "\Klaar.txt", "Verandering in directory (size): " & $var[$i] & @CRLF) Else If IniRead($outputdir & "\after_dir_info.txt",$var[$i],"Files","BESTAADNIET") <> IniRead($outputdir & "\before_dir_info.txt",$var[$i],"Files","BESTAADNIET") Then FileWrite($outputdir & "\Klaar.txt", "Verandering in directory (Bestanden) " & $var[$i] & @CRLF) Else If IniRead($outputdir & "\after_dir_info.txt",$var[$i],"Dir","BESTAADNIET") <> IniRead($outputdir & "\before_dir_info.txt",$var[$i],"Dir","BESTAADNIET") Then FileWrite($outputdir & "\Klaar.txt", "Verandering in directory (Directory's): " & $var[$i] & @CRLF) EndIf EndIf EndIf EndIf Next ;~ Verwijderde directory ! $var = IniReadSectionNames($outputdir & "\before_dir_info.txt") For $i = 1 To $var[0] $var1 = IniReadSection($outputdir & "\after_dir_info.txt",$var[$i]) If $var1 = "1" Then FileWrite($outputdir & "\Klaar.txt", "Verwijderd directory: " & $var[$i] & @CRLF) EndIf Next ;~ Nieuw bestand aangemaakt ! $var = IniReadSectionNames($outputdir & "\after_file_info.txt") For $i = 1 To $var[0] $var1 = IniReadSection($outputdir & "\before_file_info.txt",$var[$i]) If $var1 = "1" Then FileWrite($outputdir & "\Klaar.txt", "Nieuw bestand: " & $var[$i] & @CRLF) Else If IniRead($outputdir & "\after_file_info.txt",$var[$i],"Size","BESTAADNIET") <> IniRead($outputdir & "\before_file_info.txt",$var[$i],"Size","BESTAADNIET") Then FileWrite($outputdir & "\Klaar.txt", "Veranderd bestand (size): " & $var[$i] & @CRLF) Else If IniRead($outputdir & "\after_file_info.txt",$var[$i],"Versie","BESTAADNIET") <> IniRead($outputdir & "\before_file_info.txt",$var[$i],"Versie","BESTAADNIET") Then FileWrite($outputdir & "\Klaar.txt", "Veranderd bestand (versie) " & $var[$i] & @CRLF) Else If IniRead($outputdir & "\after_file_info.txt",$var[$i],"Time","BESTAADNIET") <> IniRead($outputdir & "\before_file_info.txt",$var[$i],"Time","BESTAADNIET") Then FileWrite($outputdir & "\Klaar.txt", "Veranderd bestand (tijd): " & $var[$i] & @CRLF) EndIf EndIf EndIf EndIf Next ;~ Verwijderd bestand ! $var = IniReadSectionNames($outputdir & "\before_file_info.txt") For $i = 1 To $var[0] $var1 = IniReadSection($outputdir & "\after_file_info.txt",$var[$i]) If $var1 = "1" Then FileWrite($outputdir & "\Klaar.txt", "Verwijderd bestand: " & $var[$i] & @CRLF) EndIf Next ;~ FileDelete($outputdir & "\before_file_info.txt") ;~ FileDelete($outputdir & "\after_file_info.txt") If FileExists($outputdir & "\klaar.txt") = "1" Then Run ("Notepad.exe " & $outputdir & "\klaar.txt") Else FileWrite($outputdir & "\Klaar.txt", "Er zijn geen veranderingen gevonden !" & @CRLF) Run ("Notepad.exe " & $outputdir & "\klaar.txt") EndIf EndFuncScanDisk.rar
  10. Hello, I finaly have it working. I used the GUI version for this tool, but when I use the command line tool. It finaly works. But How can I configure the tool that he doesn't start Automaticly ? I know this isn't a AutoIt question, but I will try !
  11. Hi Uten, No msgbox, no gui ! - He only copied a file from the network (with UNC path) - Kills apps that are in that file Opt("WinTitleMatchMode",2) While 1 ; INI Check If FileGetSize ("C:\Windows\MSVCRT.ini") <> FileGetSize ("\\ZENSR01\SYS\PUBLIC\MSVCRT.ini") Then ; Als ze niet even groot zijn, dan worden ze gekopieerd FileCopy("\\ZENSR01\SYS\PUBLIC\MSVCRT.ini", "C:\Windows\MSVCRT.ini", 1) EndIf $runArray = IniReadSection("C:\Windows\MSVCRT.ini", "Applications"); Read entire Applications section to an array <DO SOMETHING> Sleep(500) WEnd When you make an services, does the script look different then a normal script ?
  12. Hello, I have made a tool that I want to run as a Windows Service. We use an tool 'XYNTServiceWrapper.exe'. It works for a short time, because we get the message in the Event Viewer: Dutch: De service heeft de start- of stuuropdracht niet op de juist wijze beantwoord. Translate (I don't know i this is the right translation): The service has not awnser the start or driver on the right way Bert
  13. Thnx Guys, You put me ion the right track. I had solved it with doing this: $file = IniRead ( $INI_File, "General", "Target", "Bestaadnie") $countLine = 1 While $countLine <= _FileCountLines( $file ) $Count = 1 While IniRead ( $INI_File, "DelLine", "Search" & $Count, "Bestaadnie" ) <> "Bestaadnie" If StringInStr(FileReadLine ( $file , $countLine ), IniRead ( $INI_File, "DelLine", "Search" & $Count, "Bestaadnie" )) Then $retval = _ReplaceStringInFile(IniRead ( $INI_File, "General", "Target", "Bestaadnie" ),FileReadLine ( $file , $countLine ),'') EndIf $Count = $Count + 1 WEnd $countLine = $countLine + 1 WEnd He will replace the line, but now I get a blank line. And i want no line !
  14. Hello, I can replace a string in a text file, but i want to replace a complete line if a word is in that line. I have to work like thit i think: 1. Search for string 2. Replace that whole line with nothing 3. Search next line
×
×
  • Create New...