SOME EASY scripts, what does work "out of the box"

Started by sinus, July 03, 2017, 09:14:08 AM

Previous topic - Next topic

sinus

IMatch 2017 comes with quite a lot of examples and a very good help and documentation. But the examples are for me still too complicated, simply because they are packed with too many stuff in it (like the Metadata- or the Attribute-examples).
What I should have, are simple, fully working examples and mabe some other users think the same.
If so, please like it.

Running this scripts from the App inside IMatch, the results would be in a new window or neatly displayed in the App itself).

1) Metadata-script with something like this:
- Read 2 metdata-fields from the focused file.
- Show this neatly in a window in two fields.
- Then I could write/edit the values from these 2 fields.
- Finally I could push a button and the changing would be written in the DB (write-back I could do later in IMatch).
That's it.  :D

I think, with such a small, clean code I would be able adding some more fields of my wishes. If the script would be "too good", the code would be longer and I would be lost in the code.
The same is guilty, if the code is only a snippet. In this case I am not able to do these fields into a window with the values in fields and I am not able to create a button to write this back.

I tried it really hours for hours, days for days, with parts of success, but finally I am not able or did not try enough long.



2) Attributes-script with 4 Attributes:
(also only 1 Attribute would help)
- Read  from 2 different sets (like in the help, submissions and info, for example), two fields from each set. Means 4 fields.
- Read these 4 fields and show the values in 4 fields in a window.
- There I could edit the value.
- A button for write back this edited values.
That's it.  :D

With such easy, but finnished working scripts I personally could work.
I could add some more fields and do some changings, I think.

I think (of course I do not know) creating such scripts would help some users.

And the final target would be, that with such scripts I could change to IM2017 (what I can not now)  ;D
Best wishes from Switzerland! :-)
Markus

Mario

The requested scripts are not "easy".
We discussed this already, I provided code, examples, walked you through etc. For example: https://www.photools.com/community/index.php?topic=6778.msg46892#msg46892 or https://www.photools.com/community/index.php?topic=6636.msg46504#msg46504 or

The Metadata and Attribute sample scripts shipped with IMatch have been designed to be "easy".
They do read/write/update/delete metadata or Attributes. Everything isolated in a single function and run by a button click. This makes it easy to follow the code and to see how it works. You can just set a break point in your browser to step through the code.
No way to make this easier, sorry.

Mixing code that demonstrates how to use the metadata / attribute functions with code that does formatting as you suggest ("Show this neatly in a window in two fields. ") will make the script way more complex. This is why the sample apps use easy user interfaces or rely on console.log(...) to show data.

I recommend you carefully study the over 30 sample scripts provided by IMatch, the scripts ubacher and others posts here. the IMatch Developer Center and especially the very easy to follow Code Recipes and Tips which has tons of read-made copy/paste code.

If you have problems with formatting or HTML, there are many tutorials out there which show you how to create tables with HTML or how to format data neatly using the CSS styles provided by Bootstrap. This is independent from IMatch.

If you want a specific app to be written, you can hire me. Send me an email in that case.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

sinus

Quote from: Mario on July 03, 2017, 09:36:58 AM
The requested scripts are not "easy".

Thanks for your answer, Mario.
Yep, that is also MY impression.
JavaScript may be very  modern and can do much more than the old Visual Basic (WinWrap).
But it is much more difficult and complicated then Visual Basic.

With the old IMatch-script-language this would be very easy and I think, you would not deny this.
With JS it is not easy, like you wrote, I agree.


But I am aware, that the old script-language is gone in IMatch2017 and I have no problem with that.
JS is the way to go, I am aware of this.

I have only trouble to lern it proper in a proper time and if I read some user-comments, I am not the only one.

Thanks for your answer, I thouhgt really, this would be easy. Well, I was wrong, sorry.

Best wishes from Switzerland! :-)
Markus

Mario

QuoteWith the old IMatch-script-language this would be very easy and I think, you would not deny this.
With JS it is not easy, like you wrote, I agree.

I recall many users (at that time) having problems with writing scripts which access metadata or Attributes. I'm not sure, but I think you also had problems getting this to work. And I believe it was really complicated to write a BASIC script which does what you request above, displaying metadata in columns. This is much easier to do in HTML, but I explained that last week to you, with examples. If even that does not help you, I'm at a loss.

If all the IMatch sample scripts, the IMatch scripting tutorials and the code recipes, the thousands of free written and video tutorials for HTML and JavaScript available on the internet don't help...maybe JavaScript and HTML is not for you.

You always request "easy scripts" - this will not help you.

You never tell us what kind of app you want to write, how far you got with your app, what your specific problems are etc. If you have looked at the very good and easy to follow tutorials available on W3Schools etc. Impossible to help you without knowing all that.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

sinus

Thanks Mario, again

I will think about it, and yes, maybe is JS and HTML not for me, could really be.
Though I was able (but, yes, with troubles) to write some scripts with JS and HTML, but without work with fields from IMatch-images.

I will deeper think about it.
Thanks.  :D
Best wishes from Switzerland! :-)
Markus

Mario

Last week I've posted code for you that explains how to access metadata. It's as simple as adding a tag statement to the /files endpoint call. No way to make this easier. There is an entire section on that in the Code Recipes. You can just copy/paste that, change the tag names to what you need and you are done...
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

thrinn

Markus,
maybe I can help you with a rather small example I have cobbled together (if that is the correct term for "zusammenschustern").
It is really barebone: An input form for two metadata tags, a save button.
The form data changes when the focused file changes. You can enter some data and press save.

Please be careful, there is no error checking or other types of safety belts. As simple as possible.

Most of this I copied from the metadata sample app. It is really all there.
Thorsten
Win 10 / 64, IMatch 2018, IMA

sinus

Quote from: thrinn on July 03, 2017, 08:04:38 PM
Markus,
maybe I can help you with a rather small example I have cobbled together (if that is the correct term for "zusammenschustern").
It is really barebone: An input form for two metadata tags, a save button.
The form data changes when the focused file changes. You can enter some data and press save.

Please be careful, there is no error checking or other types of safety belts. As simple as possible.

Most of this I copied from the metadata sample app. It is really all there.

Hi Thorsten,
You made my day! Cooler than cool!
Thanks a lot for this!
[/b]

It works great! First I had a message about a double ID, so I replaced only the last A with a B
  "id": "7B4C51E5-AB4C-4AED-BB14-9919C34DAA0A",

and then your script worked like a charm.
Thanks also for your explanations in the script, very convenient.

I think, now I can really study this script and I am quite sure, that I can expand it with some more fields (about 10).
Because I can see for example the filed "city" and can follow your steps and so I will be able (I think) to add more fields.


What I am not sure, if I can do this also with attributes-fields, but I think, I will be able to do so.
If not, I could ask here on the forum a specific question, and a nice user like you  :D would maybe help me.

I wonder, you made this script in (for me) notime, I do not know, how long you had.
But it works great. And you want not know, how long I tried and tried and read Marios and other documenations, copy and pasted lines here and there: no success.  :-[

Although Mario wrote, that such a script is not easy, of course you have the knowledge and if it were easy, I could do it.
But even for me your lines looks not that complicated and thanks of your comments, I think I could work on it now.

At least all difficult things (for me) are here, like I wrote above, super.
- read some fields
- display these fields
- I can edit this fields
- I can save these changings in the DB

Cool.

PS: I think "cobbled together" is the correct term for "zusammenschustern".  :D
Also, nochmals besten Dank, das hilft mir echt.

PS2: so for once you solved a Feature request instead Mario, maybe this is also a rarity, I guess, Mario will like it also - ein nerviger user weniger  :o  8)
Best wishes from Switzerland! :-)
Markus

thrinn

Quote
What I am not sure, if I can do this also with attributes-fields, but I think, I will be able to do so.
It should not be too complicated. You would presumably have to use other endpoints to read and write the data, but the Attributes sample app should help to identify those. If you run into problems, just ask.

The new scripting world is fascinating and much more versatile than the old Basic one. In Basic, you had to understand the language and the IMatch object model, and that was all. Now, we need a bit of HTML to bring something on the screen. Then some JavaScript, a language which is still evolving quite fast. JQuery is written in JS, of course, but more important is to know what the $ functions of jquery do. All of this is well documented, but at different places. I am sure we only need a very small part of the functionality jQuery and Bootstrap and whatnot offers, but to identify which part can be difficult at first.
Thorsten
Win 10 / 64, IMatch 2018, IMA

sinus

Thanks, Thorsten, for your effort.

If I do buy nowadays a new camera, the manual is almost heavier then the Nikon (e.g. Nikon D750) itself.  ::)
A modern camera offers you a LOT of possibilities, knobs, prefernces, and so on.

But if I give my camera my brother, it is enough, if I explain him the most important things. Although the other things are surely fascinating, he must not (and want not) use the "tingle and blinking" stuff.
And with his basic knowledge he is able to produce very good images.

I see it a bit in the same direction with JavaScript/HTML, jQuery and so on. I personally will not be able to produce a super-duper script. But I am fully happy, if I an produce some working scripts for my use.

That is why I am happy, that you helped me with some basic steps. If I see suddenly a light in the tunnel, then maybe I can go to the next, more difficult step.
If I have troubles with doing the same like you did with Attributes, I would again ask.

But sometimes I have also to earn some money - at the moment I do some shootings, well, ähem, from swiss cheese in our photostudio.  ;D
Best wishes from Switzerland! :-)
Markus

sinus

Thorsten, hey, you made it really for me, the path to success.  ;D  :D

With your small script I was really able to add Headline and description as fields.
Hence I know, I will be able to add more fields.

I am quite sure, your script is very good for beginners, because it has the whole stuff in it.
It does code two fields, read the fields and shows them in a nice form.
It gives the possibility to edit these fields.
I can even switch to other images.
And finally there is a button to store all.

Thats it for me, this was it, what I needed.
The examples from IMatch are great ... but I could not use them, because they showed me not, how to display it in a form and edit them.
And they are so sophisticated, that I cannot change them.

In contrary to your script, this is easy to understand and fully working.
Exactly what I asked for, like in the title of this thread. Thanks a lot again!

IMatch2017, you have to wait a bit ... but I will coming!  ;D
Best wishes from Switzerland! :-)
Markus

unterwasserfoto_at

Hallo Markus

nun denke ich ich bin im selben Stadium wie du. Darf ich dich bitten dass du das ZIP-File nochmals hochlädst. Bei mir lässt sich das ZIP-File nicht öffnen. Frag mich aber nicht warum. Das habe ich bei einigen ZIP-Files hier im Forum.

DANKE
Tom
Berufsfotograf in Österreich.
HW: Nikon D5, Nikon Coolscan 5000, Subal Unterwassergehäuse, DJI Phantom
SW Photoshop CS4, Adobe Bridge, IMatch6

ubacher

I tried opening the downloaded file and it does not open! Seems something wrong with the blogging system?

sinus

Quote from: unterwasserfoto_at on October 30, 2018, 12:06:31 AM
Hallo Markus

nun denke ich ich bin im selben Stadium wie du. Darf ich dich bitten dass du das ZIP-File nochmals hochlädst. Bei mir lässt sich das ZIP-File nicht öffnen. Frag mich aber nicht warum. Das habe ich bei einigen ZIP-Files hier im Forum.

DANKE
Tom

Tom,
tut mir echt leid, das habe ich nicht mehr, würde ich sonst gerne senden.
Es ist halt so, ich hatte anfangs grosse Probleme mit Apps, habs selbst versucht und bin gescheitert, kann leider praktisch kein JavaScript.

Ich brauche heute eigentlich (fast) nur noch eine App, die ich auch von Thorsten habe, und die ist cool, aber so speziell, dass sie nur hier auf meinen Workflow passt.
Bei Apps mache ich es halt so, ich versuche sie, wenn sie mir helfen, verwende ich sie, wenn nicht, dann lösche ich sie, weil ich sonst zu viele Apps habe.
Und vor allem, mittlerweile mache ich fast alles nur mit native IMatch. Manchmal halt mit 2x clicken anstatt einmal. (zum Beispiel mehrere Categorien setzen UND Sachen von Metadata Template setzen, das hätte ich früher mit einem Script gemacht, und das dies meines Wissens nicht geht, muss ich dafür halt 2 Favoriten erstellen und 2x klicken).

Best wishes from Switzerland! :-)
Markus