Jump to content











Photo
- - - - -

Possible LiveXP api.script modification?


  • Please log in to reply
8 replies to this topic

#1 Galapo

Galapo

    Platinum Member

  • .script developer
  • 3841 posts
  •  
    Australia

Posted 21 August 2007 - 10:17 PM

For my own use, I've made the following modification to the api script of LiveXP from
Set,"%My_Shortcut_FOLDER%",#$pProgramFiles#$p\%programFolder%

Set,"%My_Shortcut_EXE%","%My_Shortcut_FOLDER%\%programExe%"
to
If,%ProgramFolder%,Equal,"#$pSystemRoot#$p\system32",Set,"%My_Shortcut_FOLDER%","#$pSystemRoot#$p\system32"

If,%ProgramFolder%,NotEqual,"#$pSystemRoot#$p\system32",Set,"%My_Shortcut_FOLDER%","#$pProgramFiles#$p\%programFolder%"

Set,"%My_Shortcut_EXE%","%My_Shortcut_FOLDER%\%programExe%"

This way, say, the Regedit script can be changed from this
[Process]

If,%pCheckBox1%,Equal,True,Run,%BuildModelScript%,Add-Shortcut,"DE","#$pSystemRoot#$p\system32\regedit.exe","Registry Editor"
to this
[variables]

%ProgramTitle%=Registry Editor

%ProgramEXE%=regedit.exe

%ProgramFolder%=#$pSystemRoot#$p\system32

...

[Process]

If,%pCheckBox1%,Equal,True,Add_Shortcut,Desktop

This way the api can be used for programs located in the system folder.

My suggestion is that some modification of this sort be made so that app scripts can be written even if their location does not default to the usual program files location.

Regards,
Galapo.

#2 h7se

h7se

    Frequent Member

  • Developer
  • 264 posts
  •  
    Palestine

Posted 21 August 2007 - 11:29 PM

Great :loleverybody:

#3 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 22 August 2007 - 11:35 AM

:loleverybody:

Peter

Edited by smiley, 22 August 2007 - 11:57 AM.
No need to quote whole post


#4 smiley

smiley

    Silver Member

  • .script developer
  • 905 posts
  •  
    Greece

Posted 22 August 2007 - 11:58 AM

Good suggestion :loleverybody:

#5 pedrole15

pedrole15

    Silver Member

  • .script developer
  • 731 posts
  •  
    France

Posted 22 August 2007 - 08:51 PM

:loleverybody: Good
You can also make like this
StrFormat,path,%ProgramFolder%,%My_ProgFolder%

If,%My_ProgFolder%,Equal,,Set,%My_Shortcut_FOLDER%,#$pProgramFiles#$p\%ProgramFolder%

If,%My_ProgFolder%,NotEqual,,Set,%My_Shortcut_FOLDER%,%ProgramFolder%
So if there is a slash (\) in %ProgramFolder% assume that it is a full path

#6 Galapo

Galapo

    Platinum Member

  • .script developer
  • 3841 posts
  •  
    Australia

Posted 22 August 2007 - 09:50 PM

So if there is a slash (\) in %ProgramFolder% assume that it is a full path

Yes, I like that! So that makes it better: we aren't locked into
either %programfiles% nor the system folder.

#7 Galapo

Galapo

    Platinum Member

  • .script developer
  • 3841 posts
  •  
    Australia

Posted 23 August 2007 - 09:41 AM

:loleverybody: Good
You can also make like this

StrFormat,path,%ProgramFolder%,%My_ProgFolder%

If,%My_ProgFolder%,Equal,,Set,%My_Shortcut_FOLDER%,#$pProgramFiles#$p\%ProgramFolder%

If,%My_ProgFolder%,NotEqual,,Set,%My_Shortcut_FOLDER%,%ProgramFolder%
So if there is a slash (\) in %ProgramFolder% assume that it is a full path

This does change things for applications located in %ProgramFolder% but have a \ in the path, eg my AutoIt script:
[variables]

%ProgramTitle%=AutoIt

%ProgramEXE%=AutoIt3.exe

%ProgramFolder%=AutoIt

...

[process]

...

set,%ProgramTitle%,"Run AutoIt Script"

If,%pCheckBox1%,Equal,True,Add_Shortcut,StartMenu,%pTextBox1%

set,%ProgramTitle%,"Compile Script to .exe"

set,%ProgramEXE%,"Aut2Exe.exe"

set,%ProgramFolder%,"\AutoIt\Aut2Exe"

If,%pCheckBox1%,Equal,True,Add_Shortcut,StartMenu,%pTextBox1%

The second last line would have to be changed to
set,%ProgramFolder%,"#$pProgramFiles#$p\AutoIt\Aut2Exe"
That's fine. But it this is to become the standard, could we decide on that now so not too many scripts -- well, those with slashes in their path -- have to be modified.

Thanks,
Galapo.

#8 pedrole15

pedrole15

    Silver Member

  • .script developer
  • 731 posts
  •  
    France

Posted 23 August 2007 - 03:37 PM

That's fine. But it this is to become the standard, could we decide on that now so not too many scripts

Hi,Galapo
I agree with you
People are starting to use the Api in VistaPE too
So if we want a universal Api, it's urgent to decide something.
But I am like you simply giving some suggestion
Only Nuno can approuve the Api,so i am waiting he come back from holliday

I think we must have a standard api like it is now, very short,simply,not a lot of option and very quick
and an other more complex, but still use the same command with full option
(Setting Parameters,StartMode,can change the ProgramFolder etc...)

For active the second api simply add a command like "Api_Mode,Full"
By this way we can initialise some variable (with AddVariables) which can be use in api command rather using a "Set" command
for same thing in different api command which slow down the speed.

Why setting association is so long ?
Because use too much the "Set" command
I have suppress all "Set" command and it is extremly fast! (Not finish)

PS: Please Galapo, post in App Scripts Topic

@Jaclaz can you move all this topic in App Scripts topic
Thanks

#9 Galapo

Galapo

    Platinum Member

  • .script developer
  • 3841 posts
  •  
    Australia

Posted 24 August 2007 - 12:58 AM

Gday pedrole15

I'm with you: api related stuff needs to be kept simple and targeted towards the usual/normal. So having a program located outside of the programs directory or having an application in a folder more than one deep is not the usual/normal situation. Hence your suggestion of
StrFormat,path,%ProgramFolder%,%My_ProgFolder%

If,%My_ProgFolder%,Equal,,Set,%My_Shortcut_FOLDER%,#$pProgramFiles#$p\%ProgramFolder%

If,%My_ProgFolder%,NotEqual,,Set,%My_Shortcut_FOLDER%,%ProgramFolder%
is simple and allows for easy usual/normal scripting, but also allows for some extention if needed -- specifying the full path.

I think this is indeed the best (in the absence of a StrInStr command to seek #$pSystemRoot#$p or #$pSystemdrive#$p etc) way forward. I have modified LiveXP's api to suit this and I think I'll move my scripts to this.

Thanks,
Galapo.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users