I want to write an NSIS installer that scans a particular folder of the users file system, and adds a Section for each entry:
FindFirst $0 $1 $DOCUMENTS\Special
loop:
StrCmp $1 "" done
; Add section here!
FindNext $0 $1
Goto loop
done:
FindClose $0
However, I can't find a way to dynamically add sections. Is that possible?
The number of sections is set at compile time. It is possible to create hidden sections, so it is possible to make it seem dynamic if the maximum is known at compile time.
I don't know what you are doing with the files but I suggest you create a custom page with a listbox for the list of files...
Related
I've found similar requests but they don't quite fit my requirement. I've exhausted my searching and I've exhausted my limited skills.
Daily I create multiple new software projects creating the following folder structure:
"FOLDER 1" (root)
"Subfolder 1"
"subfolder 2" (inside subfolder 1).
Ive tried working with below but ideally i would like it to search for files with "quad bus" in the name and move those files.
tell application "Finder"
repeat with this_item in (selection of (folder of window 1))
move this_item to parent of parent of this_item
end repeat
end tell
I basically need to MOVE files added to subfolder 2 containing the word Quad Bus into the folder named to FOLDER 1.
The challenge I have is I can't specify the source and dest paths in the script so it would have to be a service that is run to execute the task in the focused or front finder window. Applescript seems to be the obvious choice but I've tried Python also.
The following Automator Service should get the basics for you, though I'm sure it could be improved. Open Automator, create a new Service, and set it up as shown in this image:
This uses two variables, which I called (with great creativity) ChosenFolder and DestinationFolder. You don't need to set values for them in Automator; values will be provided at runtime. Note that the fifth action (Get Value Of Variable) is set to ignore the input from the previous action. If you miss that break, Automator will throw an error, since it will add the destination folder into the list of items that need to be moved.
Sometime ago I worked in a team that developed a bunch of educational softwares and now they are been reviewed for bugs and updates.
During this process, I noticed that the folder "imgs" accumulated too many files. Probably one of the developers decided to include all the images used by each of the softwares into the folder. However, because there are too many softwares, it would be too painful to check manually all of them (and some of the images are part of the layout, almost invisible).
Is there a way to write a shell script in Linux to check if the files in a given folder are being used by a set of HTML and JS files in another folder?
Go to the images folder and try this
for name in *; { grep -ril $name /path/to/soft/* || echo "$name not used"; }
Im not sure I understood your question correctly,
But maybe this will help you
ls -1 your_source_path | while read file
do
grep -wnr "$file*" your_destination_path ||
echo "no matching for file $file"
# you can set any extra action here
done
in source_path you put director from hi will list all files name and destination where he should searching.
It is not possible to check for the generic case - since HTML and Javascript are two dynamic (e.g. the Javascript code could create the image file name on the file). Likewise, images can be specified in CSS style sheet, inline style, etc.
You want to review the HTML/JS files, and see if possible to identify the tags that are actually used to specify images. This will hopefully, reduce the number of XML tags and attribute names that need to be extracted.
As an alternative, if you have access to the 'access log' of the server, you can find out which images have been accessed over time, and focus the search on images not referenced in the log file.
I am trying to do some validation on the file name before it's saved.
Here are my three file-saving scenarios:
File > Save
File > Save As > Browse > Save
File > Save As > Save
Additional Info:
As defined in the Workbook_BeforeSave event, the SaveAsUI parameter will indicate whether or not a dialog box is needed to save changes.
✓ In scenario 1, SaveAsUI=False, so I get the filename from ThisWorkbook.Name
✓ In scenario 2, SaveAsUI=True, so I force a dialog and get the file name with the GetSaveAsFilename method
✗ In scenario 3, SaveAsUI=True, but no intermediary dialog is ever actually required! The file gets immediately saved to that name entered in the input box.
...it's ridiculous that I'm obsessing over this because I can just override scenario 3 and force a dialog anyways, but I'm curious. Any ideas?
I'm writing this as an answer, because the comment field is too small for it.
I found the mentioned file reference in the registry:
HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Excel\User MRU\AD_2B763A186A5179F1E2C2819B76BF6FDEF3F399938D48925BE3381441F2190369\File MRU
You'll need a find, either to open the Recent file list, or to find a way to read such a registry entry. One way (but quite a complicated one), the Shell command, as you can see here (commandline command):
reg query "HKCU\Software\Microsoft\Office\16.0\Excel\User MRU" /s
Launching this command and parsing the results might help you.
I found what was missing in our missing vocabulary: Built-In Dialog Box
As explained here, there is no way to get the file name from this dialog until after the save has been made.
We have Installshield 2009 for our product. I am trying to muddle my way through it to make some updates (obviously, I am not the original author).
Within, there is a fairly complex arrangement of components and files, plus, there is a script section for some custom work.
I need to accomplish the following, without creating a blank object in the repository.
One of the components needs to create a directory tree (two folders deep).
Within that tree (deepest folder), I need to create a blank file.
Questions:
Do I need to create two components, one for each directory level, or will the tree be created if I specify [INSTALLDIR]folder1\folder2?
I am thinking that the installscript would be the place to create the empty file, based on the CreateFile example in the help. I notice that, in the components page, that, once I typed the value for the Destination property, that a little "tag" of sorts appeared at the start {FOLDER2}. Can I used that tag as an argument to CreateFile and how would I reference it?
Regardless of the project type, I would probably suggest creating the folder structure in the Files and Folders view, and adding the empty file there. It's just simple and you'd be done with fewer chances of error.
As to the questions you asked, neither Basic MSI nor InstallScript projects require components for every folder level on the system. Note that if the folder isn't already there when it executes, the CreateFile approach is unlikely to create the folders for you.
In a Basic MSI project, {FOLDER2} indicates that FOLDER2 is the name of the directory entry, and after CostFinalize there will be a property of the same name that contains its run-time location. You can retrieve it in an InstallScript custom action with MsiGetProperty. In a pure InstallScript project the approach would be a little different, worst case it would be something like TARGETDIR ^ "folder1" ^ "folder2" (my InstallScript is rusty).
Is there anyway by which we can read a value from an .xls file using nant scripts.The nant scripts should ask the input from the user and based on the inputs the nant.build should search the .xls file and when it sees the match,it should copy the corresponding mail ID and echo that mail ID to some other file and that echoed value should be placed in the mail section of the cruise control.NET .
Please get back to me for any more clarifications
Thanks
GNR
You should write an NAnt extension. It is relatively easy to do.
See this tutorial here
As an example project see my question here and here.
I'll re-phrase my answer :
"Is there anyway by which we can read a value from an .xls file using nant scripts"
If you are talking about using the 'core' NAnt functionality, which is that funcationality that is provided within the basic installation of NAnt, then I would say "No" or "Not very easily".
You can however extend NAnt using .NET libraries to perform whatever function you want, as long as you can code that function in a .NET language.
So, for you to solve your problems, the steps you need to under-take in my view are :
(a) Write a .NET library with methods that undertake the function(s) you describe
(b) Use the 'extensibility' of NAnt to turn your library in (a) into a custom task you can then call directly from your NAnt script
Obviously, you need to be able to break your problem down so that you can code it for part (a). Once you have done that, part (b) is reasonably trivial, and the tutorial I supplied in the link should easily walk you through this.