2

次のスクリプトを使用してプラグイン ( ) を作成しましたが、スクリプトを実行した後、作成されたプラグイン ( ) ファイル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++ } } 
4

2 に答える 2

1

You are probably running into the "Compatibility files" feature of Windows 7. GMS 1.x has only one variant of the AddScriptFileToPackage function and it always wants to save the resulting package file to the standard DM PlugIns folder:

C:\Program Files (x86)\Gatan\DigitalMicrograph\Plugins

But in Windows 7, such direct writing of files to subfolders of the Program Files directory is prevented and files are instead written to a user-specific local directory named as follows:

C:\Users\USERNAME\AppData\Local\VirtualStore\Program Files (x86)\Gatan\DigitalMicrograph\Plugins

However, one can easily make such virtualized files visible by clicking on the "Compatibility files" button that appears in the tool bar of the Windows explorer window for the standard PlugIns folder.

于 2015-11-10T01:24:17.770 に答える