Jump to content

snowman533

Active Members
  • Posts

    118
  • Joined

  • Last visited

snowman533's Achievements

Adventurer

Adventurer (3/7)

0

Reputation

  1. Thanks GEOSoft, ill have a look later, just having a quick look at replies before i go to work
  2. because thats slower than using my program, more clicks = more time wasted second, you can't make anywhere near as many file types with that than what you can with mine, my program gives infinite functionality, no matter what file type you need third, yes you can rename the txt files you create with new to create almost any filetype but again its SLOW, AND lets not forget the potential file corruption that does occur from that from time to time the NEW context would be used mainly for if your only making a few files, but if you are mass file creating for a big project then NEW kinda makes the whole file making process slow i forgot to mention that this also doubles as a mass directory maker, why use NEW when you can create a directory containing say 5-10 consecutivefolders eg: folder1\subfolder\childfolder\sibling\ (took me 5 seconds to write that whereas with NEW that would have taken a good 2 mins of course everyone has their uses for stuff but for me NEW context is time wasting , and i generally dont get much time to go on the computer that doesnt seem to do anything in terms of keypresses, i once saw a keypress command but i cant find it, maybe that was AHK... Thanks for the feedback GEOSoft , heres the fix: Func GetDir() $DirLast = GUICtrlRead($TxtDir) $DirInput = FileSelectFolder("Where to Create your files?", "") If $DirInput = "" then GUICtrlSetData($DirInput, $DirLast) If $DirInput <> "" then GUICtrlSetData($TxtDir, $DirInput) EndFunc is there a way to check if theres anything inside a directory containing files of 0 bytes for my CreateDir function?
  3. Hey guys, im working on a file maker extremely efficient in setting up projects by allowing the user to pre-create the necessary files beforehand by removing the need to use notepad for file creation works beautifully, and i must admit its the best damn thing ive made (i use it on a daily basis) theres just a few things missing, see the comments in the code for what i need #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <Misc.au3> #Include <TreeViewConstants.au3> #include <TVExplorer.au3> $gui=GUICreate("File Maker", 500, 130) GUISetState(@SW_SHOW, $gui) $BtnCreateFile=GUICtrlCreateButton("Create", 10, 80, 50, 20) ;I want this to be "clicked" when Enter is pressed $BtnExit=GUICtrlCreateButton("Exit", 440, 10, 50, 20) $TxtDir = GUICtrlCreateInput("",10,10,200,20) $BtnBrowse =GUICtrlCreateButton("Browse",220,10,50,20) $TxtFile = GUICtrlCreateInput("file.extension",10,50,200,20) $BtnCreateDir = GUICtrlCreateButton("Make Dir",280, 10, 50, 20) While 1 $msg = GUIGetMsg() if $msg = $BtnCreateFile then CreateFile() if $msg = $BtnBrowse then GetDir() if $msg = $BtnCreateDir then CreateDir() if $msg = $BtnExit then ExitLoop If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() Func GetDir() $DirInput = FileSelectFolder("Where to Create your files?", "") GUICtrlSetData($TxtDir, $DirInput) ;Needed a function here to make getting the dir selected a bit easier EndFunc Func Createfile() $dir = GUICtrlRead($TxtDir) $file = GUICtrlRead($TxtFile) FileWrite($dir & '\' & $file,"") if @error then MsgBox(0, "Failure", "Something went wrong, make sure the file is entered and the directory has been created") ;this msg doesnt show, need a better error detection method EndFunc ;didnt see the need for a confirmation msg to say that the file was created ;as that would cause a small loss of time ;so long as the above error doesnt show, the user is free to make as many files as needed Func CreateDir() $dir = GUICtrlRead($TxtDir) DirCreate($dir) if not @error then MsgBox(0, "Success", "Dir created") EndFunc edit: once its fixed and polished, ill publish it and post a link here
  4. TVExplorer UDF is what i was after, but now its not showing anything on the control, maybe i have misunderstood it #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <Misc.au3> #Include <TreeViewConstants.au3> #include <TVExplorer.au3> $gui=GUICreate("File Maker", 500, 500) GUISetState(@SW_SHOW, $gui) $BtnCreate=GUICtrlCreateButton("Create", 10, 10, 50, 20) $BtnExit=GUICtrlCreateButton("Exit", 440, 10, 50, 20) $TreeView = _GUICtrlTVExplorer_Create(@SystemDir, 20, 48, 320, 310, -1, $WS_EX_CLIENTEDGE, -1, '_TVEvent') While 1 $msg = GUIGetMsg() if $msg = $BtnExit then ExitLoop If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() Func Create($dir) EndFunc edit: screw it ill just use FileSelectFolder and a textbox
  5. topic says it all #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <Misc.au3> $gui=GUICreate("File Maker", 500, 500) GUISetState(@SW_SHOW, $gui) $BtnCreate=GUICtrlCreateButton("Create", 10, 10, 50, 20) $BtnExit=GUICtrlCreateButton("Exit", 440, 10, 50, 20) $TreeView = GUICtrlCreateTreeView (10, 100,450, 200) While 1 $msg = GUIGetMsg() if $msg = $BtnExit then ExitLoop If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() Func Create($dir) EndFunc all i want to do is create a treeview where someone could select where in computer to create the files i gotta rewrite my file maker program as i lost the source, this feature is newer, if anyone remembers that Utils.exe or File Maker i posted a while back, which for some reason they longer exist on the forum thanks in advance
  6. still isnt deleting the Temp Files after poiinting it again to the <Username>\AppData\Local\Temp\*.* it just sits there, no success message, no activity at all (opening the temp dir shows all the temp files are still there) any ideas? using the code as is just simple puts a success message on screen hasnt actually done anything thats why i tried to repoint it to the username Temp folder
  7. still isnt looping fully test.au3
  8. fixed, now it seems to be causing a infinite loop any ideas? i know its something stupid but, stupid me cant put my finger on it :S also, where is AU3Check?? test.au3
  9. title says it all hello again guys it been ages since ive been on here, i have come accross an issue that i cant find anything about in the help file Line 37 $filedir=FileFindFirstFile(@Systemdir"\Users\"@Username"\Local\Temp") $filedir=FileFindFirstFile(^ERROR error:Error in expression what this is trying to do is remove temp files on a windows 7 user account, got big plans for this to be a highly useful optimization tool any ideas? thanks in advance source attached note: error doesnt occur until you press the "sweeper" button test.au3
  10. Thanks OHB $mm is supposed to be $mnum
  11. im getting a variable used without being declared error, its not telling me which line its on but the error does come up when Button8 is pressed (Sort Dir By Filename in GUI), i have looked at all vars used in Button8 and cannot locate any undefined ones, maybe you guys will find it heres the full script, just in case: http://pastebin.com/xVkif7AG
  12. Thanks M23 the program is now ready for a full release, i just gotta write the documentation Thanks again, if i need any more help (non related to dllcall) ill pm you
  13. Thanks M23 you are a massive help, now the next thing for me to figure out is the DLLCall any ideas in particular to help me learn this extremely complicated part of the coding? (i need to use it for my next addition to the program) i have DLLexplorer, but ive loaded it, taken one look at all the functions and im like (oohhh craaaaapp!!) thanks again in advance Edit: Also i have another easy question, how do i detect the default browser and launch a website using the detected browser?
  14. code: $path = GUICtrlRead($Input2) If DirGetSize(@ScriptDir & "\Data") = -1 Then DirCreate(@ScriptDir & "\Data") $file = FileOpen(@ScriptDir & "\Data\DD.txt", 1) FileWriteLine($file, $path & @CRLF) $fcontents = _FileReadToArray($file, $Farray) For $x = 1 to [!]$Farray[0] GUICtrlSetData($Combo1,$Farray[$x]) Next FileClose($file) [!] = Error: Subscript Used with non array variable trying to read the contents of the file to a combobox so when a new dir is selected so the combobox for default dirs is updated what am i missing? heres the full code if you need it: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #Include <File.au3> Dim $Farray filesortgui() Func filesortgui() $mnum = 0 #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("File Sorter v2.8", 771, 164, 283, 233) $MenuItem1 = GUICtrlCreateMenu("&File") $MenuItem3 = GUICtrlCreateMenuItem("Exit", $MenuItem1) $MenuItem2 = GUICtrlCreateMenu("&Help") $MenuItem4 = GUICtrlCreateMenuItem("Online Documentation", $MenuItem2) $Input1 = GUICtrlCreateInput("Extension", 8, 16, 161, 21) $Input2 = GUICtrlCreateInput("Directory...Click Browse", 8, 64, 161, 21) $Button1 = GUICtrlCreateButton("Sort", 184, 8, 145, 33, $WS_GROUP) $Button2 = GUICtrlCreateButton("Browse", 184, 56, 145, 33, $WS_GROUP) $Button3 = GUICtrlCreateButton("Sort Dir", 336, 56, 137, 33, $WS_GROUP) $Button4 = GUICtrlCreateButton("SortALL", 336, 8, 137, 33, $WS_GROUP) $Button5 = GUICtrlCreateButton("Dir SortALL", 480, 56, 137, 33, $WS_GROUP) $Button6 = GUICtrlCreateButton("Add Default Dir", 8, 104, 137, 33, $WS_GROUP) $Combo1 = GUICtrlCreateCombo("Select a saved Default Dir here...", 144, 112, 473, 25) $Input3 = GUICtrlCreateInput("File name contains?", 8, 40, 161, 21) $Button7 = GUICtrlCreateButton("Sort by FileName", 480, 8, 137, 33, $WS_GROUP) $Button8 = GUICtrlCreateButton("Dir Sort by FileName", 624, 56, 137, 33, $WS_GROUP) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button1 $extension = GUICtrlRead($Input1) $path = @WorkingDir & "\Sorted\" & $extension If DirGetSize($path) = -1 Then DirCreate($path) $hSearch = FileFindFirstFile("*." & $extension) $file = FileFindNextFile($hSearch) While Not @error If Not BitOR(@extended, $file = @ScriptName) Then ; Only for files -- and exclude the script itself FileMove($file, $path & "\" & $file) $mnum += 1 EndIf $file = FileFindNextFile($hSearch) WEnd FileClose($hSearch) MsgBox(1, "Files moved", $mnum & " files have been moved") $mnum = 0 Case $msg = $Button4 $hSearch = FileFindFirstFile("*.*") ; Get a file handle $file = FileFindNextFile($hSearch) While Not @error If Not BitOR(@extended, $file = @ScriptName) Then ; Only for files -- and exclude the script itself $extension = StringRegExpReplace($file, "(.*)\.(.*)", "\2") $path = @WorkingDir & "\Sorted\" & $extension If DirGetSize($path) = -1 Then DirCreate($path) FileMove($file, $path & "\" & $file) $mnum += 1 EndIf $file = FileFindNextFile($hSearch) WEnd MsgBox(1, "Files moved", $mnum & " files have been moved") $mnum = 0 FileClose($hSearch) Case $msg = $Button2 $dir = FileSelectFolder("sort files in where?", @DesktopDir, 2) GUICtrlSetData($Input2, $dir) Case $msg = $Button3 $path = GUICtrlRead($Input2) $extension = GUICtrlRead($Input1) $fncontains = GUICtrlRead($Input3) ;MsgBox(0, "test", $path & " " & $extension) If DirGetSize($path & "\Sorted\" & $extension) = -1 Then DirCreate($path & "\Sorted\" & $extension) $hSearch = FileFindFirstFile($path & "\*." & $extension) $file = FileFindNextFile($hSearch) While Not @error If Not BitOR(@extended, $file = @ScriptName) Then ; Only for files -- and exclude the script itself FileMove($path & "\" & $file, $path & "\Sorted\" & $extension & "\" & $file) $mnum += 1 EndIf $file = FileFindNextFile($hSearch) WEnd FileClose($hSearch) MsgBox(1, "Files moved", $mnum & " files have been moved") $mnum = 0 Case $msg = $MenuItem3 Exit Case $msg = $Button5 $pget = GUICtrlRead($Input2) $hSearch = FileFindFirstFile($pget & "\*.*") ; Get a file handle $file = FileFindNextFile($hSearch) While Not @error If Not BitOR(@extended, $file = @ScriptName) Then ; Only for files -- and exclude the script itself $extension = StringRegExpReplace($file, "(.*)\.(.*)", "\2") $path = $pget & "\Sorted\" & $extension If DirGetSize($path) = -1 Then DirCreate($path) FileMove($pget & "\" & $file, $path & "\" & $file) ; <<<<<<<<<<<<<<< compare this to what you had! $mnum += 1 EndIf $file = FileFindNextFile($hSearch) WEnd MsgBox(1, "Files moved", $mnum & " files have been moved") $mnum = 0 FileClose($hSearch) Case $msg = $Button7 $fncontains = GUICtrlRead($Input3) $path = @WorkingDir & "\Sorted\" & $fncontains If DirGetSize($path) = -1 Then DirCreate($path) $hSearch = FileFindFirstFile("*" & $fncontains & "*.*") $file = FileFindNextFile($hSearch) While Not @error If Not BitOR(@extended, $file = @ScriptName) Then ; Only for files -- and exclude the script itself FileMove($file, $path & "\" & $file) $mnum += 1 EndIf $file = FileFindNextFile($hSearch) WEnd FileClose($hSearch) MsgBox(1, "Files moved", $mnum & " files have been moved") $mnum = 0 Case $msg = $Button8 $pget = GUICtrlRead($Input2) $fncontains = GUICtrlRead($Input3) $hSearch = FileFindFirstFile($pget & "\*" & $fncontains & "*.*") ; Get a file handle $file = FileFindNextFile($hSearch) While Not @error If Not BitOR(@extended, $file = @ScriptName) Then ; Only for files -- and exclude the script itself $extension = StringRegExpReplace($file, "(.*)\.(.*)", "\2") $path = $pget & "\Sorted\" & $fncontains If DirGetSize($path) = -1 Then DirCreate($path) FileMove($pget & "\" & $file, $path & "\" & $file) ; <<<<<<<<<<<<<<< compare this to what you had! $mnum += 1 EndIf $file = FileFindNextFile($hSearch) WEnd MsgBox(1, "Files moved", $mm & " files have been moved") $mnum = 0 FileClose($hSearch) Case $msg = $MenuItem4 MsgBox(64, "Not Available", "Online Documentation currently unnavailable") Case $msg = $Button6 $path = GUICtrlRead($Input2) If DirGetSize(@ScriptDir & "\Data") = -1 Then DirCreate(@ScriptDir & "\Data") $file = FileOpen(@ScriptDir & "\Data\DD.txt", 1) FileWriteLine($file, $path & @CRLF) $fcontents = _FileReadToArray($file, $Farray) For $x = 1 to $Farray[0] GUICtrlSetData($Combo1,$Farray[$x]) Next FileClose($file) EndSelect WEnd EndFunc ;==>filesortgui note: top section of code wouldnt let me highlight the code error locator i put in, the [!] in red so i had to put it in as normal text
  15. ok i have a new problem this code is set to a button $path=GUICtrlRead($Input2) If DirGetSize(@ScriptDir &"\Data") = -1 Then DirCreate(@ScriptDir &"\Data") $file=_WinAPI_CreateFile(@ScriptDir & "\Data\DD.txt", 3) FileWriteLine (@ScriptDir & "\Data\DD.txt", $path) FileClose(@ScriptDir & "\Data\DD.txt") when i click the button it creates the Data Directory and DD.txt with no problems, but when i go to open DD.txt to se if its writing anything to it i get "windows cannot open this file because it is being accessed by another process" Unlocker says that it is being accessed by Autoit3.exe but, the file (should be) closed so why is it still being accessed? what have i done wrong in the code?
×
×
  • Create New...