创建的插件(gtk)文件在哪里?
where is the created plugin (gtk) file?
我使用下面的脚本创建插件(gtk
),但是在我运行脚本之后,我不知道创建的插件(gtk
)文件在哪里?
我检查了文件夹
C:\Program Files (x86)\Gatan\DigitalMicrograph\PlugIns
我不知道在文件夹中看到任何新创建的 gtk
文件。
这个脚本是错误的还是创建的 gtk
文件应该在其他地方?
/ Define the necessary variables string base,menu,submenu,item,packageNAME,name
number maxitem,i,j,maxfolder taggroup tgFILES,tgFOLDERS,tg
// Just some starting text in the results window.
result("\n Automatic Installation of all scripts in a folder as Plugin:\n\n")
// First get the default folder. (In this case, the folder last opened within DM)
base = GetApplicationDirectory(2,0)
// Prompt the user with a dialog to choose a folder, with the default folder as first choice.
// If the user cancels the dialog, the script will stop.
If (!GetDirectoryDialog("Please select the folder containing the scripts",base,base)) exit(0)
// Ask the user for a package name
If (!GetString("Name of package file?","",packageNAME)) exit(0)
// Ask the user for a menu name
If (!GetString("Name of menu to install the scripts in","",menu)) exit(0)
// Get all files/folders in the folder as a tag-list
tgFILES = GetFilesInDirectory(base,1)
tgFOLDERS = GetFilesInDirectory(base,2)
// Install all files from the main folder as menu commands.
// Count Items in the folder
maxitem = tgFILES.TagGroupCountTags()
i = 0
// Loop through all items
while (i<maxitem)
{
// get taggroup of item
tgFiles.TagGroupGetIndexedTagAsTagGroup(i,tg)
// get name of file
tg.TagGroupGetTagAsString("Name",item)
// Only if filename end with ".s" continue
If (right(item,2)==".s")
{
// use the name without the ending
name = left(item,len(item)-2)
result("\n Installing: "+item)
// install the menu command
// use the Try-Catch loop to detect problems during install
try
{ AddScriptToPackage(base+item,packageNAME,0,name,menu,"", 0) }
catch
{ result(" \t ERROR DURING INSTALL") } }
i++ }
// Now install all files from sub-folder as sub-menu commands.
// Count subfolders in the folder
maxfolder = tgFOLDERS.TagGroupCountTags()
// Loop for all subfolders
for (j=0;j<maxfolder;j++)
{
// get taggroup of item
tgFolders.TagGroupGetIndexedTagAsTagGroup(j,tg)
// get name of subfolder which is also the name of the submenu
tg.TagGroupGetTagAsString("Name",submenu)
// Get all files in the subfolder as a tag-list
tgFILES = GetFilesInDirectory(base+submenu,1)
// Count Items in the folder
maxitem = tgFILES.TagGroupCountTags()
i = 0
// Loop through all items as before for the main folder
while (i<maxitem)
{
tgFiles.TagGroupGetIndexedTagAsTagGroup(i,tg)
tg.TagGroupGetTagAsString("Name",item)
If (right(item,2)==".s")
{
name = left(item,len(item)-2)
result("\n Installing <"+submenu+">: "+item)
try {
AddScriptToPackage(base+item,packageNAME,0,name,menu,submenu, 0) }
catch
{
result(" \t ERROR DURING INSTALL") } }
i++ } }
这在一定程度上取决于 GMS 版本和您 运行 使用的 OS 版本。我假设您在 Windows7 或 Windows8 机器上使用 GMS 2.x,那么命令 AddScriptFileToPackage
可以有两个语法版本:
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 )
在第一个版本中 packageLocation 可能是 user_plugin 或 plugin。如果省略此参数(第二个命令版本),则假定为 user_plugin。
对于user_plugin,您将在以下位置找到创建的文件:
C:\Users\USERNAME\AppData\Local\Gatan\Plugins
其中 USERNAME 是当前 windows 用户。
对于 plugin,您会在 'plugins' 子文件夹中找到创建的文件,相对于 'DigitalMicograph.exe' 的安装,最有可能在:
C:\Program Files\Gatan\Plugins
您可能 运行 喜欢 Windows 的 "Compatibility files" 功能 7. GMS 1.x 只有 AddScriptFileToPackage
功能的一种变体,并且它始终想要将生成的包文件保存到标准 DM PlugIns 文件夹:
C:\Program Files (x86)\Gatan\DigitalMicrograph\Plugins
但在 Windows7 中,这种将文件直接写入 Program Files 目录的子文件夹的行为被阻止,而是将文件写入用户特定的本地目录,其名称如下:
C:\Users\USERNAME\AppData\Local\VirtualStore\Program Files (x86)\Gatan\DigitalMicrograph\Plugins
但是,通过单击标准插件文件夹 Windows 资源管理器 window 工具栏中显示的 "Compatibility files" 按钮,可以轻松地使此类虚拟化文件可见。
我使用下面的脚本创建插件(gtk
),但是在我运行脚本之后,我不知道创建的插件(gtk
)文件在哪里?
我检查了文件夹
C:\Program Files (x86)\Gatan\DigitalMicrograph\PlugIns
我不知道在文件夹中看到任何新创建的 gtk
文件。
这个脚本是错误的还是创建的 gtk
文件应该在其他地方?
/ Define the necessary variables string base,menu,submenu,item,packageNAME,name
number maxitem,i,j,maxfolder taggroup tgFILES,tgFOLDERS,tg
// Just some starting text in the results window.
result("\n Automatic Installation of all scripts in a folder as Plugin:\n\n")
// First get the default folder. (In this case, the folder last opened within DM)
base = GetApplicationDirectory(2,0)
// Prompt the user with a dialog to choose a folder, with the default folder as first choice.
// If the user cancels the dialog, the script will stop.
If (!GetDirectoryDialog("Please select the folder containing the scripts",base,base)) exit(0)
// Ask the user for a package name
If (!GetString("Name of package file?","",packageNAME)) exit(0)
// Ask the user for a menu name
If (!GetString("Name of menu to install the scripts in","",menu)) exit(0)
// Get all files/folders in the folder as a tag-list
tgFILES = GetFilesInDirectory(base,1)
tgFOLDERS = GetFilesInDirectory(base,2)
// Install all files from the main folder as menu commands.
// Count Items in the folder
maxitem = tgFILES.TagGroupCountTags()
i = 0
// Loop through all items
while (i<maxitem)
{
// get taggroup of item
tgFiles.TagGroupGetIndexedTagAsTagGroup(i,tg)
// get name of file
tg.TagGroupGetTagAsString("Name",item)
// Only if filename end with ".s" continue
If (right(item,2)==".s")
{
// use the name without the ending
name = left(item,len(item)-2)
result("\n Installing: "+item)
// install the menu command
// use the Try-Catch loop to detect problems during install
try
{ AddScriptToPackage(base+item,packageNAME,0,name,menu,"", 0) }
catch
{ result(" \t ERROR DURING INSTALL") } }
i++ }
// Now install all files from sub-folder as sub-menu commands.
// Count subfolders in the folder
maxfolder = tgFOLDERS.TagGroupCountTags()
// Loop for all subfolders
for (j=0;j<maxfolder;j++)
{
// get taggroup of item
tgFolders.TagGroupGetIndexedTagAsTagGroup(j,tg)
// get name of subfolder which is also the name of the submenu
tg.TagGroupGetTagAsString("Name",submenu)
// Get all files in the subfolder as a tag-list
tgFILES = GetFilesInDirectory(base+submenu,1)
// Count Items in the folder
maxitem = tgFILES.TagGroupCountTags()
i = 0
// Loop through all items as before for the main folder
while (i<maxitem)
{
tgFiles.TagGroupGetIndexedTagAsTagGroup(i,tg)
tg.TagGroupGetTagAsString("Name",item)
If (right(item,2)==".s")
{
name = left(item,len(item)-2)
result("\n Installing <"+submenu+">: "+item)
try {
AddScriptToPackage(base+item,packageNAME,0,name,menu,submenu, 0) }
catch
{
result(" \t ERROR DURING INSTALL") } }
i++ } }
这在一定程度上取决于 GMS 版本和您 运行 使用的 OS 版本。我假设您在 Windows7 或 Windows8 机器上使用 GMS 2.x,那么命令 AddScriptFileToPackage
可以有两个语法版本:
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 )
在第一个版本中 packageLocation 可能是 user_plugin 或 plugin。如果省略此参数(第二个命令版本),则假定为 user_plugin。
对于user_plugin,您将在以下位置找到创建的文件:
C:\Users\USERNAME\AppData\Local\Gatan\Plugins
其中 USERNAME 是当前 windows 用户。
对于 plugin,您会在 'plugins' 子文件夹中找到创建的文件,相对于 'DigitalMicograph.exe' 的安装,最有可能在:
C:\Program Files\Gatan\Plugins
您可能 运行 喜欢 Windows 的 "Compatibility files" 功能 7. GMS 1.x 只有 AddScriptFileToPackage
功能的一种变体,并且它始终想要将生成的包文件保存到标准 DM PlugIns 文件夹:
C:\Program Files (x86)\Gatan\DigitalMicrograph\Plugins
但在 Windows7 中,这种将文件直接写入 Program Files 目录的子文件夹的行为被阻止,而是将文件写入用户特定的本地目录,其名称如下:
C:\Users\USERNAME\AppData\Local\VirtualStore\Program Files (x86)\Gatan\DigitalMicrograph\Plugins
但是,通过单击标准插件文件夹 Windows 资源管理器 window 工具栏中显示的 "Compatibility files" 按钮,可以轻松地使此类虚拟化文件可见。