Source language: Translate to:

Help with tmStorage

Questions about NeoBook PlugIns

Moderator: Neosoft Support

Help with tmStorage

Postby rcohen » Sat Sep 08, 2007 10:18 pm

I've been looking for the error in my scripting all day on this one, and I can't for the life of me figure out why this isn't working. I KNOW it's not the plugin as the tmStorage demo works just fine. But yet, what is pretty basic scripting isn't seeming to work for me.

I select a JPG here and place it into a stream file.

In a button I have::

Code: Select all
SetVar "[ImageFile]" ""
FileOpenBox "Choose an Image File" "JPG|*.JPG" "" "[ImageFile]" ""

If "[ImageFile]" "=" ""
Return
Endif

...  I change the file extension for the name of the stream file.

ChangeFileExt "[ImageFile]" ".axm" "[NewFileName]"
ExtractFileName "[NewFileName]" "[NewFileName]"
tmCreateStream "[pubdir]axm\[newfilename]" "password" "1"
Delay "500"
tmPutFile "[pubdir]axm\[newfilename]" "[ImageFile]" "password" "1"

SetVar "[Status]" "Saved [newfilename] :: Complete"
Delay "2000"

SetVar "[Status]" ""



When I go to display it with this ::
Code: Select all
FileOpenBox "Choose" "axm File|*.axm" "[pubdir]axm" "[pfile]" ""
tmStorageGetFileList "[pfile]" "password" "1"
tmExtractFile "[PFile]" "[tmStorageListDir]" "password" "c:\temp\" "1"


And I get an error from tmStorage 003, followed by 004 which of course means that it could not find a file nor extract it.

It seems so very simple, yet I can't make it work ;-( And I know it's gonna boil down to something silly obvious ... {grin}

I'd appreciate any help I can get on this one...

Thanks

rcohen
User avatar
rcohen
 
Posts: 279
Joined: Sun Apr 03, 2005 7:29 pm
Location: The Smokey Mountains, Tn

Postby Wrangler » Sun Sep 09, 2007 9:40 am

Yes, Rob, this is a tough one. I got this to work:

SetVar "[ImageFile]" ""
FileOpenBox "Choose an Image File" "JPG|*.JPG" "" "[ImageFile]" ""

If "[ImageFile]" "=" ""
Return
Endif

... I change the file extension for the name of the stream file.

...ChangeFileExt "[ImageFile]" ".axm" "[NewFileName]"
...ExtractFileName "[NewFileName]" "[NewFileName]"
tmCreateStream "[pubdir]axm\teststream.str" "password" "1"
Delay "500"
tmPutFile "[pubdir]axm\teststream.str" "[ImageFile]" "password" "1"

SetVar "[Status]" "Saved [newfilename] :: Complete"
Delay "2000"

SetVar "[Status]" ""

AlertBox "" "About to extract file"

FileOpenBox "Choose" "str File|*.str" "[pubdir]axm" "[pfile]" ""
tmStorageGetFileList "[pfile]" "password" "1"
tmExtractFile "[pfile]" "[ImageFile]" "password" "c:\temp" "1"

It might help if I understood what you are trying to do here. It appears the problem is in the 2 lines I remmed out. Why are those 2 lines necessary?

Note: When checking c:\temp for the extracted file, I realized how much junk is in the folder! :o
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1505
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby rcohen » Sun Sep 09, 2007 11:57 am

Hiya Wrangler... thanks a bunch for this...

It seems then, that the tmStorage plugin does not like variables used as part of the file calling process... ;-( This causes me a problem but I guess I can add an extra process to create a temp file and then rename it accordingly.

The two lines you commented out was an attempt at creating a new file extension with the original filename, for the purpose of naming the stream accordingly...

Thank you much for your assistance Wrangler... that's the one thing I did NOT check...

Cheers

rcohen
User avatar
rcohen
 
Posts: 279
Joined: Sun Apr 03, 2005 7:29 pm
Location: The Smokey Mountains, Tn

Postby Wrangler » Sun Sep 09, 2007 12:24 pm

I can't see the reason to name the stream accordingly. As a matter of fact, it will work WITHOUT an extension, which I don't know if you know. So why not just create one stream to store any file? Does it matter what the stream is named?
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1505
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby rcohen » Sun Sep 09, 2007 9:01 pm

Hiya,

I don't think it's a problem with what the stream is named... from what your testing revealed... At first, I believed the problem to be the fact that I was declaring the name of the file using a variable. But then I realized that the demo that comes with tmStorage ALSO uses a variable to declare the name of the file. So, now I'm REALLY confused as to why my code is not working... everything seems to check out.

To answer your question, yes it matters what the streamed is named, as I am creating a type of compiler for a closed ended system... and once the user "compiles" the media it is to take on the name of the original file, plus the new file extension. BUT, since you pointed out to me that the system will work even without a file extension, then this means that what I'm naming it is not the problem either... of course I didn't expect the filename to be an issue (problem) either... {shrug}

I just need to create the stream file correctly and to be able to extract the media when needed...

I'm going to take the method you came up with and code a work around for my filenaming convention... but I sure wish I understood why this was necessary. It must be something extremely obvious as this is usually what it winds up being when I bump into issues such as this ;-)

Thanks again for your assist...

r
User avatar
rcohen
 
Posts: 279
Joined: Sun Apr 03, 2005 7:29 pm
Location: The Smokey Mountains, Tn

Postby remlap » Mon Sep 10, 2007 6:54 am

Robert:

I don't think the current version of tmStorage supports Directory Structures. As far as I'm aware, this feature will not be available until the next upgrade, but perhaps Alberto can comment on this?

Your code, with the directory structure removed works fine....

Code: Select all
SetVar "[ImageFile]" ""
FileOpenBox "Choose an Image File" "JPG|*.JPG" "" "[ImageFile]" ""

If "[ImageFile]" "=" ""
Return
Endif

...  I change the file extension for the name of the stream file.

ChangeFileExt "[ImageFile]" ".axm" "[NewFileName]"
ExtractFileName "[NewFileName]" "[NewFileName]"
tmCreateStream "[PubDir][NewFilename]" "password" "1"
Delay "500"
tmPutFile "[pubdir][NewFilename]" "[ImageFile]" "password" "1"

SetVar "[Status]" "Saved [NewFilename] :: Complete"
Delay "2000"

SetVar "[Status]" ""


Hope it helps


EDIT: Forget this...I misread, sorry.

The above code works, but onlt if you dump the subdirectory /amx and create the stream in [PubDir]. I have no idea why though.
Last edited by remlap on Mon Sep 10, 2007 7:20 am, edited 1 time in total.
User avatar
remlap
 
Posts: 141
Joined: Thu Jun 09, 2005 5:23 pm
Location: Lincolnshire, England

Postby Gaev » Mon Sep 10, 2007 7:06 am

Interesting conversation ... not having the plugin, I can't check anything myself ... so it becomes more of an exercise in solving a puzzle ... but I noticed that Wrangler replaced Robert's code ...
Code: Select all
FileOpenBox "Choose" "axm File|*.axm" "[pubdir]axm" "[pfile]" ""
tmStorageGetFileList "[pfile]" "password" "1"
tmExtractFile "[PFile]" "[tmStorageListDir]" "password" "c:\temp\" "1"
... with ...
Code: Select all
FileOpenBox "Choose" "str File|*.str" "[pubdir]axm" "[pfile]" ""
tmStorageGetFileList "[pfile]" "password" "1"
tmExtractFile "[pfile]" "[ImageFile]" "password" "c:\temp" "1"


a) Assuming that tmStorageGetFileList spits out the list of contents of [pfile] in a reserved variable called [tmStorageListDir], I don't understand (in Robert's code) how the tmExtractFile command would know which file in the list to extract ... is it designed to extract all files in the specified variable ? ... I know you only expect one file in the list ... but could it be that the list has some extraneous (separator) characters ... even with just one item in the list ?

