I've got a vbs module for Outlook 2010 that changes selected folder icons using Folder.SetCustomIcon:
Set folder = GetFolder(FolderPath)
Set myPic = LoadPicture(m_IconPath + FolderColour + ".ico")
If Not (folder Is Nothing) Then
folder.SetCustomIcon myPic
It auto-runs on startup, but occasionally, when I change the icons/folders affected, I run the script manually. However this only sets the folder icons for the new/updated folders. I'd also like it to change the icons for other folders back to the default.
It would be useful to either reset selected folders, or ideally just reset all folder icons prior to running my new customisations, but I can't see any obvious way to do this.
I expect I could identify a folder that never has its folder icon changed, and use Folder.GetCustomIcon to copy the standard icon across - assuming that this will actually return the standard icon; it may only work if the icon has indeed been customised - but either way, it seems inelegant. I'm expect there is a more direct method.
Any suggestions?
Related
I'm using the org.eclipse.swt.widgets.DirectoryDialog for folder selection. I'm not setting the filter path and I notice the the dialog somehow remembers the last selection. When I select a folder, and then reopen the dialog - it points to the last selected folder.
My question is - can I get this "remembered" last selected folder somehow in SWT or plain Java?
Thanks!
Dinko
No there is nothing for this.
DirectoryDialog is just a thin wrapper around the native open directory dialog. It is the native dialog that is remembering (if it does, this may vary on different platforms).
Looking at the macOS version of DirectoryDialog there is nothing in the Java code that knows about the previous selection.
OK so currently this is the code I have below of a picture box
PxBx.Image = Image.FromFile("C:\Users\Ashleysaurus\Documents\Visual Studio 2015\Projects\ThisProject\ThisProject\Images\filename.JPG")
What is the correct syntax for using images files stored in the application files after i publish a project? Namely b/c this path will not always be the same based off when/where users would store the app files?
I did a bit of searching but havent figured out how to ask the correct question to get the answer from forums/google.
Thanks in advance
I suggest you to add to your Settings.settings a new entry for the path to the folder where you store the images. This setting will be read at runtime and used to find your images. The advantage of this approach is that you can manually (or through your setup code) change the config file (where the setting is stored) to whatever your customer requires. Instead, hard coding a path (relative or not) inside the code is just a problem waiting to happen.
To add an entry in your setting.settings file right click your project and select properties, then the settings tab. Here, add a Name like "ImagePath", of Type = String and Scope = "Application", then set your current path as value and save.
Now, if you open the app.config (or web.config) file you will see the new entry and its value. To use it at runtime
string imagePath = Properties.Settings.Default.ImagePath;
You can utilize the Application.StartupPath property and use Path.Combine() to construct a proper path:
PxBx.Image = Image.FromFile(Path.Combine(Application.StartupPath, "Images", "filename.JPG"))
You have to add the image to the project.
You have 2 ways:
Create a folder in your solution explorer called Images or whatever you want. Right click on it and click 'Add Existing Item'. Choose the image you want.
Then type in your code:
PxBx.Image = Image.FromFile("Images\FileName.jpg")
Click on your project name in the solution explorer. It will take you to a new "screen" (I don't know how to call it), from the right click on 'Resources', from there you can add your image.
Then you reference it in your code using:
PxBx.Image = My.Resources.Filename
Anybody know a workaround for this problem described under:
"When you add the folder as a reference ("blue folder") it adds that folder to your bundle and not just the files in that folder. This means that when you want to reference a file in that folder, you have to reference it by doing foldername/myfile.png (because you have to dive into that folder, instead of just files in the root of the bundle).
I haven't found a way around this, so if you need to reference a file in a folder like that - be it in IB or a method like imageNamed: you need to do foldername/filename otherwise it won't be found."
It works when I create groups instead of folder references though.
Oh and I was wondering, if I add a folder with pictures in it with "Create groups for any added folders" selected, is all the structure going to be lost and everything will be on the root in my app bundle on the phone? Because if I go with the finder in my dev project, I can see that xcode copied my folder with all the pictures in it. But if it's true and no structure is kept, it means that I can't have two images with the same name in different folders in my dev project, correct? and even if all my images are in a folder "images" in my dev project, I still access them directly (foo.png not images/foo.png) in xcode, right?
EDIT
OK after adding the User paths (thanks to #Matthew Frederick) I can now see the filename of my images in the dropdown of IB and they show up on the interface! Problem is, it does not add the folder in the dropdown (I only see filename.png not images/filename.png), so when I compile, it looks for filename.png instead of "images/filename.png", so it does not work. I have to put images/filename.png manually in the IB dropdown, but then the image does not show in IB...
Interface Builder will only look for potential graphics/media in your target's header search paths, so if you want access to anything that's not loose in your project folder you'll need to add those paths.
Fortunately it's easy.
In the Project Navigator click on your project, and then in the main area click on your target.
Click the Build Settings tab and scroll down to the Search Paths section.
In the User Header Search Paths subsection double-click on the area in the Project column (3rd column over) and a small dialog will appear:
Click the + button, then type the path to your added folders, relative to the project's base folder, then click Done. The paths should be specified in the form of /yourPathName.
Poof, now IB can see the graphics inside the folder, and will present them as "folderName/imageName" in it's various dropdown menus and such.
Note: This is also true for .h and .m files and anything else inside a folder inside your project's folder: adding paths tells the compiler other places to look (hence the folders you see in my screenshot, "Human Data Classes" and "Machine Data Classes," where I keep my Core Data class files as created by mogenerator).
I have a VBA macro which runs in Word 2003. It is one module and the code attached to a userform, and it goes to about 30 client sites. When I first rolled this out I sent someone round to each site to place a .dot template in the Word Startup folder of each of 30 boxes, which then makes the macro appear as a button on the toolbar for each user.
All the users are internet connected.
The location of the .dot template varies from machine to machine, so "installers" would be out of play I presume?
I am anticipating that the macro made need to change from time to time. Is there any way I could get the user to press a button to get the macro to update itself?
Whether its push button or auto run checking for update, I would presumably need to know how to determine where the macro is running from (path) without a document necessarily having been saved, and how to find path to the Startup folder tools>options>file locations but programatically .
This can be done.
create 2 .dot files, loader.dot (checks for updates) and worker.dot (the main macro you are using and want to be able to update automatically).
the first loader.dot should go into C:\Program Files\Microsoft Office\OFFICE11\STARTUP
This is a trusted location and the macro will be loaded into any Word document. Use an AutoExec() subroutine to ensure it runs whenever a word doc is loaded.
worker.dot can go in any fixed installation location e.g. C:\yourapp\worker.dot
The logic in loader.dot is remove any reference to worker.dot (I had to enable trust of VBA model in macro security settings) check for an update using an http call, if new version available download it overwriting worker.dot, then add reference from file specifying worker.dot
I'm not sure that the user-presses-a-button model is ideal.
I'd look into building a "loader" template. Its job would be to run at startup and look for updates to the template/macro you already have and download/install/whatever such files when they change. Then load whatever's installed locally for use.
You should also think about whether it's a problem if an update is available but someone doesn't use it (perhaps they started Word before the change was uploaded, or they're offline). Also, do you need to know what version people are using? Have your loader report back, via HTTP, email or some other method (Twitter?)
Any such loader needs to either very stable (otherwise you just replace chasing around replacing the target template with chasing around replacing the loader) or able to update itself when necessary.
I am trying to add a feature to my msi based installer, written in wix, which will allow the user to change the name of the folder that keeps the shortcuts within the Windows start menu.
What I did so far is to add a folder there (with a static name), add shortcuts to that folder and remove all of them during uninstall (by using the RemoveFolder tag). Then I added a custom action that will pick up the property that is set from an edit box in UI and set that as the name of the folder, something like:
By running this within the InstallExecuteSequence, the folder is created correctly (with the name the user set for it) and all things are set into place. However, when I uninstall the product, the folder remains with all of it's shortcuts in it (that point to nothing now and they ask for deletion when you click them).
Is there any way to remove a folder that I dynamically changed it's Name attribute during installation, as described above?
Thanks.
You'll need to save the dynamic property to the registry, and read it back during maintenance/repair/uninstall. Windows Installer doesn't "remember" property changes, you need to do it yourself.