Digital Art Zone

 
     
(SOLVED) Help with App.showURL for opening local files
Posted: 21 October 2013 02:25 AM   [ Ignore ]
Addict
Avatar
RankRankRankRank
Total Posts:  4719
Joined  2005-08-03

I have a userguide in the same folder I’m trying to call it from in the content library. This is what’s in the dsa:

// DAZ Studio version 4.6.2.23 filetype DAZ Script

App.showURL"file://Userguide.pdf" ); 

From what I’ve found, this should work for a local file. I can do online urls all day, but local files are giving me headaches.

Can someone please save my sanity? lol

 Signature 

Wearing duck crap doesn’t make you a duck - Floki
@Deviantart | @ShareCG
Tutorial: V4 Transmap Brows on Genesis via DS only.
——————————-
Websleuths - Help bring the missing home and give names to those who don’t have them.

Profile
 
 
Posted: 21 October 2013 05:06 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  14033
Joined  2003-10-09

Does this help? http://www.daz3d.com/forums/viewreply/423002/ . Though it may be your path that’s at fault - you need an absolute path, not a relative path, for the App.show functions.

 Signature 

DAZ Studio Frequently Asked Questions

Index of free DAZ Studio scripts and plugins list

Profile
 
 
Posted: 21 October 2013 12:01 PM   [ Ignore ]   [ # 2 ]
Addict
Avatar
RankRankRankRank
Total Posts:  4719
Joined  2005-08-03
Richard Haseltine - 21 October 2013 05:06 AM

Does this help? http://www.daz3d.com/forums/viewreply/423002/ . Though it may be your path that’s at fault - you need an absolute path, not a relative path, for the App.show functions.

I was afraid you were going to say that. lol

The script you pointed me to works to open the current directory (just like right click > browse to folder location), but just like the previous, it doesn’t open the file itself, even if using relative or absolute. I was hoping to get away with using a relative path though since not everybody will have “F:\My Freebies\Plasmaball\Shader Presets\Vaskania\Plasmaball” lol

If using relative isn’t possible, I suppose I could just put an info.duf.png with instructions labeled on it to right click > browse to view the userguide.

 Signature 

Wearing duck crap doesn’t make you a duck - Floki
@Deviantart | @ShareCG
Tutorial: V4 Transmap Brows on Genesis via DS only.
——————————-
Websleuths - Help bring the missing home and give names to those who don’t have them.

Profile
 
 
Posted: 21 October 2013 01:46 PM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  14033
Joined  2003-10-09

If the script is going to run from the folder with the pdf you can use getScriptFileName() to get the current location, trim it back to the path, and then add the pdf name.

 Signature 

DAZ Studio Frequently Asked Questions

Index of free DAZ Studio scripts and plugins list

Profile
 
 
Posted: 21 October 2013 07:53 PM   [ Ignore ]   [ # 4 ]
Addict
Avatar
RankRankRankRank
Total Posts:  4719
Joined  2005-08-03

Not a clue how to do that. lol I never stuck with learning javascript.

I have the SDK docs, and found the function, but I can’t find any examples of how to use it.


/edit
Could getAbsolutePath() or getFullPath() do what I need? When I attempt them, I get variable not found errors, but I’m not sure I’m even using them right. lol

/edit 2
Found and tried this, and created a dummy index.html. Syntax error. I’m assuming it no longer works since it says ‘void’ next to it in the SDK docs.

// open a local html file in the user's browser
    
dzApp->showURL"file://" dzApp->getDocumentationPath() + "index.html" ); 

/another edit
Egad, ok, I’m done with experimenting and waiting for you. I’ve somehow managed to create a script that continuously launches an infinite number of Daz Studios that you cannot stop, forcing you to restart. LOL

 Signature 

Wearing duck crap doesn’t make you a duck - Floki
@Deviantart | @ShareCG
Tutorial: V4 Transmap Brows on Genesis via DS only.
——————————-
Websleuths - Help bring the missing home and give names to those who don’t have them.

Profile
 
 
Posted: 21 October 2013 10:27 PM   [ Ignore ]   [ # 5 ]
Administrator
Avatar
RankRank
Total Posts:  330
Joined  2003-10-09

The [plugin] SDK docs are not really going to help you if you don’t know the differences between ECMAScript, QtScript, DAZ Script and C++.  The syntax you have there is C++.  The equivalent, except to a path that actually ships with the application, in DAZ Script would be:

App.showURLString("file:///%1/DAZ Studio/what_is_studio.htm").argApp.getDocumentationPath() ) ); 

