Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Debugging bridge scripts

Enthusiast ,
Jul 17, 2005 Jul 17, 2005
I must be doing something dumb.

I ran the script debugger.jsx by double clicking on the script in the windows explorer (from the photoshop javascript samples) and it worked fine, opening the ESTK and breaking on the debugger statement.

I then changed the directive #target photoshop to #target bridge, resaved the script as BridgeDebugger.jsx and then tried to run it. Nothing happens.

I also have tried inserting breakpoints in the ESTK for scripts that are in the startup folder and execute from the bridge menu. The breakpoints do not work, and the debugger statement does not work. I have made sure to include the statements

$.level = 2;
debugger;

Bridge was open at the time.

CS2, Windows XP
TIA
Rory
TOPICS
Scripting
1.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 17, 2005 Jul 17, 2005
Update. I closed all programs and tried to run BridgeDebugger.jsx again. It worked this time, but I got this error message:

Error in c:\Program Files\Common Files\Adobe\StartupScripts\ImportCamera_BR.jsx
Line 39: ImportCamera.store = ScriptStore.open( "$$$ImportCameraStorage" );
undefined is not an object
Error in c:\Program Files\Common Files\Adobe\StartupScripts\ImportCamera_BR.jsx
Line 39: ImportCamera.store = ScriptStore.open( "$$$ImportCameraStorage" );
undefined is not an object

I still cannot get a bridge script to break in the debugger if Bridge is open.

Rory
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 18, 2005 Jul 18, 2005
Sometimes ESTK needs a "nudge" to get it to debug a script in Bridge.

With a script with #target bridge at the top, click the run button. The app drop down list should now show "Adobe Bridge". If the script didn't execute, click the drop down list, select ExtendScript Toolkit, then click it again and select Adobe Bridge.

I am curious where you put debugger statements to get the above error.

That error will only happen if AdobeLibrary2.jsx doesn't load. BTW, feel free to use ScriptStore - it's a way to persistently store stuff between launches of bridge, without having to rely on preferences. For scripts with complex set up info - like file renaming in Import from Camera, I didn't want someone to trash their prefs and find they had to start over saving their renaming templates.

Bob
Adobe Workflow Scripting
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 18, 2005 Jul 18, 2005
Thanks Bob. I am at work, so I will try this tonight. BTW, all the other scripting info you gave me is working fine, and is much appreciated.

Rory
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 18, 2005 Jul 18, 2005
Great!

Glad to hear it. Part of my job is to watch this list and provide what help I can, so don't be shy on asking.

Bob
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 18, 2005 Jul 18, 2005
The behaviour of the ESTK/Bridge appears to be a little bit flaky. I have been playing with the following script:

#target bridge
app.bringToFront();
$.level = 2;
debugger;
alert("Hello World");

Scenario #1: Run from the ESTK with Bridge not running. Sometimes this works. Other times the script runs to the debugger statement and stops, but all the ESTK panes, toolbar and menu are disabled. The greyed menu still works for the debug options and the shortcut debug keys work.

Scenario #2: Run from the ESTK with Bridge running. This works all the time so far.

Scenario #3: Run by double clicking in the windows explorer with Bridge and ESTK not running. This opens Bridge, but does not run the script.

Scenario #4: Run by double clicking in the windows explorer with Bridge open and ESTK not running. This does not run the script.

Scenario #5: Run by double clicking in the windows explorer with Bridge not running and ESTK open. Nothing happens - Bridge does not open.

Scenario #6: Run by double clicking in the windows explorer with Bridge and ESTK open. Nothing happens.

Scenario #7: Run from Bridge browser with ESTK open. Works, but most of the ESTK, including the toolbar and panes are disabled. If you wait long enough and click on different panes they eventually enable.

Scenario #8: Run from Bridge browser with ESTK closed. Works. However, after the code pauses at the debugger statement if I stop the debugging session I get the error "An error occurred while running a script. The script may not be compatible with this version of Bridge. Check for available updates by selecting the Updates command in the Help menu. Javascript error in BridgeDebugger.jsx, line4: Execution halted". I am running Bridge version 1.02.109(95798).

Finally, in the OpenClose.jsx script you made available, try to get the debugger to halt in the OpenShut.remoteScript function...

I hope you can reproduce this behavior. The new ESTK and Bridge will be really nice once it is stable and consistent.

Rory
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 19, 2005 Jul 19, 2005
That was a bunch of scenario chasing! Good work.

Most of what you found is expected. Any time you open a script from Windows Explorer, the OS extension mapping will be used, and the script will open in ESTK. It will not execute.

I found that if you double click in bridge to execute, and the deugger window is frozen, clicking back into Bridge and back to ESTK brings everything back to life.

Well, I agree that the remote script debugging isn't working in PS. But it does work on scripts written for InDesign.

All of this flakiness could be related to the onResult bug in PS you found.

As a workaround, I suggest using the lib function writeToFile( scriptText). All it does is write to a text file, prompts you for a file name. You use it to save the generated script, then have PS run it directly. That seems to work.

Bob
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 19, 2005 Jul 19, 2005
LATEST
Thanks for the workaround Bob (and your patience). I will keep plugging!

Regards
Rory
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines