file path with brackets in name - Forum

Forum Navigation
You need to log in to create posts and topics.

file path with brackets in name

Page 1 of 2Next

I'm using the IE cache to pull files out for archival purpose and some of the images have bracketed [1] at the end of their names which makes addressing them a bit hard.    I've tried:

SetObjectFileName "Picture1" "C:\Users\rcohen\AppData\Local\Microsoft\Windows\INetCache\IE\4QN2VTX3\25394751_10204209788682952_5614200345668874990_o[1].jpg"

AlertBox "test 1" "now?"

SetObjectFileName "Picture1" "!C:\Users\rcohen\AppData\Local\Microsoft\Windows\INetCache\IE\4QN2VTX3\25394751_10204209788682952_5614200345668874990_o[1].jpg"

AlertBox "test 2" "now?"

SetObjectFileName "Picture1" "C:\Users\rcohen\AppData\Local\Microsoft\Windows\INetCache\IE\4QN2VTX3\25394751_10204209788682952_5614200345668874990_o[#91]1[#93].jpg"

AlertBox "test 3" "now?"

SetObjectFileName "Picture1" "!C:\Users\rcohen\AppData\Local\Microsoft\Windows\INetCache\IE\4QN2VTX3\25394751_10204209788682952_5614200345668874990_o[#91]1[#93].jpg"

AlertBox "test 4" "now?"

And nothing is working.    I also tried putting all four of those formats into a SetVar and using THAT to load the pict object.   No go with that either.     I'm lost.    Anyone have any ideas ?

Thanks

Do you want to see the picture in a picture object?

Then try this: create a picture, to Properties -> to image file put a variable name (e.g. [Pic1])

then change the brackets with  strReplace command to [#91] and [#93] and use setvar action to change the picture file:

SetVar "[Pic1]" "!C:\Users\rcohen\AppData\Local\Microsoft\Windows\INetCache\IE\4QN2VTX3\25394751_10204209788682952_5614200345668874990_o[#91]1[#93].jpg"

 

That worked me.

 

Uploaded files:
  • You need to login to have access to uploads.

@rcohen I think you were doing right, but there is probably a bug in the SetObjectFileName command so it can't process brackets in file names. With your last attempt, using PopUp command instead works fine.
As @JnCon has avoided using SetObjectFileName his solution works perfectly.

Thanks!

Hi Luis,

Long time no hear ;-)     I've fallen off the planet for a while, but ... I'm back ;-)

Actually I've tried a few different methods and NONE of them work.  I tried to load this into a few plugins, including some from Alberto.    I tried to copy the file ... rename the file....    nuttin.      I figured if I could rename it, I could then load it into anything but I can't even do that.      Might you be able to show me the code you're using to successfully address this file?     What I'm trying to do actually is FIRST determine the pixel size (NN x NN) of the image and then decide what to do with it.    But regardless, if I can't address it, I'm not doing much with it LOL

Thanks Luis

rcohen

 

Quote from JnCon on August 24, 2019, 11:08 am

Do you want to see the picture in a picture object?

Then try this: create a picture, to Properties -> to image file put a variable name (e.g. [Pic1])

then change the brackets with  strReplace command to [#91] and [#93] and use setvar action to change the picture file:

SetVar "[Pic1]" "!C:\Users\rcohen\AppData\Local\Microsoft\Windows\INetCache\IE\4QN2VTX3\25394751_10204209788682952_5614200345668874990_o[#91]1[#93].jpg"

 

That worked me.

 

Actually yes, I'm trying to load it into a pict object so that I can get the size (pixels) of the image, but I can't get it to load.   I will try this again as you have it, but it didn't work for me the first time I tried it.    Will try it again, and thanks for testing.

 

 

It's  strange. You may have issue with file path.

Try to copy the file to desktop or your documents (pictures etc..) folder, and link to picture object as I did.

FileOpenBox "" "" "" "[Variable]" ""

In Image file

![Variable]

 

 

@rcohen a.k.a Robert

Since I am not actively using this platform, I have not installed VisualNEOWin on my PC; so I tried this on my old NeoBook v5.8.7 platform.

a) In my lab project, I had a Picture1 object associated with the file name of C:\Users\Gaev Keeka\Pictures\2015-12-29\005.jpg

b) I then setup a Button with this command ...

SetObjectFileName "Picture1" "!C:\Users\Gaev Keeka\Downloads\McKim[222].jpg"

When I clicked on the Button, everything worked as expected.

Perhaps the problems you are experiencing have to do with the fact that you are trying to access files in the INetCache\IE files folder (and not with the fact that files have square brackets within their names) ...

a) are you able to access files in these folders that do NOT have brackets in their names ?

b) are you able to access files in other (regular) folders that have brackets in their names ?

One work around might be to use Run (that invokes DOS commands) to first copy the files to a [Temp] folder, and then access them (with/without replacing the offending characters in the file names).

Hi Gaev,

Good to "see" you again.      And thanks for helping.      I tested other images in the same folder and they all load just fine as long as there are no brackets in the filename.   I have no control of this as a plugin is furnishing me the links to all the graphic files embedded in the page, and these load from the [TempDir], where the browser puts em.    This means also that I can't access the file at all, not to even rename it.    I am trying of course to eliminate using DOS but yes, that might be a requirement.    Not sure yet about brackets in other folders, but since the other files in TempDir load fine, I don't guess that's the problem.  But something I can check later need be.

I just got back to this project again since posting, so I'm gonna jump in and play with this using the suggestions you guys gave me.   I pretty much tried all of this too, but gonna go through it again in case I over looked something.      Thanks for the help.  Much appreciated.

Hi guys,

Wrangler and I have narrowed it down.   I had moved the path value from one variable to another and missed the exclamation mark in that statement.   That bit of code was prior to the code I pasted up...

I appreciate the validation and your time.

rcohen

 

@rcohen

I tested other images in the same folder and they all load just fine as long as there are no brackets in the filename.

OK, so we have narrowed it down to files with square brackets in their name.

I have no control of this as a plugin is furnishing me the links to all the graphic files embedded in the page

a) Can you post (exact copy/paste) the format of the data (i.e. links to all the graphic files) returned to you by this plugin ?

b) You might want to manually double check (using File Manager) that the plugin is not mangling names of files with brackets i.e. check hat such files with the exact same name do exist.

This means also that I can't access the file at all, not to even rename it.
I am trying of course to eliminate using DOS but yes, that might be a requirement.

Once we can see the data returned by the plugin, it should be possible to separate the bracketed names, and create a file for the Run command to "rename them" so they do not contain brackets.

You can compose a .bat file with one cd (change directory) command ... https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/cd ... and one ren (rename file) command ... https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/ren for each file to be renamed.

and these load from the [TempDir], where the browser puts em.

This does not jive with your first post where you said ...

SetObjectFileName "Picture1" "C:\Users\rcohen\AppData\Local\Microsoft\Windows\INetCache\IE\4QN2VTX3\25394751_10204209788682952_5614200345668874990_o[1].jpg"

... i.e. you are attempting to access the file from C:\Users\rcohen\AppData\Local\Microsoft\Windows\INetCache\IE not VisualNEOWin's [TempDir]

Not sure yet about brackets in other folders, but since the other files in TempDir load fine, I don't guess that's the problem. But something I can check later need be.

Just trying to eliminate the possibility that something different in our Windows Configurations is not preventing access to ALL bracketed files for you and not me.

Hi Gaev,

Still wresting it.    Explorer loads the image no problem with or without brackets.     The data it's working for is a txt file I create by dumping the data grabbed with Alberto's plugin, which is a list of all graphics being loaded on a Facebook Page.  As you know Facebook encrypts the living $%^&*  of their code, so grabbing "source code" isn't gonna help you much.   So instead I'm leaving it up to the interpreter in the plugin which I am sure is working through IE.   The prefix of each line is either LOC: or URL: which I strip out  but use FIRST to determine which ones are local (those are the ones I"m interested in) and in cache.    I read the temp file one line at a time, and I strip out the prefix XXX:

Here is a small sample of said file:

URL:https://scontent-iad3-1.xx.fbcdn.net/v/t1.0-1/p24x24/36860437_10214626254162211_3088573641831481344_n.jpg?_nc_cat=105&_nc_oc=AQl2NFNqvpO5WoYgMIKfww81O9CQCPtOu_FwD8jxPWzWAfXy6ZB2EupIfKpmxXCy3w4&_nc_ht=scontent-iad3-1.xx&oh=b219770f9725c1e46319be4529034648&oe=5E151795
LOC:C:\Users\rcohen\AppData\Local\Microsoft\Windows\INetCache\IE\KGYX9M7O\36860437_10214626254162211_3088573641831481344_n[1].jpg
URL:https://scontent-iad3-1.xx.fbcdn.net/v/t1.0-1/p50x50/64496921_2788062101210928_2203390395478441984_n.jpg?_nc_cat=104&_nc_oc=AQkIuhoaM-7NJw_yKAD9-Cm_xnJfKm7Wir0YBlmZl-DTiaWvWG1948U8C0EQRENgcok&_nc_ht=scontent-iad3-1.xx&oh=982045319dd813b05ff2159714f5f322&oe=5DC7FCD0
LOC:C:\Users\rcohen\AppData\Local\Microsoft\Windows\INetCache\IE\EDBROF4R\64496921_2788062101210928_2203390395478441984_n[1].jpg
URL:https://scontent-iad3-1.xx.fbcdn.net/v/t1.0-1/p50x50/52757249_2345635252133845_8451431946927472640_n.jpg?_nc_cat=110&_nc_oc=AQnQ3kza-fx-YoBNIcWqhIPXXVLyAwkg2hDWxom5Y-xNhtZ1cNTcWFvHB_iFu_X_Pi8&_nc_ht=scontent-iad3-1.xx&oh=bd3629f5a558d9bbf8b3c6749016f724&oe=5E0E2E86
LOC:C:\Users\rcohen\AppData\Local\Microsoft\Windows\INetCache\IE\Q071Y801\52757249_2345635252133845_8451431946927472640_n[1].jpg
URL:https://scontent-iad3-1.xx.fbcdn.net/v/t1.0-1/p50x50/68374136_2676471305719545_1012724533590753280_n.jpg?_nc_cat=104&_nc_oc=AQmdaRYeRQqoFGgtIS15V52j5K8LSd5TfATVuej8RttTn9pN1Cnnxa35rVSyx4ebcs0&_nc_ht=scontent-iad3-1.xx&oh=b10e7dbe0da259894a1f743f6de91d7a&oe=5DCDFED6
LOC:C:\Users\rcohen\AppData\Local\Microsoft\Windows\INetCache\IE\V7WLTYSX\68374136_2676471305719545_1012724533590753280_n[1].jpg
URL:https://scontent-iad3-1.xx.fbcdn.net/v/t1.0-1/c6.7.50.50a/p60x60/14358801_124127848044458_1143085470463829118_n.jpg?_nc_cat=105&_nc_oc=AQkQy0kva0fAnFI0wGVJb82sPfFvvzb4s9Col9MsDyT3-sJB9W5X_mM-LzWVqRyISGQ&_nc_ht=scontent-iad3-1.xx&oh=322d618080e3861c4a215ddabd67094f&oe=5DCF4724
LOC:C:\Users\rcohen\AppData\Local\Microsoft\Windows\INetCache\IE\4QN2VTX3\14358801_124127848044458_1143085470463829118_n[1].jpg
URL:https://scontent-iad3-1.xx.fbcdn.net/v/t1.0-1/p50x50/64455979_456059638552779_7338561914298957824_n.jpg?_nc_cat=105&_nc_oc=AQmZkzW9gJH4LiOAqgBUcLzR8Fo4_1nC8Vycq2TPvszRJb8JrFdPttNa943xKfTY4BU&_nc_ht=scontent-iad3-1.xx&oh=efa42cd260f937f779974682df94d330&oe=5E0E2D75
LOC:C:\Users\rcohen\AppData\Local\Microsoft\Windows\INetCache\IE\EV00G3ON\64455979_456059638552779_7338561914298957824_n[1].jpg
URL:https://scontent-iad3-1.xx.fbcdn.net/v/t1.0-1/p50x50/67715503_10212317863060188_1543084296644853760_n.jpg?_nc_cat=105&_nc_oc=AQmQ69fQ1umQsS1b_lowPmUcy5NtR_MBvxtfq1LVTO5k_ZJxhFSMr8OErkZdtskdtBE&_nc_ht=scontent-iad3-1.xx&oh=9495a10ad2f38622a73106ca717d30c1&oe=5E046704
LOC:C:\Users\rcohen\AppData\Local\Microsoft\Windows\INetCache\IE\EV00G3ON\67715503_10212317863060188_1543084296644853760_n[1].jpg

I am tracing the program with plenty of alertboxes and pict viewing tests and have determined that the NB IDE itself is interpreting the correct paths at least visually (showing brackets where they belong) but that internally, loading of objects, accessing of files, etc, there is some kind of interpreter problem, or should I say inconsistency.   As soon as I can find that point, I might be able to somehow compensate for it, but until I do I'm stuck.

Below is my testing stage ATM

As always, thanks for your time.

tmWEBGetImagesRefs "Rectangle1" "ILinks"

...  Returns list of Image URL's, one per line.

FileWrite "[TempDir]xyz.txt" "All" "[ILinks]"
Delay "1000"
.Run "NotePad.exe" "[TempDir]xyz.txt" "Normal" "" ""    .........  This passed

... Grab profile FB Profile name and remove the brackets from the notification value if any.   This locks down the foldername and eliminates duplicate folders.

SetVar "[FolderName]" "[Rectangle1.URLTitle]"
StrReplace "[FolderName]" "(1)" "" "[FolderName]" ""
StrReplace "[FolderName]" "[#91]1[#93]" "" "[FolderName]" ""
.......  Now ALL images retrieved for this run will land in the same folder.

...  If the folder isn't there, then create it.
FolderExists "[PubDir][FolderName]" "[FolderThere]"
                                If "[FolderThere]" "=" "False"
                                CreateFolder "[PubDir][FolderName]"
                                Endif

...   Now to retrieve all the paths that are local to cache

FileSize "[TempDir]xyz.txt" "[HowLong]"

         Loop "1" "[HowLong]" "[HLx]"

         FileRead "[TempDir]xyz.txt" "[HLx]" "[ThisLineHere]"
         
                  SearchStr "OC:" "[ThisLineHere]" "[LocThere]" ""

                   If "[LocThere]" ">" "0"
                   ........................ This is a local file.
                   AlertBox "The First AlertBox" "[ThisLineHere]"
                   ......  This line shows the brackets just

                   

                   .....  Let's get rid of the prefix     I have the exclamation on the left variable but have tested both.   I've moved the ! around a LOT in my testing.
                   StrReplace "![ThisLineHere]" "LOC:" "" "[ThisLineHere]" ""
                   .....................................................................................................
                   AlertBox "The SECOND AlertBox" "This is about to be loaded into the pix object|[ThisLineHere]"
                   SetVar "[Clipboard]" "[ThisLineHere]"
                   SetObjectFileName "Picture1" "[ThisLineHere]"
                   .....................................................................................................
                   AlertBox "does the pix ojbect" "does the pixobject have a pix?"
                   ..  so far this has never worked to this point.
                   
                   
                   Endif
                   
                   
  Exit "Done?" "Done testing?"

         EndLoop

         Run "explorer.exe" "[PubDir][FolderName]" "Normal" "" ""                   

                   .

-

 

@rcohen

Apologies for the delay but I thought (from your previous post) that the issue was resolved (we appeared to post at the same time).

A number of your comments don't jive with the code you posted; so let us take it one step at a time ...

1) I am assuming that the small sample (14 lines) is what is being returned by ...

tmWEBGetImagesRefs "Rectangle1" "ILinks"

... and then saved to [TempDir]xyz.txt by ...

FileWrite "[TempDir]xyz.txt" "All" "[ILinks]"

... and when you view its contents with notepad.exe, you see EACH ENTRY ON A NEW LINE (without any special characters showing up).

I want to make sure that this is a correct assumption; please confirm.

2) I am confused about what you are doing with lines 9 to 21 of your posted code; please clarify with an example of data before and after code execution

3) Line 24 ...

FileSize "[TempDir]xyz.txt" "[HowLong]"

... appears to be the incorrect command to use, because this command will return the size of the .txt file (in bytes); I think you want the number of lines in the file, which you obtain with the FileLen command (but only if the lines written to xyz.txt each have CarriageReturn+LineFeed ([#13][#10]) separator characters between the entries).

4) On Line 30 ...

SearchStr "OC:" "[ThisLineHere]" "[LocThere]" ""

... why are you looking for "OC:" and not "LOC:" ?

If my assumptions are correct, you could just ...

1) StrParse the data returned in [ILinks]
2) Loop through the items in the resulting array variable

For each iteration of the loop ...
a) ignore those that do not start with LOC:C:\Users\rcohen\AppData\Local\Microsoft\Windows\INetCache\IE\

b) StrReplace "LOC:" with ""

c) do an AlertBox on the resulting entry text ... and verify (using Windows File Manager) that this file exists ... and if it does, double click on the entry (in File Manager) to confirm that your computer displays this file (using the defined file handler for .jpg files)

Post your experience here.

Sorry, yes, I thought I had slayed the dragon also.... til I tried to use it in my script. ;-0

Lines 9 - 21 are reading the name of the person who's profile page this belongs.... take from the "title" of the html.    The processing therein is FaceBook specific and shouldn't be an issue with the rest.   I create a folder based on this name in the pubdir for the data (photos) belonging to said party.

Yes, each one is on it's own line, no wrap and no special chars.

Filesize:  Yes, indeed a typo.   I have changed that to FileLen as it should be, thank you for catching that.

I have this script going elsewhere too (with FileLen where it should be LOL) and it's working perfectly.   So I have to assume that it's correctly looping.    Haven't had any error messages, anyway ;-)

With the debugging you suggest, I have done just that but without the array ...   and the file paths that do NOT include the brackets load fine IN Neo.    The bracketed text loads fine in Win Explorer AND in my browser.   The ONLY problem with the bracketed named files is within Neo itself.

 

And BTW, the alertbox reports a perfectly formatted PATH but yet the commands that use this PATH" will NOT return the file.

 

@rcohen

And BTW, the alertbox reports a perfectly formatted PATH but yet the commands that use this PATH" will NOT return the file.

Try this (stand alone) script on your machine ...

SetVar "[ThisFile]" "!C:\Users\rcohen\AppData\Local\Microsoft\Windows\INetCache\IE\KGYX9M7O\36860437_10214626254162211_3088573641831481344_n[1].jpg"
SetObjectFileName "Picture1" "[ThisFile]"

1) if it works, it means that the content loaded into [ThisLineHere] in your posted script has some "unprintable" (undisplayable) characters (that you can not see in the AlertBox display).

2) if it does not ...

a) using FileManager, rename this file, changing _n[1] to _n123456789
b) try the same script using this changed file name

3) if it still does not work, there is something in your Windows (Access Control or version number) preventing your pub from accessing this file in this special folder

 

Post your results here.

P.S. I can not try this script on my machine because there is no such folder/path on it (probably because there is no IE on it !)

 

I will try that shortly...   already did a similar test but no problem testing again.     There is no problem accessing other (non bracketed) filenames in that folder from NB.    Already tested.   I'll report back after I test this.   Thanks Gaev.  Another test I think I"m gonna do is see if I get the same error with a file named this way from PubDir directly.    This would surely narrow it down ;)

 

 

This is enlightening.

I tried it with your script and it didn't work.   THEN I tried

SetVar "[ThisFile]" "[PubDir]WMP31b8b175-c550-4213-92a5-0d00a11b07e8[1].jpg"
SetObjectFileName "Picture1" "[ThisFile]"
AlertBox "test" "[ThisFile]"

Put ANY file in your pubdir with a bracked entry and you will see.    The brackets and number are not even in the alertbox and so it won't find the file.

THEN, when you try:

SetVar "[ThisFile]" "[PubDir]WMP31b8b175-c550-4213-92a5-0d00a11b07e8[#91]1[#93].jpg"
SetObjectFileName "Picture1" "[ThisFile]"
AlertBox "test" "[ThisFile]"

The alertbox APPEARS fine, but the file doesn't respond.   I think there is indeed something we can't see as part of this output but .... beats me... and the shell as well.

?

@rcohen

SetVar "[ThisFile]" "!C:\Users\rcohen\AppData\Local\Microsoft\Windows\INetCache\IE\KGYX9M7O\36860437_10214626254162211_3088573641831481344_n[1].jpg"
SetObjectFileName "Picture1" "[ThisFile]"

I tried it with your script and it didn't work.

Since, as reported in my first posted response, that this works for me ...

SetObjectFileName "Picture1" "!C:\Users\Gaev Keeka\Downloads\McKim[222].jpg"

... one can conclude that the problem is limited to bracketed files in this particular folder of yours (sorry I can not create that path/folder on my machine).

SetVar "[ThisFile]" "[PubDir]WMP31b8b175-c550-4213-92a5-0d00a11b07e8[1].jpg"
SetObjectFileName "Picture1" "[ThisFile]"
AlertBox "test" "[ThisFile]"

The brackets and number are not even in the alertbox and so it won't find the file.

That is not surprising ... without the ! mark, VisualNEOWin will try and treat the [1] as a variable ... and since it does not exist, it replaces it with nothing (null) ... I tried this ...

SetVar "[1]" "[#91]1[#93]"
AlertBox "Answer" "[1]"

... and AlertBox showed [1] ... so you might consider setting up variables [1], [2] etc. as needed ... then, by omitting the ! mark, variables [PubDir] and [1] will be replaced by their current values.

If the AlertBox displays as expected, but the Picture object does not render the file, try the work around suggested by @jncon in an earlier post i.e. specify variable [ThisFile] for the Image File property of Picture1 (that way you do not need the SetObjectFilename command)..

Let us know how it responds.

Page 1 of 2Next