Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

At 16 SEP 2002 07:13:54AM Tim Wilson wrote:

In OI 3.7.5 the Utility() function modes MAKEDIR/REMOVEDIR/RENAMEDIR do not work when folder names do not conform to 8.3 format. Are there equivalent routines available for long foldernames, or workarounds?

Tim Wilson

David Edkins Associates Limited


At 16 SEP 2002 09:11AM Donald Bakke wrote:

Hi Tim,

With OI16 we quickly bought and successfully used Sprezz's Utility32 product for this type of thing. However, in 3.7.5 Revelation also included support for longfilenames via VBScript. We never attempted to tap into this feature so I can't say for certain whether directory management was a part of it…but I have to believe it was.

[email protected]

SRP Computer Solutions, Inc.


At 16 SEP 2002 10:33AM [email protected] wrote:

As Don mentioned, Sprezzatura has a good work around for this (though going to 4.x is a much better idea).

Sprezzatura uses way to much javascript (boo hiss :-) in their pages so I couldn't link directly to the page but HERE is their main page

[email protected] onmouseover=window.status=the new revelation technology .. a refreshing change;return(true)"

David Tod Sigafoos ~ SigSolutions

Phone: 971-570-2005

OS: Win2k sp2 (5.00.2195)

OI: 4.1


At 16 SEP 2002 10:38AM Sean FitzSimons wrote:

Tim,

There is the UTILITY_FILEDLG form and stored procedure in 3.7.5 that can be used to accomplish long filename manipulation.

Sean


At 17 SEP 2002 09:07AM Bob Carten wrote:

In OI375 (and 4.x) there is a funcion called UTILITY_GETFOLDER.

It's job is to get the 8.3 name for a long named folder

You can edit that to turn it into a function that creates a folder.

I edited the source below, did not test.

Note that revcomi.dll is principally a wrapper around the vbscript OLE control. One can create and run just about ANY vb or javascript via the OI 3.75 stuff, including automating Excel and Word. Unlike OI4.1, though, you cannot respond well to events.

Function Utility_CreateFolder(NewFolder, handle)

/* ————————————————————————–

This  program  is  proprietary and is not  to be used  by or  disclosed to others, nor is it to be copied
without written permission from Revelation Technologies, Inc.

VERSION : OI 3.7.4

PURPOSE : This is a stored procedure used for Getting a folder name and path,

            		even when they exceed the 8.3 format

AUTHOR : Bob Carten

CREATED : March, 2001

PROCEDURES : This module may be called either as a stored procedure

            or as an internal subroutine.

WARNINGS :

THEORY OF OPERATION :

		call 32-bit Shell Explorer Function via vbscript
		DefaultFolder=Optional Folder to start in
		Caption      =Optional Caption for the folder dialog
		returns Logonfoldername:@fm:ShortFoldername on success
		returns Err.Number : @fm: Err.Description on failure

REVISION HISTORY (Most CURRENT first) :

  DATE       IMPLEMENTOR     FUNCTION
  1. ——- ———– ——–
MM-DD-YY     initials        Modification
10-01-01       rjc               0i 3.75  Modify to show example of sending script directly to commuication object

—————————————————————————*/

$Insert MSG_Equates

declare function Msg, Utility, IsEventContext, Utility_RunScript, Get_Property

ans='

if assigned(NewFolder) else NewFolder='

IF Len( NewFolder ) else return if assigned(handle) else handle=' if len(handle) else handle=Get_Property('OI_COMDLG','HANDLE') end equ CRLF$ to \0D0A\ args=handle script=' script:= 'function main(argstring)' script:=crlf$: 'dim params' script:=crlf$: 'dim oFolder' script:=crlf$: 'dim oFs' script:=crlf$: 'dim strShortFolder' script:=crlf$: 'dim strLongFolder' script:=crlf$: 'dim strAns' script:=crlf$: 'params=split(argstring,chr(253))' script:=crlf$: 'set oFs=CreateObject("Scripting.FileSystemObject")' script:=crlf$: 'strLongFolder= : quote(NewFolder) script:=crlf$: 'ofs.CreateFolder(strLongFolder)' script:=crlf$: 'set oFolder=ofs.GetFolder(strLongFolder)' script:=crlf$: 'strShortFolder=oFolder.ShortPath' script:=crlf$: 'if err.Number 0 then' script:=crlf$: ' strAns=Err.Number & chr(254) & Err.Description' script:=crlf$: 'else' script:=crlf$: ' strAns=cstr(strLongFolder) & chr(254) & cstr(strShortFolder)' script:=crlf$: 'end if' script:=crlf$ script:=crlf$: 'set ofolder=Nothing' script:=crlf$: 'set ofs=Nothing' script:=crlf$: 'main= strAns' script:=crlf$: 'end function' method=RUNSCRIPT' language=vbScript' is_modal=0 job=main' ans=Utility_RunScript(script,args,method,language,is_modal,job) if num(ans) then err=error " : ans: " " : ans if IsEventContext() then def=' def=Error in Utility_GetFolder" def=err def=!" x=Msg(@window,def) end else call Send_Dyn(err) end ans=