In this example, I use String.arg() to construct a string that represents a URL using the file URI scheme, where “%1” is replaced by the base path being passed to the arg function.

The solution that Richard describes, using your description of a pdf in the same folder [with the same name], looks like this:

// Create a file info object, using the path of the current script
var oFileInfo = new DzFileInfogetScriptFileName() );
// Prompt the operating system to do whatever it does with the given file type; same path/name as script
App.showURLString("file:///%1/%2.pdf").argoFileInfo.path() ).argoFileInfo.baseName() ) ); 

-Rob

 

 Signature 

- Documentation Center
- Install Manager
- DAZ Studio 4.x
- DSON Importer
- DSON File Format Specification

Profile
 
 
Posted: 21 October 2013 10:56 PM   [ Ignore ]   [ # 6 ]
Addict
Avatar
RankRankRankRank
Total Posts:  4719
Joined  2005-08-03

Yea I never did get into much programming. I taught myself to write html/css and maintain/edit/create php coding and mysql databases with a splash of perl thrown in for certain scripts, and that was about it. With languages I don’t know, I have an easier time reading and interpreting what’s already written as opposed to writing it. I miss coding in any form, but it’s been so long I have no idea where to start anymore.

That 2nd code works perfectly for what I’m looking for. Thanks. smile

One question, I get that the var oFileInfo is creating a function (oFileInfo) for the subsequent code, but what is the ‘new’ for? Is that to create a class that doesn’t exist (DzFileInfo- couldn’t find it in the listing), and because getScriptFileName is part of DzScriptContext, making it a global string, you were able to define a new class for it?

 Signature 

Wearing duck crap doesn’t make you a duck - Floki
@Deviantart | @ShareCG
Tutorial: V4 Transmap Brows on Genesis via DS only.
——————————-
Websleuths - Help bring the missing home and give names to those who don’t have them.

Profile
 
 
Posted: 22 October 2013 01:40 AM   [ Ignore ]   [ # 7 ]
Administrator
Avatar
RankRank
Total Posts:  330
Joined  2003-10-09

The new operator instantiates (creates an instance of) the class/object that follows it.  “var oFileInfo =” is assigning the result of that operation to a variable, so that we can access the object instance that is created.  Each script is executed within a context, a DzScriptContext instance.  The methods on DzScriptContext are therefore provided as functions in the global scope of the script/context; this means that they don’t need to be preceded by anything - DzScriptContext is assumed. Thus getScriptFileName() returns the [full] filename of the currently running script.  This path is passed to the DzFileInfo constructor in order to initialize it for that particular file… so we can get information about the file, like its [directory] path and [file] basename.

The DAZ Studio 4.x Scripting docs are in the midst of a [very long] conversion process, which I work on in my “spare” time; i.e. nights/weekends that are not consumed by other projects/priorities.  Needless to say, in their current state, they are but a skeleton of what will eventually be.  I only recently started populating the Object Index within the last few weeks.  In light of this, quite a while ago I made the DAZ Studio 3 scripting docs available here, rather than letting them follow DS3 into retirement.  Much of the DS3 API is the same in DS4, so a significant portion of that documentation still applies - geometry related areas being of the more significant differences. In that documentation you’ll notice a much larger list of classes/objects.

-Rob

 Signature 

- Documentation Center
- Install Manager
- DAZ Studio 4.x
- DSON Importer
- DSON File Format Specification

Profile
 
 
Posted: 22 October 2013 02:20 AM   [ Ignore ]   [ # 8 ]
Addict
Avatar
RankRankRankRank
Total Posts:  4719
Joined  2005-08-03

Thank you! The language reference in the DS3 API docs is exactly what I was hoping for (either I’m blind, or those aren’t in the 4.5 version).

 Signature 

Wearing duck crap doesn’t make you a duck - Floki
@Deviantart | @ShareCG
Tutorial: V4 Transmap Brows on Genesis via DS only.
——————————-
Websleuths - Help bring the missing home and give names to those who don’t have them.

Profile
 
 
Posted: 22 October 2013 05:27 AM   [ Ignore ]   [ # 9 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  14033
Joined  2003-10-09

As Rob said, the 4.5 version is only starting to appear - in fact I didn’t realise he had started to populate it (thank you for doing so, Rob). The DS3 docs are useful for a lot of things, though there have been changes which can trip us up.

 Signature 

DAZ Studio Frequently Asked Questions

Index of free DAZ Studio scripts and plugins list

Profile
 
 
Posted: 22 October 2013 06:13 PM   [ Ignore ]   [ # 10 ]
Addict
Avatar
RankRankRankRank
Total Posts:  4719
Joined  2005-08-03

I was referring more to the downloaded docs. The 4.5+ docs I downloaded through DIM doesn’t have the Language Reference, but the online version of the 4.5+ docs apparently does.

I’ll have to keep an eye on the online version as I didn’t know it was different than the downloaded version.

 Signature 

Wearing duck crap doesn’t make you a duck - Floki
@Deviantart | @ShareCG
Tutorial: V4 Transmap Brows on Genesis via DS only.
——————————-
Websleuths - Help bring the missing home and give names to those who don’t have them.

Profile
 
 
Posted: 25 May 2014 07:06 AM   [ Ignore ]   [ # 11 ]
Active Member
Avatar
RankRank
Total Posts:  563
Joined  2011-06-14

Hello,
I know this is an old topic but…
I’m making a pretty complicated product, and I’d really like to add documentation in the main directory, as a pdf tutorial file.
For now the only solution I found so that people can load the pdf directly from the content library is this script shared in this topic.
I tried this and… it works like a charm!!!
So my question is : Am I allowed to re-use this script to load my help files via my content directory?
Thanks in advance for your inputs on this subject!

 Signature 

During the year of abundance, the grass was so high that the cows had to jump to graze on.
kadix - V3Digitimes
My Store at DAZ : http://www.daz3d.com/v3digitimes
My Deviant Gallery : http://rankerx.deviantart.com/

Profile
 
 
Posted: 27 May 2014 10:38 AM   [ Ignore ]   [ # 12 ]
Administrator
Avatar
RankRank
Total Posts:  330
Joined  2003-10-09

Yes, you are free to use the examples that I post in the forums in your own projects unless I state otherwise.  In the case of forum posts, a nod in the direction of the source is appreciated, but not required*.  The samples I post to the Documentation Center fall under the license linked at the top of the Scripting Samples page.  All other content on the Documentation Center falls under the CC Attribution 3.0 Unported license, as posted in the footer of every page.

*FWIW: I’m human.  Courtesy and respect go a long way.  A lack of it has the tendency to do the opposite.  Blatant disregard for it… ensures that I use my “spare” time to help someone else.

-Rob

 Signature 

- Documentation Center
- Install Manager
- DAZ Studio 4.x
- DSON Importer
- DSON File Format Specification

Profile
 
 
Posted: 27 May 2014 10:56 AM   [ Ignore ]   [ # 13 ]
Active Member
Avatar
RankRank
Total Posts:  563
Joined  2011-06-14
rbtwhiz - 27 May 2014 10:38 AM

Yes, you are free to use the examples that I post in the forums in your own projects unless I state otherwise.  In the case of forum posts, a nod in the direction of the source is appreciated, but not required*.  The samples I post to the Documentation Center fall under the license linked at the top of the Scripting Samples page.  All other content on the Documentation Center falls under the CC Attribution 3.0 Unported license, as posted in the footer of every page.

*FWIW: I’m human.  Courtesy and respect go a long way.  A lack of it has the tendency to do the opposite.  Blatant disregard for it… ensures that I use my “spare” time to help someone else.

-Rob

Thanks a lot! I want to ... cc3 you.. Well I guess cc3 is not a verb…
I think that’s not only important but also normal to do so because it is ... just ....“Courtesy and respect”...
Well I’d like to mention you as the origin of the code, how do you prefer me to do that? Can I include the link to this forum page in the dsa file calling the document as well as your name, or do you prefer another way to do that?

 Signature 

During the year of abundance, the grass was so high that the cows had to jump to graze on.
kadix - V3Digitimes
My Store at DAZ : http://www.daz3d.com/v3digitimes
My Deviant Gallery : http://rankerx.deviantart.com/

Profile
 
 
Posted: 27 May 2014 12:06 PM   [ Ignore ]   [ # 14 ]
Administrator
Avatar
RankRank
Total Posts:  330
Joined  2003-10-09

You’re welcome.  A comment linking back to this thread, or the post with the code is great.

Ultimately, my goal is to spread the knowledge… and the history along with it.  I enjoy helping people [who are appreciative of it].  I want to make it easier for the next guy/gal, so that they can focus their energy on bigger and better things.  We all stand on the shoulders of those that came before us.

-Rob

 Signature 

- Documentation Center
- Install Manager
- DAZ Studio 4.x
- DSON Importer
- DSON File Format Specification

Profile