[jawsscripts] An ini value retrieval problem

  • From: Jitendra <jeet.invincible@xxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Sat, 22 Aug 2009 00:06:20 +0530

Hello friends, I have an ini values problem, where I am unable to get 
the value from the external file, the file holds the current values for 
the program and is located in the program's installation folder. see the 
code, it may however is a bit longer, but do help me please.
Thank you, Jitendra.
;code start.
Include "HjGlobal.jsh" ; default HJ global variables
Include "hjconst.jsh" ; default HJ constants
Include "common.jsm" ; message file
Include "1by1.jsm" ;Message file for 1by1
;special thanks for doug lee for creating and providing the following 
modules for free.
include "olchar.jsl"   ; Character to/from ANSI value converter, 
required by xlist.jsl
include "olstring.jsl"   ; String manipulation utilities
include "olutil.jsl"   ; Miscellaneous utility functions
Void Function AutostartEvent ()
SayString (Autostart_L)
EndFunction

int Function IsEquOn ()
Var
String sPath,
String Sname,
Object fso,
Object File
Let Spath = GetAppFilePath ()
Let Sname = GetAppFileName ()
Let Spath = stringChopRight (Spath, 9)
Let Spath = shortenFolderPath (FSO, Spath)
Let Sname = stringChopRight (Sname, 3)+"ini"
Let Spath = Spath+"\\"+Sname
If IniReadInteger ("1by1", "eq_enable", 1, Spath) == 1 then
Return true
Else
Return False
EndIf
EndFunction

Script ToggleEq ()
if IsEquOn () then
TypeCurrentScriptKey ()
SayString ("off")
Else
TypeCurrentScriptKey ()
SayString ("on")
EndIf
EndScript

string Function shortenFolderPath (object ByRef fso, string fname)
; Convert long folder paths (names containing components not adhering to 
the old DOS 8.3 format) to short

(8.3-compatible) paths.
; Used by CompileSkypeScripts below to avoid numerous problems with 
passing space-containing file

paths through batch files.
var
    object oFolder
if !fso then
let fso = olGetFSObject()
    if !fso then
        ; Can't shorten, so return what we got.
        return fname
    endIf
endIf
let oFolder = fso.getFolder(fname)
if !oFolder then
    return fname
endIf
return oFolder.shortPath
EndFunction
;code end.
__________ 
Visit and contribute to The JAWS Script Repository http://jawsscripts.com

View the list's information and change your settings at 
http://www.freelists.org/list/jawsscripts

Other related posts: