Inno Setup, get string from filename - filenames

I need get partial filename from file in ISPP...
Example file: {tmp}\myexefile-x.x.x.x-yyyyy.exe
I need get x.x.x.x-yyyyy string to defined variable
#define MyString "x.x.x.x-yyyyy"
Thanks and regards... ;-)

Related

String variables in GAMS

How can I define a string variable in GAMS. I want to use it as a reference to including files as shown below
set file = "myfile.inc"; (i have no idea how to do this part)
$include file;
istead of
$include "myfile.inc"
$set file file_name_here
$include %file%.inc
File is being replaced by your desired filename.
Note that if you want to use this string variable in other included files too you have to use $setglobal instead of $set

How to convert DM-script files (*.s) into a plugin file (*.gtk)

I have written some DM-script files (.s), and thus I would like to convert (compile?) them into plugin files (.gtk). In this case, should I prepare some kind of compiler and Gatan Software Development Kit (SDK) package, or others? If there is a good way, please teach the procedure in detail. I will be really grateful, if you share some wisdom to create *.gtk files.
.GTK files are not compiled - you will not gain any speed benefit of having them in a .gtk (or .gt1, .gt2 ) file. They are only packed into those files for convenience of sharing and distributing them easily without sharing source code.
That said, the way to "pack" scripts into those files is to use a script-command itself, i.e. write a script which build these files from a set of .s files on the hard drive.
The command to add a script-file to a script package is AddScriptFileToPackage with the syntax:
void AddScriptFileToPackage( String file_path, String packageName, Number packageLevel, String packageLocation, String command_name, String menu_name, String sub_menu_name, Boolean isLibrary )
void AddScriptFileToPackage( String file_path, String packageName, Number packageLevel, String command_name, String menu_name, String sub_menu_name, Boolean isLibrary )
The command to add a script (string) to a script package is AddScriptToPackage with the syntax:
void AddScriptToPackage( String script, String packageName, Number packageLevel, String packageLocation, String command_name, String menu_name, String sub_menu_name, Boolean isLibrary )
void AddScriptToPackage( String script, String packageName, Number packageLevel, String command_name, String menu_name, String sub_menu_name, Boolean isLibrary )
The paramters in the two commands are:
Note, that the created plugin-file will by default appear in the user_plugin location:
C:\Users\USERNAME\AppData\Local\Gatan\Plugins
The second syntax allows specifying the path, where the packageLocation parameter might be any of the names also accepted in the command GetApplicationDirectory, most often either being user_plugin (see above) or just plugin referring to the current run DigitalMicrograph.exe relative plugin folder, i.e.
.\Plugins relative to where the DigitalMicrograph.exe sits, typically
C:\Program Files\Gatan\Plugins\
Note, that one can append scripts to an existing file, but can not "unistall" one from it. In that case, one has to delete the file and re-create it anew.
Also, if an error occurs in the to-be-added scripts, they will not install correctly and you might need to start over.
The F1 help documentation (of later GMS versions) has an example script showing how to typically use the command:
The difference between libary and command install is the same as when using the File-Menu command to "install a script". A library usually is a set of methods (or classes) which, when installed, remain available and in memory. The command installs a script as a menu-command to the UI. i.e. selecting the menu executes the scirpt (once).
While the "File/Install Script" install things into the general prefereces-file of DigitalMicrograph, the commands above create separate .gtk files which load on startup if found in the plugins-folder. Any code that is installed as "library" is run once on startup.

How to extract embedded resource from a namespace with special characters?

I'm trying to extract an embedded resource to VB.Net project (build action : Embedded resource) using the following command :
Dim StreamReader As StreamReader
StreamReader = New StreamReader(Assembly.GetManifestResourceStream(NameSpaceName & "." & FileName))
Where Assembly is the executing assembly.
The file name is "file.sql" the namespacename is like "A.B.C" but the result of GetManifestResourceStream is nothing
Does anyone know how to use the a namespace name with some special charachters on it please ?
Thanks
You can use Assembly.GetManifestResourceNames method to returns the names of all the resources in the assembly.

Filter files from directory vb.net

Straight to the question...I have files such as word documents with extension(.doc) and its respective sample files starting with (.sample)
Now I would like to load only the word documents..
I found the way as shown below to load the files but this loads all the files
Can anyone say me how do I filter these files while loading them ?
This is what I'm trying to do:
Dim files = Array.FindAll(Directory.GetFiles(mydir), Function(x) (Not x.StartsWith(".sample")))
This is my directory consists of files as said above:
The way you use it, all the files are retrieved (paying the whole computational cost) and then they are filtered.
As stated in this article, you can use a search pattern directly in file retrieval from your file system.
I suppose you could do something like that:
Dim files = Directory.GetFiles(mydir,".doc*")
If you gave an example of filenames, perhaps I would give you the right filter to apply too.
Hope I helped!
The GetFiles method returns filenames with the path that you specified included.
So if your files are in a folder C:\working\, your mydir variable will contain "C:\working\" and all of the results of GetFiles will be something like
"C:\working\.sample_filename.doc"
"C:\working\123797.doc"
So your x.StartsWith is always going to return false, because x always starts with C:\
Try this:
Dim files = Array.FindAll(Directory.GetFiles(mydir), Function(x) (Not x.StartsWith(mydir & ".sample")))
Note this assumes that your mydir variable ends with a \ character. If not, add it in in the concatenation within the function.
Try this,
Dim files = Array.FindAll(Directory.GetFiles(mydir), Function(x) (Not Path.GetFileName(x).StartsWith(".sample")))

how to rename or change file name case on the same location in objective-c

I am working on application which required me to change the filename case retaining the original filename as it is For Example: need to change abc.txt => (ABC.txt or Abc.txt or abc.TXT or abc.Txt) filename as well as its extension can be change in same way. I tried to use the NSFileManager
- (BOOL)movePath:(NSString *)source toPath:(NSString *)destination handler:(id)handler
But it didn't change the case,Please let me know how i can change the filename or extension case only in objective-c or c function, if it can be use in objective-c.
Thanks,
Maybe this helps:
http://www.cocoabuilder.com/archive/cocoa/208834-possible-bug-in-nsfilemanager-moveitematpath-topath-error.html