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

Using JavaScript to create a 'database' of sorts from Illustrator

Community Expert ,
Jan 08, 2016 Jan 08, 2016

Copy link to clipboard

Copied

Happy Friday, fellow scripters!

I just had a thought regarding time tracking of orders within my department that I'd love to get your thoughts on. Up until now, my staff has used an excel template to log their time in/out for any particular job they're working on. In addition, for more colorful data, the excel spreadsheet includes columns regarding quantities of uniforms, art applications, and other variable data related to the job.

It's very time consuming for the artists to fill this out 20-30 times per day, and even more time consuming for me to combine everybody's separate spreadsheets into something that I can use to generate useful department wide data for the big boss.

The data I'd like to track:

User name

Start time

Order number

Customer name

Number of applications per garment (ie, front logo, player name, player number)

Type of garment (specific style number)

Finish time

All of this data with the exception of the user's name and start/finish time are built into the files they'll be using, so I can pull that info straight from the file itself without the need of prompting the artist for the information, and I'm hoping i can grab the user name from the system somehow, and start/finish times are easy enough to do with timestamps at runtime.

My question:

Is it possible (or even advisable) to get all of this information and write it to some sort of centralized JSON database file? Is it possible to use ESTK to write a .js file that I can then access and rewrite at a later time? If not, could I just write the JSON as a .txt file, then simply eval() when i want to read/rewrite info?

Has anyone done anything like this? Should i quit this foolish venture now because I'm young and naive? Any advice?

Thanks, all.

TOPICS
Scripting

Views

3.8K

Translate

Translate

Report

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
Adobe
Community Expert ,
Jan 11, 2016 Jan 11, 2016

Copy link to clipboard

Copied

agree with SilllyV, writing to a text file (txt, csv, json, xml) would require to write the whole thing back after your edits, you can't pick where to write data...unless you allocate all the characters/bytes before hand then you could try to find and write new data let's say in row 10 and write the exact amount of bytes to replace those with new info...so not practical, unless I'm missing something.

another option would be to use vbscript, or vba, you could have Excel and Illustrator talk to each other all day long and read and write data anywhere needed.

Votes

Translate

Translate

Report

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
Valorous Hero ,
Jan 12, 2016 Jan 12, 2016

Copy link to clipboard

Copied

Actually could he rig something up to work in an MS Access database? I think if you can use AS or VB to talk to excel, it could be possible to do that with Access, but I've no experience with that whatsoever.

But along the same lines, and according to the wisdom of a wise scripter from faraway lands, it's possible to use AS or VB and a 'webservice' to query databases.. but I also have minimal experience with putting up your own database and connecting computers to it, at this point.

Votes

Translate

Translate

Report

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 Expert ,
Jan 12, 2016 Jan 12, 2016

Copy link to clipboard

Copied

yes, absolutely, Access works as well.

I would love to see a working sample from the wise scripter in faraway lands

Votes

Translate

Translate

Report

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 Expert ,
Jan 11, 2016 Jan 11, 2016

Copy link to clipboard

Copied

Another option could be to use a dedicated tool/service, which has better time capturing that is not as rich in other areas:

https://www.openhour.com/features/#profeatures

Votes

Translate

Translate

Report

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
Engaged ,
Jan 28, 2016 Jan 28, 2016

Copy link to clipboard

Copied

So, I thought I'd throw this into the conversation:

Illustrator script that uses the command line to cURL a JSON file on remote server. This is just an ...

Long story short, this script creates .term and .sh files; the .term file sets permissions on the shell script and the shell script requests a json file hosted on my Dropbox public folder (see json file above). This script then writes the contents of the response to a file, reads that file and parses the json.

I was thinking it could be interesting to read a remote API, cache it to a local JSON file (for easy reading by JSX) and then when ready, reverse the process to write data back to API.

Note: I would like to figure out a way get a return value from var result = $term.execute();

(I am currently using the above term and .sh file workflow for a plugin that talks to ImageMagick.‌ As an experiment, I thought I'd try to use it to read remote data … one could also read a local database using some technique.)

Votes

Translate

Translate

Report

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 Expert ,
Jan 29, 2016 Jan 29, 2016

Copy link to clipboard

Copied

weren't we back to square one? reading/writing to JSON is possible straight with jsx.

Votes

Translate

Translate

Report

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
Engaged ,
Jan 29, 2016 Jan 29, 2016

Copy link to clipboard

Copied

LATEST

CarlosCanto wrote:

weren't we back to square one? reading/writing to JSON is possible straight with jsx.

LOl, oh, my bad. Sorry to re-share "the wheel" with y'all.

i was just stoked on the whole term/shell/bash/cURL thing.

Have a great day all!

Cheers,

m

‌

Votes

Translate

Translate

Report

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