Skip to main content
Jared Hess
Legend
April 18, 2012
Question

ExtendScript Help - Why am I getting "prompt is not a function" error?

  • April 18, 2012
  • 1 reply
  • 1734 views

Hello RH friends,

I need to search through my 2200+ topic project, find any topics that use a certain image in the source and then open up that file in the wysiwyg editor to visually see what's happening to the conditional markings on those topics. I need to open them in chunks since I've determined there are some 600+  topics that has the image I'm looking for. Seems like something a script would be able to handle. Does anyone have a script that does something like this or something similar?

Anyway, I started messing around in the script editor with a test script to figure some of this out, but I get an error right off the bat when I try using the standard js prompt method to capture a text

string. I have these two lines of code in my script:

var strText = prompt ("Type a string to search for. Topics with that string will then open in the RH viewer.","i_chiclet.gif","String to Find");

alert (strText);

Running it directly from within the script editor, the prompt command works fine.

However, running the script from within RH--which is what I need to do for it to work on the current project to look at, I get a message that says:

"prompt is not a function."

What am I missing?

I'm using RH 9.02.271

Windows 7 64-Bit with adminstrator access

    This topic has been closed for replies.

    1 reply

    Willam van Weelden
    Inspiring
    April 18, 2012

    RH ExtendScript bug... Use Window.prompt() and it'll work. The same goes for confirm: Window.confirm() does work. Alert() does work however and prompt and confirm work in ExtendScript toolkit itself.

    I've never tried opening a topic in the WYSIWYG and I don't think that RoboHelp supports this. You can open a file with ExtendScript, but that just launches the file in default viewer (probably your web browser). I'll look into opening a topic in the WYSIWYG, but I can't promise anything.

    Greet,

    Willam

    Jared Hess
    Legend
    April 18, 2012

    Thanks for the response Willam. I hope there's a way to do this, otherwise I'll have to manually open up all 600+ files in the viewer --- and that'd be a painful loss of time.

    Jared Hess
    Legend
    April 19, 2012

    Well I found a workaround using a combination of Notepad++ to get a list of filenames with the image in it and then Macro Express to open the topic in RH. Kind of klunky, but it at least does what I need it to do. Very handy tools.