Author Topic: No keyboard shortcut for selecting specific drive in Photoshop, is there a way?  (Read 1264 times)

jane

  • Newbie
  • *
  • Posts: 49
hello. I have started writing voice commands for photoshop to avoid keyboard/ mouse, so that disabled, as myself, can use Photoshop to a certain degree.
Sadly there are not any shortcuts as far as I know, after searching on the internet.
Is there any way I can get around this problem* using VA?

*: Set a specific drive, path, and file name, to be used when the user wants to save a new file. (Save as)
Regards

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Assuming Photoshop uses a relatively "normal" file saving dialog, it should accept either a full or relative path in the "File name:" field.

E.G. if you want to save a file to "D:\my folder\my file.psd", it should be possible to enter that directly, and press Enter to save.

jane

  • Newbie
  • *
  • Posts: 49
Assuming Photoshop uses a relatively "normal" file saving dialog, it should accept either a full or relative path in the "Filename:" field.

E.G. if you want to save a file to "D:\my folder\my file.psd", it should be possible to enter that directly, and press Enter to save.
Thanks. It seems that the filename is in focus.

The problem is limited to:
Saying (voice) the drive,path and add the filename to end of that
Is that doable in VA, storing voice inputs as text into text variable(s). Is this the easiest way?


Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Theoretically you can dictate that information, yes.

However, accurately dictating an arbitrary folder name may not be all that practical. Ideally you'd get a list of subfolders (or drive letters), and use those with the "Wait For Spoken Response" action, so that only existing and valid drive letters/folders need to be/can be recognized.

E.G.
Code: [Select]
Start Indefinite Loop
    Inline C# Function: Get drive letters or subfolders as phrase list, wait until execution finishes
    Begin Text Compare : [~phraseList] Equals ''
        Loop Break
    End Condition
    Wait for spoken response: '{TXT:~phraseList}'
    Begin Text Compare : [~response] Equals 'use this directory'
        Loop Break
    Else If Text Compare : [~~currentpath] Equals ''
        Set text [~~currentPath] to '{TXT:~response}:\'
    Else
        Set text [~~currentPath] to '{TXT:~~currentPath}{TXT:~response}\'
    End Condition
    Write [Gray] 'Path: {TXT:~~currentPath}' to log
End Loop
Write [Purple] 'Speak file name' to log
Start Dictation Mode (Clearing Dictation Buffer)
Start Loop While : [{DICTATION}] Equals ''
End Loop
Stop Dictation Mode
Set text [~~currentPath] to '{TXT:~~currentPath}{DICTATION}.psd'
Write [Green] 'Final path: {TXT:~~currentPath}' to log

where "Get drive letters or subfolders as phrase list" contains
Code: [Select]
using System.Text;
using System.IO;

public class VAInline
{
public void main()
{
string currentPath = VA.GetText("~~currentPath");

StringBuilder sb = new StringBuilder();

if (string.IsNullOrEmpty(currentPath))
{
foreach (DriveInfo driveInfo in DriveInfo.GetDrives())
{
sb.Append(driveInfo.Name.Substring(0, 1));
sb.Append(";");
}
}
else
{
foreach (string folderPath in Directory.GetDirectories(currentPath))
{
DirectoryInfo di = new DirectoryInfo(folderPath);

if (!di.Attributes.HasFlag(FileAttributes.Hidden))
{
sb.Append(di.Name);
sb.Append(";");
}
}
}

if (sb.Length > 1)
{
sb.Append("use this directory");
}

VA.SetText("~phraseList", sb.ToString());
}
}


This is merely an example, of course. You'd likely want to save the path separately, so you can dictate just the file name without having to re-dictate the path every time.

jane

  • Newbie
  • *
  • Posts: 49
Theoretically you can dictate that information, yes.

However, accurately dictating an arbitrary folder name may not be all that practical. Ideally you'd get a list of subfolders (or drive letters), and use those with the "Wait For Spoken Response" action, so that only existing and valid drive letters/folders need to be/can be recognized.

E.G.
Code: [Select]
Start Indefinite Loop
    Inline C# Function: Get drive letters or subfolders as phrase list, wait until execution finishes
    Begin Text Compare : [~phraseList] Equals ''
        Loop Break
    End Condition
    Wait for spoken response: '{TXT:~phraseList}'
    Begin Text Compare : [~response] Equals 'use this directory'
        Loop Break
    Else If Text Compare : [~~currentpath] Equals ''
        Set text [~~currentPath] to '{TXT:~response}:\'
    Else
        Set text [~~currentPath] to '{TXT:~~currentPath}{TXT:~response}\'
    End Condition
    Write [Gray] 'Path: {TXT:~~currentPath}' to log
End Loop
Write [Purple] 'Speak file name' to log
Start Dictation Mode (Clearing Dictation Buffer)
Start Loop While : [{DICTATION}] Equals ''
End Loop
Stop Dictation Mode
Set text [~~currentPath] to '{TXT:~~currentPath}{DICTATION}.psd'
Write [Green] 'Final path: {TXT:~~currentPath}' to log

where "Get drive letters or subfolders as phrase list" contains
Code: [Select]
using System.Text;
using System.IO;

public class VAInline
{
public void main()
{
string currentPath = VA.GetText("~~currentPath");

StringBuilder sb = new StringBuilder();

if (string.IsNullOrEmpty(currentPath))
{
foreach (DriveInfo driveInfo in DriveInfo.GetDrives())
{
sb.Append(driveInfo.Name.Substring(0, 1));
sb.Append(";");
}
}
else
{
foreach (string folderPath in Directory.GetDirectories(currentPath))
{
DirectoryInfo di = new DirectoryInfo(folderPath);

if (!di.Attributes.HasFlag(FileAttributes.Hidden))
{
sb.Append(di.Name);
sb.Append(";");
}
}
}

if (sb.Length > 1)
{
sb.Append("use this directory");
}

VA.SetText("~phraseList", sb.ToString());
}
}


This is merely an example, of course. You'd likely want to save the path separately, so you can dictate just the file name without having to re-dictate the path every time.

Thanks. I will study Your answer later today.
The following two pictures shows photoshop response on save as.
The other shows experimental code to receive spoken drive letter into a text variable.
Read the Drive variable, write it on the photoshop input field with a colon
Then get the path, continue writing on photoshop input field
Type ENTER
regards

librarian

  • Newbie
  • *
  • Posts: 15
Code: [Select]
Press Left Alt+D keys and hold for 0.1 seconds and release
Set Windows clipboard to 'T:\path\to\common\used\folder'
Press Left Ctrl+V keys and hold for 0.1 seconds and release
Press Enter key and hold for 0.1 seconds and release

I use some unique programs for my work but they use a standard windows save as box. I use the Alt+D shortcut to select the address bar, send a common folder to the clipboard and then paste, enter.

My voice commands are "go to XXX", they work in file explorer as well as the save dialog boxes. Then i might need to use some other commands to navigate to a subfolder depending on other criteria.