specialFolderPath("Documents")

Sivakatirswami katir at hindu.org
Sun Dec 14 21:38:36 EST 2008


Our Hinduism Today Digital Edition/PDF manager uses

specialFolderPath("Documents")

this is resolving to the same folder as SF#28 

also currently known as

 CSIDL_PERSONAL = 0x0005
    File system directory that serves as a common repository for 
documents. A typical path is C:\Documents and Settings\username\My 
Documents. This is different from the My Documents virtual folder in the 
name space. To access that virtual folder, use the technique described 
in Managing the File System.
 
as distinct from:

 CSIDL_MYDOCUMENTS
    Virtual folder that contains the objects in the user's My Documents 
folder.

The app Andre built is able to write files to

C:\Documents and Settings\username\My Documents\Hinduism Today Digital 
Edition\some*.pdf

but the following handler will not boot the PDF as expected, on this 
man's machine
(see below)

Now.. FYI: when people upgraded to Vista, we held  our breath and nearly 
burst until we got the good news that the following code was working 
just fine on Vista! Hurray.. that could have been a major downer..

So, I'm loath to mess with this too much in case we break it, just to 
solve one user's problem... but maybe some can spot the reason why the 
boot the pdf into acrobat will not work. when he navigates  to the files 
in the file system and double clicks on the PDF's they boot in to 
Acrobat just fine.. so the doc/app binding is apparently OK in the registry.

Any insights?


--------------


on bootAcrobat pLinkText
    get getFileForURL(pLinkText)
    launchdocument it
    log "VP", it
end bootAcrobat

on launchdocument pWhich
    breakpoint
    --handler that launch the PDFs. By Dan Shafer. Modified by AAG.
    if there is not a file pWhich then
        -- no file, load magazine..
        set the itemdel to "/"
        get item -1 of pWhich
        set the itemdel to "_"
        get item 2 of it
        set the itemdel to "-"
        put item 1 of it into tYear
        put item 2 of it into tMonth
        put tMonth & "-" & (tMonth + 2) into tMonth
        if char 1 of tMonth is "0" then delete char 1 of tMonth
        put format("/issues/year_%s/issue_%s", tYear, tMonth) into tTemp
        loadEdition tTemp
        exit launchdocument
    end if
      if there is not a file pWhich then exit launchdocument
      revSetWindowsShellCommand
      if word 1 of the systemversion is "NT" then put "true" into tNT 
else put "false" into tNT
    switch the platform
        case "Win32"
            put shortfilepath(pWhich) into pWhich -- AAG: Don't we all 
hate windows!? (long folder name bug)
            put "start" && pWhich into openCmd
            put shell (openCmd) into shellResult
            if (shellResult is not empty) or (the result is not empty)  then
                log "EP", the result && shellResult
                answer error "You appear not to have Adobe Acrobat 
Reader installed. Go to www.adobe.com and download this free program, 
then try loading this SmartEBook(tm) again!" with "OK"
                exit launchDocument
            end if
            
            break
        case "MacOS"
            set the itemdelimiter to "."
            if item 1 of the systemVersion>= 10 then
                replace " " with "\ " in pWhich
                put "open" && pWhich into shellCmd
                get shell (shellCmd)
            else -- It's OS 9
                if "appleScript" is not in the alternatelanguages then
                    log "EP", "no applescript support"
                    answer error "You must have AppleScript installed to 
use this file with Mac Classic. Contact Shafer Media for further 
assistance."
                    exit launchdocument
                else
                    put "tell application" && quote & "Finder" & quote & 
return into asCmd
                    put "activate" & return after asCmd
                    put "set myPath to container of (path to me)" & 
return after asCmd
                    put "open file" && quote & pWhich& quote &&  "in 
myPath" & return after asCmd
                    put "end Tell" & return after asCmd
                    --answer asCmd
                    do asCmd as appleScript
                    if the result is not empty then
                        log "EP", the result
                        answer error "An error of unknown origin has 
occurred. Contact Shafer Media for further assistance."
                        exit launchdocument
                    end if
                end if
            end if
            break
    end SWITCH
end launchdocument

