Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently October 13th, 2024, 5:26 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Script Problem: Publication Search
PostPosted: June 6th, 2006, 11:43 pm 
Offline

Joined: May 7th, 2005, 10:08 pm
Posts: 249
Hello, I have created help cue cards for a software system that utilizes several different modules. The modules can work together or act as stand-alone applications. Therefore, a client may use 1 or all or any number of modules.

All the cue cards are in one publication. I wrote a script so that when the user clicks a link to a cue card page, the publication searches to see if the module's .exe to which that cue card refers is present on the user's system. If it is, the cue card page is displayed. If the .exe is not present on their system, they get a "sorry" message.

The script works fine. However, I decided I need another related script, and it is that script with which I am having problems.

I use a launch publication search action. The only problem is of course that the search returns the keywords for all cue cards, even those referring to modules that are not present on the user's system.

So, I wrote the following script that I guess I'm going to need to put on every cue card page, so that upon page pre-show, the publication will search for that module's .exe. If the .exe is present, the cue card page will be displayed. If not present, a "sorry" page will be displayed. However, I discovered a problem during testing. If I click on a keyword in the search form and I am taken to the "sorry" page, it opens the "sorry" page, then opens it again - you see the page transition twice.

Here is my script...does anyone know what's going on?
Thanks a bunch,
Mike

if ( FileExists( SYSTEM_PUBLICATION_DIR + "mobcli.exe" ))
{
// File exists - do something
GotoPage("mobile_going_in_service")
}
else
{
// File does not exist - do something else
GotoPage("Sorry")
}


Top
 Profile  
 
 Post subject:
PostPosted: June 7th, 2006, 12:21 am 
Offline

Joined: October 26th, 2004, 1:26 pm
Posts: 262
Hi Mike,

Maybe the 'if' and 'else' conditions are happening at once in your script. Try the following...


var check = FileExists( SYSTEM_PUBLICATION_DIR + "mobcli.exe" )
if (check == 1)
{
GotoPage("mobile_going_in_service")
}
else
{
// File does not exist - do something else
GotoPage("Sorry")
}

_________________
Cheers,
Steve


Top
 Profile  
 
 Post subject:
PostPosted: June 7th, 2006, 12:28 am 
Offline

Joined: May 7th, 2005, 10:08 pm
Posts: 249
Hi Steve,
Thanks so much for the quick reply. Unfortunately, that doesn't do the trick. I do appreciate the suggestion.
Mike


Top
 Profile  
 
 Post subject:
PostPosted: June 7th, 2006, 7:26 am 
Offline

Joined: December 14th, 2004, 5:08 pm
Posts: 55
Location: Holland
Opus: version 8.0
OS: XP, Vista, Windows7, Windows8
System: Intel Corei7-2600 CPU 3.400GHz
Maybe this line works...
if ( FileExists( SYSTEM_PUBLICATION_DIR + "mobcli.exe" )==1)
{action}
else
{action}

Regards

Jim


Top
 Profile  
 
 Post subject:
PostPosted: June 7th, 2006, 12:40 pm 
Offline

Joined: November 3rd, 2004, 2:11 pm
Posts: 323
Is there any way you can exclude the Sorry page's text from your text search? Go to the Sorry page and uncheck the Use words from text objects on page checkbox. I think it's actually doing it right, because it's displaying the page because it found it in the Publication Search, but then the page is redisplaying because your script is run, hence you get two transitions.

_________________
Opus Pro XE 9.1 Win7 64-bit Core i3 8MB RAM


Top
 Profile Visit website  
 
 Post subject:
PostPosted: June 7th, 2006, 4:15 pm 
Offline

Joined: May 7th, 2005, 10:08 pm
Posts: 249
Thanks a lot, bwpatric and Jim. I'll try both of the suggestions and get back to you!

Mike


Top
 Profile  
 
 Post subject:
PostPosted: June 7th, 2006, 4:31 pm 
Offline

Joined: May 7th, 2005, 10:08 pm
Posts: 249
Thanks for your suggestions, everyone; I'm still experiencing the issue. This is baffling, to say the least.


Top
 Profile  
 
 Post subject:
PostPosted: June 7th, 2006, 9:09 pm 
Offline

Joined: November 11th, 2004, 4:05 am
Posts: 636
Location: Christchurch, NZ
Hi Mike,
your logic is correct -- using a file named CSE.exe, the following script gives the correct answer (at least for me) :)

var check = FileExists(SYSTEM_PUBLICATION_DIR + "CSE.exe" )
if (check)
{
GotoPage("mobile_going_in_service")
}
else
{
// File does not exist - do something else
GotoPage("Sorry")
}

Sometimes it pays to test logic using Debug.trace so you can see if the problem lies elsewhere.
Caution: Don't test using "if (check==1)" or it will miss a file that is read only, as then check=2.
if(check) will pass any non zero number.

see attached imp.
I've used a file called CSE.exe in my pub to test with, change it accordingly.

cheers
Paul


Top
 Profile  
 
 Post subject:
PostPosted: June 7th, 2006, 11:02 pm 
Offline

Joined: May 7th, 2005, 10:08 pm
Posts: 249
paul wrote:
Hi Mike,
your logic is correct -- using a file named CSE.exe, the following script gives the correct answer (at least for me) :)

var check = FileExists(SYSTEM_PUBLICATION_DIR + "CSE.exe" )
if (check)
{
GotoPage("mobile_going_in_service")
}
else
{
// File does not exist - do something else
GotoPage("Sorry")
}

Sometimes it pays to test logic using Debug.trace so you can see if the problem lies elsewhere.
Caution: Don't test using "if (check==1)" or it will miss a file that is read only, as then check=2.
if(check) will pass any non zero number.

see attached imp.
I've used a file called CSE.exe in my pub to test with, change it accordingly.

cheers
Paul


Thanks a bunch, Paul. I'll give it a whirl.


Top
 Profile  
 
 Post subject:
PostPosted: June 8th, 2006, 4:54 am 
Offline

Joined: May 7th, 2005, 10:08 pm
Posts: 249
Thanks, everyone, for your suggestions, but I guess this is a lost cause. It's just not working correctly.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 17 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group