Hey guys,
I should first mention that my macro works perfect if I simply run the macro from the dropdown bar or from edit. Currently, I have the following macro assigned to the toolbar by adding the following code into the file "StartupMacros.txt" macro "WLT Action Tool- A bunch of code here for the icon" { run("Run...", "run=[*C:\\Documents and Settings\\USERNAMEHERE\\Desktop\\FILENAMEHERE.txt*]"); } The problem I am running into is that the first section of my code which includes dialog boxes does not make them pop-up, basically...no dialog box shows pops up for the user, it seemed to skip straight to the getDirectory code. I tested my program by inserting commands, such as, print("skipped here1");...print("skipped here2"), at the top of the program and after each dialog box. All of them printed, verifying that indeed the program was not completely skipping the code prior to the getDirectory command. I dont know how to change this so the dialog boxes work properly and appear to take in the user's choices. Here is the first part of my code where the problem exists: t=newArray("Yes","No"); Dialog.create("Run Automated Winston Lutz Test"); Dialog.addChoice("Run Winston Lutz Test?",t); Dialog.show(); choice3=Dialog.getChoice(); if(choice3=="No") { exit(); } eval("js", "IJ.getInstance().setLocation(5000, 5000)"); setBatchMode(true); tab=newArray("Input all images from folder","Input individual images from folder"); Dialog.create("ImageJ Automated Winston-Lutz"); Dialog.addChoice("Please Select at One of the Following:",tab); Dialog.show(); choice=Dialog.getChoice(); swidth = screenWidth; sheight = screenHeight; swf = (swidth/2)-150; shf = (sheight/2)-100; if (choice=="Input all images from folder") { dir=getDirectory("Choose a Source Directory "); <====Seems to ignore ALL previous code and list = getFileList(dir); SKIPS TO HERE Dialog.create("Specify File extension"); Dialog.addString("File extension","jpg",3); Dialog.show(); What seems to be happening? Thanks for the help. -Dan |
On Jan 10, 2011, at 7:27 PM, tankhead wrote:
> Hey guys, > > I should first mention that my macro works perfect if I simply run the macro > from the dropdown bar or from edit. Currently, I have the following macro > assigned to the toolbar by adding the following code into the file > "StartupMacros.txt" > > macro "WLT Action Tool- A bunch of code here for the icon" { > run("Run...", "run=[*C:\\Documents and > Settings\\USERNAMEHERE\\Desktop\\FILENAMEHERE.txt*]"); > } > > The problem I am running into is that the first section of my code which > includes dialog boxes does not make them pop-up, basically...no dialog box > shows pops up for the user, it seemed to skip straight to the getDirectory > code. I tested my program by inserting commands, such as, print("skipped > here1");...print("skipped here2"), at the top of the program and after each > dialog box. All of them printed, verifying that indeed the program was not > completely skipping the code prior to the getDirectory command. I dont know > how to change this so the dialog boxes work properly and appear to take in > the user's choices. > > > Here is the first part of my code where the problem exists: > > t=newArray("Yes","No"); > Dialog.create("Run Automated Winston Lutz Test"); > Dialog.addChoice("Run Winston Lutz Test?",t); > Dialog.show(); > choice3=Dialog.getChoice(); > > if(choice3=="No") > { > exit(); > } > > > eval("js", "IJ.getInstance().setLocation(5000, 5000)"); > setBatchMode(true); > > tab=newArray("Input all images from folder","Input individual images from > folder"); > Dialog.create("ImageJ Automated Winston-Lutz"); > Dialog.addChoice("Please Select at One of the Following:",tab); > Dialog.show(); > choice=Dialog.getChoice(); > > swidth = screenWidth; > sheight = screenHeight; > swf = (swidth/2)-150; > shf = (sheight/2)-100; > > > if (choice=="Input all images from folder") > { > dir=getDirectory("Choose a Source Directory "); <====Seems to ignore ALL > previous code and > list = getFileList(dir); > SKIPS TO HERE > > Dialog.create("Specify File extension"); > Dialog.addString("File extension","jpg",3); > Dialog.show(); > > > What seems to be happening? > Thanks for the help. > > -Dan Try changing the code you added to StartupMacros.txt to macro "WLT Action Tool- A bunch of code here for the icon" { runMacro(file-path); } |
Wayne,
Thanks for the help! When using the following code to take in a whole folder I am unable to see the files in the folder. I was wondering if there was a way to bring in a folder while still being able to see the files from within the folder the user is selecting. dir=getDirectory("Choose a Source Directory "); list = getFileList(dir); Thanks, -Dan |
Hi Dan,
probably it depends on the operating system whether you see the files when choosing a folder with 'getDirectory'. On Mac OS X, you can see the files, but they are grayed out and you can't select them. Michael ________________________________________________________________ On 11 Jan 2011, at 18:55, tankhead wrote: > Wayne, > > Thanks for the help! When using the following code to take in a whole > folder I am unable to see the files in the folder. I was wondering > if there > was a way to bring in a folder while still being able to see the > files from > within the folder the user is selecting. > > dir=getDirectory("Choose a Source Directory "); > list = getFileList(dir); > > Thanks, > -Dan |
Free forum by Nabble | Edit this page |