I'm writing a custom script for Photoshop to handle batch processing of images. I have two input folders and an output folder that I need to specify. Right now I'm using something like this to select my folders:
var inputFolder = Folder.selectDialog("Select a folder of images to process");
Because I'm working on a server with a pretty deep folder hierarchy, it can be a real pain to select through the drop-down menu that Photoshop presents to me in this dialog.
It would be so much easier to have a folder selection dialog with an address bar and quick access panel like this:
All other PS scripts that I've been digging around in use the Folder.selectDialog method to set file paths to a variable. Is there a reason for this? If not, then how can I instruct Photoshop the second style of folder navigation dialog?
It doesn't appear that Adobe supports this dialog as a folder selecting option.
There was a similar thread to this posted on the Adobe forums where a workaround was suggested:
https://forums.adobe.com/thread/1094128
The solution that was suggested is to use a saveDialog function instead of selectFolder. This gives you the folder dialog that we want, but comes with the downside of having to type a dummy name into the filename path. It also says "Save As" on the top of the dialog box, which is confusing.
Here's what was offered:
by lilsmokie on Nov 8, 2012 2:19 PM
var dskTop = Folder.desktop;
var dskPth = String(dskTop);
var newSpot = new File(dskPth+"/poop");
var selectedFolder = newSpot.saveDlg('Select Destination Folder');
var illFilePath = selectedFolder.path;
alert(illFilePath);
This opens the dialog at the desktop. Then put "poop" or whatever you
like in the text field. There the user can navigate to where ever.
When they it save illFilePath will have the folder path. Not perfect
but its close enough for me right now.
I've also discovered that I can set the starting location of the selectDialog by using selectDlg instead:
var outputFolder = Folder(app.activeDocument.path).selectDlg("Select a folder to output images to:");
This gives some control over the starting location so that the user doesn't have to click through a million dropdowns.
At the bottom of your first screenshot you can see the unput text area Folder: This PC. It works just like an address bar. You can type (or paste) something like \\server\work\folder\subfolder into this area and you get this folder ('subfolder' in this case) immediately.
On MacOS this dialog doesn't show the Folder: ... input area. But you can press Cmd-Shift-G and get the native system 'address bar' anytime.
Related
I need a way to disable the ability for a user to go to (or use) the menu File > Share
I have similar for other save commands like below but need something for this feature as well
Application.CommandBars("Worksheet Menu Bar").Controls("File").Controls("Save As...").Enabled = False
Application.CommandBars("Worksheet Menu Bar").Controls("File").Controls("Save").Enabled = False
I have tried:
Application.CommandBars("Worksheet Menu Bar").Controls("File").Controls("Share").Enabled = False
to no avail
My aim is to stop users saving copies of this file (Hosted on a server), I fully understand Excel isn't meant to be secure and there is always a way to do this but want to make it as hard as I can for the average Joe
Regards
You could use a for each loop to extract the available commands:
' Iterate available commands from the file command bar.
Sub PrintAllCommandBarControlNames()
Dim cbControl As CommandBarControl
For Each cbControl In Application.CommandBars("Worksheet Menu Bar").Controls("File").Controls
Debug.Print cbControl.Caption
Next
End Sub
Run on Excel 2010, I couldn't find a share option. Might just be my system. The above returned:
&New...
&Open...
&Close
&Save
Save &As...
Single Web Page (*.mht)
Save &Workspace...
File Searc&h...
Per&mission...
Per&mission
Ch&eck Out
Ch&eck In...
Ve&rsion History...
We&b Page Preview
Page Set&up...
Prin&t Area
Print Pre&view
&Print...
Sen&d To
Propert&ies
&Recent File Name Goes Here
&Recent File Name Goes Here
Sign ou&t
E&xit Excel
The 'backstage' menu (that you get when you click top left File menu) is effectively part of the Ribbon, and not a Command Bar. If you tried disabling Save for instance, using your example, you'll find they don't work on 2010/2013 etc.
There is this answer which tells you how to manipulate those menu items in the ribbon: Remove "Save & Send" from File menu in Excel 2010 using custom XML and one of the items is called TabShare.
need to ask, I have simple app, which had one textbox and one button. When I type something to that textbox and push that button, it saves to my Settings...
see:
Dim Settings As New My.MySettings
Settings.something = TextBox2.Text
Settings.Save()
MessageBox.Show(Settings.something.ToString)
Everything works great, but when I build it and run for example from my desktop path, Enter number save it and close it. When I make a copy of this file to my documents path and open it, nothing loaded, but when I start it from the place where I last save it, it loads properly.
In the short description:
If I run app on my Desktop path and make a save, when I close the app and copy this file (.exe) to another path, I need to load previous saved data from Desktop path, or other different location.
Save in path A, copy it from and open anywhere in path B, C, D... etc.
Is it possible, if yes, how can I do that?
Thanks!
You may be looking for something like the 'SaveSetting" method
SaveSetting("MyApp", "Form1", "Text", "ValueToSave")
The first, second and third parameters indicate a "Path" where your value will be saved, and the fourth is the value itself.
Then, you can load the saved value using the following method:
MyText = GetSetting("MyApp", "Form1", "Text", "DefaultValue")
Note that the first three parameters must be the same as used on the save method, and the fourth is the default value, in case no previous data has been saved.
Problem : Form is divided in two parts.
Left side for enter information's. Right side for preview those information's.
On top of form there is a button called Send.
When i click on that button it need to take a snapshot of the right side and send it to email address provided as a attachment.
Solution : Take a snapshot of right side of form and save it to Temp folder
- Send a email and attach the file from temp folder
- Delete the file ( for any case )
Is it possible to take a ss and convert it to pdf ? is that a better way ?
I found a very helpfull class on forum Class for Screen Capture
But is there any way to use method without entering position of the screen.
Example : Right side of form is at GroupBox2 .
Is there any way to take a snapshoot of the groupbox2 on form?
Is there any way to take a snapshoot of the groupbox2 on form?
and save it to Temp folder
As suggested by user3697824, use Control.DrawToBitmap() with Path.GetTempFileName:
Dim bmp As New Bitmap(GroupBox2.Width, GroupBox2.Height)
GroupBox2.DrawToBitmap(bmp, New Rectangle(New Point(0, 0), bmp.Size))
Dim FileName As String = System.IO.Path.GetTempFileName
bmp.Save(FileName) ' save it as a Bitmap
' < or >
bmp.Save(FileName, Imaging.ImageFormat.Jpeg) ' save it as a Jpeg
' *Either way, the file will have the .TMP file extension!
Debug.Print(FileName)
I'm currently working on an account system for a game using VB.Net. I was wondering how to make it so that a combo box displays a list of files within a specific directory. Here's what I mean:
When the user runs the application, I want them to see a combo box displaying a directory on their computer.
I've looked at all of the tutorials, but found NOTHING that worked.
NOTE: The combobox is in a dropdownlist style.
VB.NET
Dim dir = "Your Path"
For Each file As String In System.IO.Directory.GetFiles(dir)
ComboBox1.Items.Add(System.IO.Path.GetFileNameWithoutExtension(file))
Next
C#
dynamic dir = "Your Path";
foreach (string file in System.IO.Directory.GetFiles(dir))
{
this.comboBox1.Items.Add(System.IO.Path.GetFileNameWithoutExtension(file));
}
You can visit this post if you want more information about a similar question here
So many ways--perhaps the easiest to understand:
For Each f In My.Computer.FileSystem.GetFiles("c:\Logging\")
MyDropDownList.Items.Add(f)
Next
I want to fire up a flash presentation inside Powerpoint 2007. I am calling the Win32 ShellExecute() routine. When I run this from a location whose path is a UNC path (\myserver\myfolder\sample.ppt) it does not work.
The ShellExecute routine expects 6 arguments, one of which is the path to run it from. I've tried to set this parameter to C:\ as well as using ActivePresentation.Path (which is a UNC path). Neither works.
I initially tried this approach, but found it caused problems:
When the presentation was used from a laptop not connected to the network.
If the user did not have access to the UNC.
If the flash file was renamed, moved or deleted.
I found a better approach was to embed the file into the Powerpoint file.
It can be done as follows using Office XP, Powerpoint
From the 'View' menu select 'Toolbars' and tick the 'Control Toolbox'
On the 'Control Toolbox' toolbar click on the 'More controls' icon
A list of controls will be displayed. Scroll down until you find the 'Shockwave Flash Object' and then click on it.
This should change your cursor to a crosshair. Move to the area on the slide where you want to inset the 'Shockwave Flash Object'.
Left click, hold and drag to create a box of the required size.
Next right click on the control you have just inserted and select 'Properties'.
Set the following properties
* Autoload = True
* EmbedMovie = True
* Enabled = True
* Loop = True
* Playing = True
* Visible = True
* Movie = c:\flash.swf (Change this to the location of your .swf file)
Close the 'Properties' control
Save the file.
Close the file.
Reopen the file.
The .swf file should start playing automatically when you reach the slide during the slide show.
I found it usefull to include controls (pause/play, time line) in the .swf file
UNC paths start with a double back-slash. Are you doing that, or was that just a typo in the question?
I've resorted to mapping a drive to the UNC path.
The command line looks something like
subst A: "\\ServerName\SomeDirectory"
well, now it seems to work just fine with the unc path.