end

Return ans


At 18 SEP 2002 10:46AM Tim Wilson wrote:

Thank you gentlemen for your suggestions. Thanks in particular to Bob whose example source code I have now utilised (see below). I have gone on to create two further script based routines for deleting and clearing directories. All working fine and quite straightforward too despite never having programmed VB before (MS Word's VB help came in handy)!

function mt_utility_makedir ( foldername, msgflag )

/*

Description

Utility to create directories/folders using either long or short foldernames.
Returns 
   if successful
         long foldername
         short foldername
   otherwise
      null

Notes

History

Ver    Date      Init  Details
1.0  17/09/2002  TW    New program

*/

$insert logical

declare function guar_assign

*declare function set_status

declare function utility_runscript

declare subroutine msg_io

equ crlf$ to \0D0A\

answer="

foldername=guar_assign(foldername)

if (len(guar_assign(msgflag)) eq 0) then

msgflag=false$

end

if len(foldername) then

gosub script
args    =quote(foldername)
method  =RUNSCRIPT'
language=vbScript'
is_modal=false$
job=main'
ans_rec=utility_runscript(script, args, method, language, is_modal, job)
begin case
	case num(ans_rec)
		err=ans_rec  : " " : ans_rec 
		gosub error
	case true$
		answer=ans_rec
end case

end else

if msgflag then
	msg_io("", "MT465", "!", "", "folder name" : @fm : "Create folder")
end
err=Missing foldername'
gosub error

end

return answer

error:

*retval=set_status(1, err)

return

script:

script ="

script := 'function main(argstring)'

script := crlf$ : 'dim ofs'

script := crlf$ : 'dim oFolder'

script := crlf$ : 'dim strFolderName'

script := crlf$ : 'dim strAns'

script := crlf$ : 'dim params'

script := crlf$ : 'dim iArgCount'

script := crlf$ : 'dim strShortPath'

* Check passed parameters

script := crlf$ : 'strAns="'

script := crlf$ : 'Err.Clear'

script := crlf$ : 'params=split(argstring,chr(253))'

script := crlf$ : 'iArgCount=Ubound(params)'

script := crlf$ : 'set oFs=CreateObject("Scripting.FileSystemObject")'

script := crlf$ : 'if Err.Number=0 then'

script := crlf$ : ' if ArgCount ]= 0 then'

script := crlf$ : ' strFolderName=params(0)'

script := crlf$ : ' strFolderName=Replace(strFolderName,Chr(34),"",1,999)'

script := crlf$ : ' else'

script := crlf$ : ' strFolderName="'

script := crlf$ : ' end if'

script := crlf$ : 'end if'

* Display error message if foldername not passed

script := crlf$ : 'if strFolderName=" then'

script := crlf$ : ' Err.Raise 50010,"MT_UTILITY_MAKEDIR","Missing foldername"'

script := crlf$ : 'end if'

* Create new folder, get path

script := crlf$ : 'if Err.Number=0 Then'

script := crlf$ : ' if ofs.FolderExists(strFolderName) then'

script := crlf$ : ' set oFolder=ofs.GetFolder(strFolderName)'

script := crlf$ : ' else'

script := crlf$ : ' set oFolder=ofs.CreateFolder(strFolderName)'

script := crlf$ : ' end if'

script := crlf$ : ' strShortPath=oFolder.ShortPath'

script := crlf$ : 'end if'

* Create return value

script := crlf$ : 'if Err.Number=0 then'

script := crlf$ : ' strAns=strFolderName & chr(254) & strShortPath'

script := crlf$ : 'else'

script := crlf$ : ' strAns=trim(Err.Number & chr(254) & Err.Description)'

script := crlf$ : 'end if'

* Clean up

script := crlf$ : 'set oFolder=Nothing'

script := crlf$ : 'set ofs=Nothing'

script := crlf$ : script := crlf$ : 'main=strAns' script := crlf$ :

script := crlf$ : 'end function'

return


At 18 SEP 2002 10:39PM Bob Carten wrote:

Tim

Glad it helped.

 Bob

View this thread on the Works forum...

  • third_party_content/community/commentary/forums_works/eef5c5f2a4086a8185256c36003db2b4.txt
  • Last modified: 2023/12/30 11:57
  • by 127.0.0.1