on revSetWindowsShellCommand
  if the platform is not "Win32" then exit revSetWindowsShellCommand
  set the hideconsolewindows to true
  if $COMSPEC is not empty then set the shellcommand to $COMSPEC
  else
    --just in case some windows versions don't use $COMSPEC
    if revRunningWindowsNT() then set the shellcommand to "cmd.exe"
    else set the shellcommand to "command.com"
  end if
end revSetWindowsShellCommand

function getFileForURL pURL
    -- abstract function that will return the local cache file reference 
of a given URL.
    if the platform is "MacOS" then
        return macgetFileForURL(pURL)
    else if the platform is "Win32" then
        return Win32getFileForURL(pURL)
    end if
end getFileForURL

function macgetFileForURL pURL
    -- function that receives an URL and returns the local cache file 
for that URL, platform specific.
    put "~" & specialfolderpath("asup") into tFolder -- Application 
Support Folder inside Users Home.
    set the itemdel to "/"
    put tFolder & "/Hinduism Today Digital Edition/" & item 5 to -1 of 
pURL into tAbsoluteFileLocation -- Absolute folder location.
    return tAbsoluteFileLocation
end macgetFileForURL

function Win32getFileForURL pURL
    -- function that receives an URL and returns the local cache file 
for that URL, platform specific.
    put specialfolderpath("Documents") into tFolder -- Documents folder 
for windows users.
    set the itemdel to "/"
    put tFolder & "/Hinduism Today Digital Edition/" & item 5 to -1 of 
pURL into tAbsoluteFileLocation -- Absolute folder location.
    return tAbsoluteFileLocation
end Win32getFileForURL



-------- Original Message --------
Subject: 	RE: Broken links in latest edition
Date: 	Sun, 14 Dec 2008 19:21:54 -0600
From: 	Paul Harouff <pharouff at gmail.com>
To: 	'Sivakatirswami' <katir at hindu.org>
References: 	<20081213195536.843B18807D at sat.gurudeva.org> 
<494449AA.9010408 at hindu.org>



Try changing the registry to make your personal folder "D:\My Documents\"
instead of "C:\Documents and Settings\username\My Documents\"

I don't know why this would break opening the files but not break
downloading the files.

Paul

-----Original Message-----
From: Sivakatirswami [mailto:katir at hindu.org] 
Sent: Saturday, December 13, 2008 5:48 PM
To: pharouff at gmail.com; Andre Garzia
Subject: Re: Broken links in latest edition

pharouff at gmail.com wrote:
> First Name: Paul
> Last Name: Harouff
> Month of Birth: February
>
> I downloaded the Jan 09 edition today and the links to the pdf files are
broken.
>
> Your program downloads the pdf files to "\My Documents\Hinduism Today
Digital Edition\2009\1-3\pdf\" but the links from the program are truncating
the path to "\My Documents\Hinduism".
>   

Namaskar Paul:

We have tested on several Mac machines here and also we are getting 
incoming "kudos" from Windows/PC users who are saying that they love the 
latest issue. This would indicate that the problem is specific to your 
machine or system, since other PC users running NT 5.1 are not having 
the same problem.

How we might solve that I don't know.  I have queried our main developer 
for this software, but I'm not sure how we could solve this without 
directly being able to monitor your PC in action. We do have diagnostic 
tools, that only send us a report with no personal information. But 
typically users, especially PC users. are very averse to letting a 3rd 
party run diagnostics on their system. This paranoia is a bit 
unwarranted because in the PC world, all kinds of programs are sending 
info back to "the mother ship," but if someone like us actually requests 
permission, then they get concerned...

At any rate,  I will leave this up to you. We would like very much to 
trouble shoot this and find out exactly what is happening, but if you 
prefer to leave it as is and just access the PDF's directly, that's 
fine. At least our program is doing the main job: downloading the PDF's 
and keeping them in a "rational" library... for you..

Om shanti
Sivakatirswami
www.hinduismtoday.com

> I can go directly to the download folder and open the pdfs without the
program.
> Date: 12/13/08
>
> Home: 
> Platform: Win32
> Machine: x86
> System: NT 5.1
> Environment: standalone application
> Version: 2.8.1
> Screen Bit Depth: 32
> Colors: 4294967296
> Screen Rect: 0,0,1280,800
> Quicktime: 7.1.0
>
>
>   





More information about the use-livecode mailing list