b) Wrangler is specifying the filename saved in [ImageFile] ... as returned from the very first FileOpenBox ... in his tmExtractFile command ... which makes one wonder about the purpose of the tmStorageGetFileList command immediately before.

c) minor point ... but observed that for the tmExtractFile ... Wrangler specified c:\temp while Robert specified c:\temp\ ... could that make a difference ?

@Robert:

i) try and add this command ...
Code: Select all
tmExtractFile"[pubdir]axm\[newfilename]" "[ImageFile]" "password" "c:\temp\" "1"
... immediately after the SetVar "[Status]" "" command in the first section ... to verify that what you have placed in the stream can also be streamed out.

ii) if (i) works, you might want to examine the contents of the variable [tmStorageListDir] ... AlertBox its content and length ... to see that it contains what you expect it to contain.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby rcohen » Mon Sep 10, 2007 10:28 pm

Thanks guys,

Gaev, yes, I checked on some of this already (alertbox trace, etc) and got verification. Yes, I only expect one file per stream... so it was indeed the assumption, and I need to do the directory list because in the end product, I have no clue what may lay inside the stream. I do not see any extraneous data in the return... but I shall look closer.

Rob, thanks... but I checked the path issue prior and the plugin is indeed creating the file in the subfolder, no issue. But I guess you're talking about actually USING the file ? I'll have to do some more testing to figure out exactly what's going on.. but I'll get to the bottom of this I'm sure.

Thanks !! ...

Cheers

r
User avatar
rcohen
 
Posts: 279
Joined: Sun Apr 03, 2005 7:29 pm
Location: The Smokey Mountains, Tn

Postby remlap » Tue Sep 11, 2007 6:55 am

Yeah, Robert I just misread the code and replied with a load of rubbish, sorry dude.

When I was testing your code, I did have a problem in creating a stream-storage in the 'amx' sub directory (I did remember to create the dir first), but the stream created okay in the [PubDir]...weird really.

Good luck with it.
User avatar
remlap
 
Posts: 141
Joined: Thu Jun 09, 2005 5:23 pm
Location: Lincolnshire, England

Postby TechMedia » Tue Sep 11, 2007 4:46 pm

I´m monitoring this thread, Bob. :) It is very interesting.
TechMedia
 

Postby remlap » Wed Sep 12, 2007 2:06 am

:D Thanks Alberto. I'll forgive you if, when reading my post, you thought, 'what on earth is remlap talking about?

Robert, is this resolved yet, coz I'll grab some time later to have another go if it isn't? I was a bit strapped for time the other day, soz. Having used this plugin in my Remlap KnowledgeBase application, it is a really good and widely useful plugin...so just let me know?
User avatar
remlap
 
Posts: 141
Joined: Thu Jun 09, 2005 5:23 pm
Location: Lincolnshire, England

Postby rcohen » Wed Sep 12, 2007 8:42 am

Hi Robert,

Thanks for your offer of assistance. No I've not gotten this resolved, but I was also waiting for Alberto who was out of town til now...

If it's a directory issue, I'll simply create it in [pubdir] and then move it... BUt I was just very curious why something would work quite well in the demo, but (seemingly) not in my script... OTHER than the path issue and the fact that I'm using a variable in the function call... everything else is identical to the demo. ANd I don't t hink it's the variable issue since the demo uses this too, so I'd be inclined to agree that it's a path issue... yet the stream IS created... just not able to be successfully ACCESSED.

Cheers.... and thanks again for your assist...

r
User avatar
rcohen
 
Posts: 279
Joined: Sun Apr 03, 2005 7:29 pm
Location: The Smokey Mountains, Tn

Postby remlap » Thu Sep 13, 2007 12:05 am

No worries, anytime dude :)
User avatar
remlap
 
Posts: 141
Joined: Thu Jun 09, 2005 5:23 pm
Location: Lincolnshire, England


Return to PlugIn Discussions

Who is online

Users browsing this forum: No registered users and 2 guests

cron