Error opening complex URLs in Contacts using Open URL script

Support for our integrated Contact Manager, Calendar, and Project Tracker.
Posts: 47
Joined: Sun Sep 02, 2007 9:57 am
PostPosted: Tue Jan 12, 2010 8:34 am
Hi there. I've noticed that trying to open a complex URL using the Open URL script in SeedCode complete is not working once it hits the "SeedCode_GetScriptParameter" custom function. I think it's because there's an equal sign in the URL:

Here's a sample URL I'm trying to open... but nothing happens. I believe the the custom function leaves the "$Address" variable empty:
http://www.facebook.com/profile.php?id=1170694181

What's the best way to get around this? Thanks. -Charlie

Here's the "SeedCode_GetScriptParameter" custom function:

Let ( [
string = Substitute ( Get ( ScriptParameter ) ; [ "\"" ; "^^" ] ; [ " ;" ; ";" ] ; [ ";" ; "\" ;" ] ; [ "= " ; "=" ] ; ["=" ; " = \"" ] ; ["¶" ; "~~" ] ) & "\"" ;
eval = Evaluate ( "Let ( [" &  string  & "] ;" & Name & " )" ) ;
result = Substitute ( eval ; [ "^^" ; "\"" ] ; [ "~~" ; "¶" ] )
] ;

If ( result ="?" ; "" ; result )

)
SeedCode Staff
SeedCode Staff
Posts: 2764
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Wed Jan 13, 2010 12:24 pm
I think the following will teach it to accept an equal sign in the param itself:

Let ( [
string = Substitute ( Get ( ScriptParameter ) ; [ "=" ; "!!!!" ] ; [ "\"" ; "^^" ] ; [ " ;" ; ";" ] ; [ ";" ; "\" ;" ] ; [ "= " ; "=" ] ; ["=" ; " = \"" ] ; ["¶" ; "~~" ] ) & "\"" ;
eval = Evaluate ( "Let ( [" & string & "] ;" & Name & " )" ) ;
result = Substitute ( eval ; [ "!!!!" ; "=" ] ; [ "^^" ; "\"" ] ; [ "~~" ; "¶" ] )
] ;

If ( result ="?" ; "" ; result )

)
John Sindelar
SeedCode
Posts: 47
Joined: Sun Sep 02, 2007 9:57 am
PostPosted: Wed Jan 13, 2010 12:31 pm
That appears to break some other interface navigational elements... the List/Detail/Table buttons didn't work anymore once I changed the custom function.

:(
SeedCode Staff
SeedCode Staff
Posts: 2764
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Wed Jan 13, 2010 12:34 pm
Ah, we probably use !!!! as a delimiter in those. Replace !!!! in the custom function with _!_!_!_!

(did the url work?)
John Sindelar
SeedCode
Posts: 47
Joined: Sun Sep 02, 2007 9:57 am
PostPosted: Thu Jan 14, 2010 12:08 pm
Well, I may be doing it wrong, but when I changed it it didn't work either.

The detail/list/table buttons did not work and the url didn't launch.
SeedCode Staff
SeedCode Staff
Posts: 2764
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Thu Jan 14, 2010 12:14 pm
ACK! I'm so sorry Charlie; I was not thinking clearly when I sent this. There is no way we can map the = sign in the parameter. BUT we can translate it at the end. So if you change the "=" in your url to _!_!_!_! the following function will turn that into a "=" when it's all done:

Let ( [
string = Substitute ( Get ( ScriptParameter ) ; [ "\"" ; "^^" ] ; [ " ;" ; ";" ] ; [ ";" ; "\" ;" ] ; [ "= " ; "=" ] ; ["=" ; " = \"" ] ; ["¶" ; "~~" ] ) & "\"" ;
eval = Evaluate ( "Let ( [" & string & "] ;" & Name & " )" ) ;
result = Substitute ( eval ; [ "_!_!_!_!" ; "=" ] ; [ "^^" ; "\"" ] ; [ "~~" ; "¶" ] )
] ;

If ( result ="?" ; "" ; result )

)
John Sindelar
SeedCode
Posts: 47
Joined: Sun Sep 02, 2007 9:57 am
PostPosted: Thu Jan 14, 2010 12:41 pm
So, just so I have this straight here...

The first step in the script (currently) is
Set Variable [$Address; Value:SeedCode_GetScriptParameter ("Address")]

You're instructing me to:
Capture that "Address" beforehand in another variable, substitute the "=" sign in that string with _!_!_!_!, then re-insert the "=" sign later, and reset the "$Address" variable to the original string before I send it to the Open URL step?

I think I understand that. :-)

*********************

While I'm here, I see in the ERD you have MailingMembers linked to Appointments... but I don't see any interface layouts to link the two together in the UI so that the merge tokens you've set up will grab data from the Appointment itself. Is there a mini-window (or something) somewhere that I've missed that links Appointments to Mailings?

Thanks again for your tremendous support, you're amazing. -Charlie
Posts: 47
Joined: Sun Sep 02, 2007 9:57 am
PostPosted: Thu Jan 14, 2010 1:24 pm
I worked out a different way. I trapped for the value string before the SeedCode GetScriptParameter custom function is called. If it's a URL I just have it OpenURL without calling the custom function.

Return to SeedCode Calendar

Who is online

Users browsing this forum: No registered users and 3 guests

(855) SEEDCODE
[email protected]
Follow us: