Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Free CityDesk database script utility

Want to access the CityDesk database files programmatically - without learning a complicated programming language ?

Testdrive our free CityDesk Database Scripter utility:

http://www.citydeskwizards.com/bin/cddbscripter.zip

It is a 3.4 MB download but the utility is only around 400K (the two bigger files are a free CityDesk website template and a help file for some 600+ scripting commands of the underlying multimedia language...but you only need a handful for database scripting as you will see :-).

Here is a screenshot:

http://www.citydeskwizards.com/bin/cddbscripter.gif

You can freely write your own scripts in seconds. Demoscript and our free JUUKA CityDesk Wizard included.
No complicated install, no change of any system settings.

And you can launch the utility from the command-line too:

cddbscripter.exe <scriptfile> <ctyfile> <close>

If you specify <close> as the third parameter, the application will close automatically. If you don't want that, just leave it out.

Here is the readme file for a quick overview:

Welcome to the CityDesk Database Scripter (CDS) utility!

Develop and share your own CityDesk database manipulation tools with ease and very little technical knowledge. No need to learn a complicated programming language. Get started in seconds.


*** TIP: Print this page ***


Share your CDS scripts with other users at

http://www.citydeskwizards.com


This utility does not require any special installation,
does not change any system settings nor does it contain
any malware or spyware.

Simply extract the following four files from the zip-package
into any directory of your choice:


1. cddbscripter.exe (the CDS utility)

2. glDBC.dll (a database access component from Don Magnusson)

3. juuka_en.cty (an example CityDesk file, i.e. our free JUUKA website template)

4. demoscript.txt (an example script reading all article's headlines)

5. glpro.chm (a helpfile explaining the script commands you can use)


QUICK START:

Launch cddbscripter.exe, select demoscript.txt as the script to run, select juuka_en.cty as the CTY to apply it to and watch the article headlines being displayed.


HOW DOES IT WORK:

cddbscripter.exe opens a database connection to the specified CityDesk database file (cty) and calls the specified script (demoscript.txt).


HERE IS WHAT'S INSIDE THE DEMOSCRIPT

start:  <-- always begin your script with "start:"

;reading article headline's -> see CityDesk table structure
dbcRSOpen("SELECT sHeadline FROM tblArticle",@dataBuf)  <-- SQL select field from table

beginLoop  <-- move through all articles
    dbcRSGetData(0,"sHeadline",@dataBuf)  <-- read the field sHeadline
    textln @@dataBuf  <-- display it on screen
    if (dbcRSMoveNext() == "-9")  <-- check for end of article list
        break  <-- get out of the loop
    endif
endLoop

dbcRSClose()  <-- always close DB commands when used before (see dbcRSOpen above)

return  <-- always end your script with "return"


WHAT DO I NEED TO KNOW:

1. Information about the CityDesk table structure (see www.citydeskwizards.com)
  (you can also open a cty file in Microsoft Access directly)

2. Information about SQL statements for selecting/changing data in a database
  For more information about glDBC.dll please visit:
                      http://www.concept-usa.us/glpro/gldbc/gldbc.htm

3. Information about what script commands you can use

...and here comes the beauty: although you might only need a handful of commands YOU CAN USE ALL 600+ script commands of the GLPRO multimedia scripting language.
Thats right, including loops, output formatting, writing to result files, reading INI files, playing sounds, displaying graphics, calling Windows APIs....etc.


THIS UTILITY PACKAGE IS PROVIDED AS IS AND WITHOUT ANY WARRANTIES. NO LICENSE FEES APPLY.

Let us know about your scripts and we will publish them
on our website for others to use.

If you have a new script, a suggestion or if you found a bug, send us an email at

cd@telepark.de

Regards

Patrick Thomas
telepark
http://www.citydeskwizards.com

PS: Launching this readme.txt as a script for the utility only
results in a simple label error :-) "start:" not found...

Patrick Thomas
Thursday, December 09, 2004

Here is another example...if you want to give all articles the same headline:

start:

dbcDBExecute("UPDATE tblArticle set sHeadline = 'telepark'",@dataBuf)

return

A one-liner...this is fun...I am curious what you guys will come up with...

Cheers

Patrick

PS: You could also enable the user to enter a string to copy into all headline fields...this would be no more than:

start:

inputLINE myString text 50
dbcDBExecute("UPDATE tblArticle set sHeadline = '"$@myString$"'",@dataBuf)

return

Some quick GLPRO basics:

to set a variable value:
set <varname> <value>

to retrieve the value of a variable:
@<varname>

to display text:
text "<string>"

to display a messagebox:
messagebox <string>

to wait for a mouseclick:
waitmouse

to write a comment:
;<comment>

to display an image:
imagePut <filename>

conditionals:
if <cond>
...
else
...
endif

loops:
beginloop
...
endloop

to change the text color:
color <rgb> or <colorname>

to display a file-open-dialogue:
fileOPENDIALOG "Choose a file" "txt~*.txt" ""

to do calculations (basics):
set <var> @<var>+-/*@<var>

Have fun...thats what computing should be about ;-)

Patrick

Patrick Thomas
Thursday, December 09, 2004

Patrick,

Thanks for utility.  Could you provide an example for retrieving the actual content of the article--the blob-type data?

Also,  You said "...nor does it contain any malware or spyware."

I don't think your utility does; however, the help file is for GLPRO, which I assume to be the program used to create this utility. 

The problem I see is that the help file mentions glpro.com and gmedia.com as the products and companies web sites, respectively.  When I go to gmedia.com, I get Bad Request (Invalid Hostname).  GLPRO.com is one of those generic search sites that tries to set itself to your browser's home page.  I also found some spyware on my computer after the visit, though I'm can't be sure it came from there.

Can you provide any information on GLPRO and gmedia?

concerned
Thursday, December 09, 2004

> Thanks for utility.  Could you provide an example
> for retrieving the actual content of the article--the
> blob-type data?

AHA! :-) Nope...not there yet. We wanted to concentrate on giving you a very versatile framework/utility to test your own scripts. Free of charge and with the maximum degree of fun and flexibility. Lets try to solve that one together. Your turn. Somebody else might want to decrypt the FTP information stored in sOpaqueString in table tblPublishLocation ;-)

> Also,  You said "...nor does it contain any malware
> or spyware."

Goes without saying...right.

> I don't think your utility does;
> however, the help file is for GLPRO,
> which I assume to be the program used
> to create this utility.

Yes, did it with GLPRO. And lets be clear right away: GLPRO does not and never has included any malware of any kind. It was a tragically futile attempt to de-throne Macromedia Director...although the language, engine and technology was way better in any respect. I know this quite well as we did many, many commercial projects with GLPRO in the past six years.

> When I go to gmedia.com, I get Bad Request (Invalid

The inventors of GLPRO, the company Gmedia Plc is dead (RIP). A fantastic piece of software, trust me. A tragic end. Company was sold for peanuts to some american company. They missed the Web / Browser trend (Macromedia went Flash) and never did a browser plug-in for GLPRO scripts.

Summary: GLPRO is absolutely clean. It is fun to work with, fast and you get immediate results.

Patrick Thomas
http://www.citydeskwizards.com

Patrick Thomas
Thursday, December 09, 2004

And thanks for the warning regarding those old websites...don't visit them.

Patrick

Patrick Thomas
Thursday, December 09, 2004

Oops, just saw that the gldbc connector used does not support BLOB data retrieval...we'll see what we can do...

Patrick

Patrick Thomas
Thursday, December 09, 2004

See also here about BLOBs in CD

http://discuss.fogcreek.com/CityDesk/default.asp?cmd=show&ixPost=3538

Patrick

Patrick Thomas
Thursday, December 09, 2004

Patrick,

What an amazing effort. Thank you!

Oooooh, now what about... the possibility... of having a way to query an external Access mdb that's not part of the cty?

If so, you are giving us the ability to reverse engineer CD, and build our own version of Version 3. Kudos to you!

Now... if what you've done can connect to MySQL directly, wow!

Patrick, may I suggest that you set up a CDDBScript forum/knowledge base on your website. All us diehards could upload our work/improvements to your website in the spirit of open source development.

You've brought CD to the next realm, and so you should take ownership of this next realm of development. CD is dead in FC's hands.

As well, should FC go belly up, or decide to pull the plug on this forum, you'll have not lost any "open source" development/knowledge base of your new CD incarnation.

I look forward to delving into your zip. Thank you for your initiative and efforts :-)
-Bob

Bob Bloom
Friday, December 10, 2004

Wow, I just played with the sample script txt file and got Patrick's util to read my external mdb.

I'll have to see what I can do with the scripting language. My goal is to create html files from a database, integrating with the CD templates. Looks like the solution is here.

-Bob

Bob Bloom
Friday, December 10, 2004

Patrick:

More...

Ok, what if I define "dynamically create html pages" as copying records in an external table to the tblArticle table in the cty.

(1) copy (update) records from external table to tblArticle via CDDBScript.exe

(2) launch CD
(3) PUBLISH as usual

(4) delete copied (update-d) records in tblArticle.

Would this work?

You know the CTY table structure much better than I do, and your SQL is better too. Would we need a join?

BTW, Can we update to a blog type from a memo type?


Maybe something like this:
---------------------------------------
start:

;reading article headline's -> see CityDesk table structure
dbcRSOpen("SELECT * FROM external_table",@dataBuf) 

beginLoop 
    dbcRSGetData(0,"extHeadline",@dataBuf)  <-- read the field extHeadline from the external_table table in the external mdb
    UPDATE command  <-- UPDATE from external mdb to tblArticle
    if (dbcRSMoveNext() == "-9") 
        break
    endif
endLoop

dbcRSClose() 

return 
---------------------------------------


Am I on the right track? Can you suggest the UPDATE command? Do the field types have to be the same when mapping from external db to cty?

Thank you!
-Bob

Bob Bloom
Friday, December 10, 2004

HTML DbScript is still superlative in creating lists within articles from records in an external db. Each record is a <li></li> within an article, for example.

CDDBScript looks like it will be superlative creating html pages from records in an external db.

Just wanted to state a diff btw the two utils.

Bob Bloom
Friday, December 10, 2004

*  Recent Topics

*  Fog Creek Home