Jump to content

sww

Members
  • Posts

    12
  • Joined

  • Last visited

Everything posted by sww

  1. Thanks for the comments. marfdaman: The reason I'm not using FileSelectFolder is because the folder doesn't always exist in the way that I use the app.
  2. Thanks, glad you liked it. Stuart
  3. v1.2 NEW RELEASE - If you have v1.0 or v1.1, please replace it with this --------------------------------------------------------------------------------------------------------- I put this together to save me some time and thought it might be of use to some other people. I haven't gone through it with a fine tooth comb, so any improvement comments would be welcome. Basically you give it a source directory, select whether or not you want it to include all files within subfolders. It then give you all the code you need to copy and paste it into a script. Stuart Opt("TrayIconDebug", 1) ;0=no info, 1=debug line info Opt("TrayIconHide", 0) ;0=show, 1=hide tray icon Opt("MustDeclareVars", 1) ;0=no, 1=require pre-declare Global $PROGRAM_NAME = "Multiple FileInstall() creator" CREATE_LIST() Func CREATE_LIST() Local $SOURCE_FOLDER = "" Local $DESTINATION_FOLDER = "" Local $SUB Local $FLAG Local $SOURCE_LOCATION = "" Local $DESTINATION_LOCATION = "" Local $CODE = "" Local $CODE_FILENAME = _SWWUniqueFilename(@TempDir, ".txt") ;--- Source Folder ------------------------------------------------------------------------------------------- ;Prompt for the source directory $SOURCE_FOLDER = FileSelectFolder("Please select your source directory", "") ;Exit if FileSelectFolder is cancelled If $SOURCE_FOLDER = "" Then Exit ;If the source folder doesn't have a trailing "\" then add a "\" If StringRight($SOURCE_FOLDER, 1) <> "\" Then $SOURCE_FOLDER = $SOURCE_FOLDER & "\" ;------------------------------------------------------------------------------------------------------------- ;--- Destination Folder -------------------------------------------------------------------------------------- ;Prompt for the destination directory $DESTINATION_FOLDER = InputBox($PROGRAM_NAME, "Please complete the destination path (e.g. C:\temp\new_location)") ;Exit if the above InputBox is cancelled or left blank If $DESTINATION_FOLDER = "" Then Exit ;If the destination folder doesn't have a trailing "\" then add a "\" If StringRight($DESTINATION_FOLDER, 1) <> "\" Then $DESTINATION_FOLDER = $DESTINATION_FOLDER & "\" ;------------------------------------------------------------------------------------------------------------- ;--- Set the value of $SUB so that it can be used as a switch in the dir command ----------------------------- If MsgBox(262144+32+4, $PROGRAM_NAME, "Would you like all sub-directories to be included?") = 6 Then $SUB = " /s" Else $SUB = "" EndIf ;------------------------------------------------------------------------------------------------------------- ;--- Set the value of $FLAG that is used in the FileInstall code --------------------------------------------- If MsgBox(262144+32+4, $PROGRAM_NAME, "In the FileInstall code, do you want the 'overwrite existing files' flag on?") = 6 Then $FLAG = 1 Else $FLAG = 0 EndIf ;------------------------------------------------------------------------------------------------------------- ;Get a file structure report and pipe it to a temporary file RunWait(@ComSpec & ' /c dir "' & $SOURCE_FOLDER & '" /b' & $SUB & " > " & @TempDir & "\dirdump.txt", "", @SW_HIDE) Local $X = 0 While 1 $X = $X + 1 $SOURCE_LOCATION = FileReadLine(@TempDir & "\dirdump.txt", $X) If @error <> 0 Then ExitLoop ;When the dir command is run without the subdirectory (/s) switch, the full path isn't outputed, therefore: If $SUB <> " /s" Then $SOURCE_LOCATION = $SOURCE_FOLDER & $SOURCE_LOCATION ;If the path entry is a directory then: If StringInStr(FileGetAttrib($SOURCE_LOCATION), "D") > 0 Then ContinueLoop Else $DESTINATION_LOCATION = $DESTINATION_FOLDER & StringReplace($SOURCE_LOCATION, $SOURCE_FOLDER, "") $CODE = $CODE & 'FileInstall("' & $SOURCE_LOCATION & '", "' & $DESTINATION_LOCATION & '", ' & $FLAG & ")" & @CRLF EndIf WEnd FileDelete(@TempDir & "\dirdump.txt") FileWrite(@TempDir & "\" & $CODE_FILENAME, $CODE) Run("C:\WINDOWS\system32\notepad.exe " & @TempDir & "\" & $CODE_FILENAME) EndFunc Func _SWWUniqueFilename($LOCATION, $EXTENSION) Local $UNIQUE_FILENAME ;Ensure that there is a trailing "\" on the end of the path If StringRight($LOCATION, 1) <> "\" Then $LOCATION = $LOCATION & "\" ;Ensure that there is a leading "." at the start of the extension If StringLeft($EXTENSION, 1) <> "." Then $EXTENSION = "." & $EXTENSION ;If the extension isn't valid return @error 1 If StringLen($EXTENSION) <> 4 Then SetError(1) Return EndIf While 1 ;Create a filename using a random number between 10000000 and 99999999 $UNIQUE_FILENAME = Random(10000000, 99999999, 1) & $EXTENSION ;If the random filename isn't unique, the loop again, otherwise, exit the loop If FileExists($LOCATION & $UNIQUE_FILENAME) = 1 Then ContinueLoop Else Return $UNIQUE_FILENAME EndIf WEnd EndFuncfileinstall_code_creator_v1.2.au3
  4. Hi John, After a bit of trawling I've found this http://support.microsoft.com/kb/291331
  5. melf: I've just downloaded the trial version of Microangelo and can't find any reference to creating dll's. I've looked all through the 'Librarian' app. All I can do is open dll's and extract icons. Any pointers? Thanks Stuart
  6. I've googled, but can only find freeware to create .icl files. I haven't found a method for creating a dll's.
  7. Hi, I'm looking for some freeware to convert a collection of icons into a .dll. If someone could help it'd be great. Thanks in advance. Stuart
  8. I can't believe I didn't spot that! I could have saved myself a bit of time there.
  9. I scripted this sometime back. I used CACLS. The only downside is that the CACLS command doesn't propergate through directories. This means that you have to set up a loop to query the file attributes. If its a folder, then go deeper into the file structure.
  10. Thanks for the quick reply. Its not either of those 2 though. The search feature disabling "html" makes finding it awkward! I want to a create a fresh html as opposed to pulling data from a completed webpage.
  11. Hi, I'm sure I stumbled across a set of HTML creation functions the other day but can't find it now. Can anyone please help?
×
×
  • Create New...