Yea it is a mess. I can not get the $Var to work.
MsgBox works
The MsgBox shows all the $Var but ShellExecute shows no Varaiable available
How do we set paths with Variables?
Spoiler anzeigen
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#Include <String.au3>
#include <File.au3>
AutoItSetOption("ExpandEnvStrings",1)
FileChangeDir(@ScriptDir)
_cmd1()
Func _cmd1()
$Var2 = IniRead("C:\0TIH\settings.ini", "gameexes", "game1", "There is a problem with the .ini file")
MsgBox(4096, "Result", $var2)
$Var3 = IniRead("C:\0TIH\settings.ini", "params", "root", "There is a problem with the .ini file")
MsgBox(4096, "Result", $var3)
Local $Var1 = IniRead("C:\0TIH\settings.ini", "WorkDir", "Path1", "There is a problem with the .ini file")
MsgBox(4096, "Result", $var1)
Global $TestPath = _PathMake("c:", "\0TIH\TIH1", "TIH1", "exe")
MsgBox(0, "demo _PathMake", $TestPath)
MsgBox(4096, "Result", $var3&$Var1&$var2)
FileChangeDir ( "$var1" )
FileChangeDir ( "$path1" )
MsgBox(4096, "Result", "$path1")
ShellExecuteWait ( " $TestPath" )
ShellExecuteWait ( " $var3&$Var1&$var2" )
EndFunc ;==> _cmd1
Settings.ini
Spoiler anzeigen
[WorkDir]
C:\0TIH
C:\0TIH\1a\
C:\0TIH\2a\
C:\0TIH\3a\
[command]
[params]
C:\0TIH
[text]
C:\0TIH\1a\1a.exe
C:\0TIH\2a\2a.exe
C:\0TIH\3a\3a.exe
[Games]
LComplete=1
Now the lesson here is I am trying to find out how to pass a variable to a command FileChangeDir ("$Var1") or in this
Spoiler anzeigen
#Shift-Alt-q
HotKeySet("+!q", "Close")
AutoItSetOption("ExpandEnvStrings",1)
#call startup
Start()
Func Start()
Opt("TrayIconHide",1)
$regVal = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", @ScriptName)
if $regVal = 1 OR -1 OR -2 Then
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", @ScriptName, "REG_SZ", @ScriptDir)
EndIf
Loop()
EndFunc
Func Loop()
Do
$x = WinExists ( "0aTest" )
Until $x = 1
WinSetState ( "0aTest", "", @SW_HIDE)
Password()
EndFunc
Func Password()
$Var1 = IniRead("@WindowsDir\settings.ini", "WorkDir", "Path1", "There is a problem with the .ini file")
MsgBox(4096, "Result", $var1)
$user = InputBox ( "Trouble In Heaven", "Classified. Please enter authentication credentials.","$Var1", "*" )
If $user = "" Then
MsgBox( 1, "ERROR", "authentication INVALID NOW EXITING!", 30)
Exit
If $user = "$Var1" Then
MsgBox( 1, "Accepted", "authentication credentials accepted!", 30)
FileChangeDir ( "C:\0aTest\1a" )
$file = "C:\0aTest\1a\1a.exe"
ShellExecuteWait($file)
EndIf
Else
WinClose ( "0aTest" )
MsgBox( 1, "Rejected!", "authentication INVALID NOW EXITING!", 5)
keepOpen()
EndIf
EndFunc
Func keepOpen()
Do
$x = WinExists ( "0aTest" )
Until $x = 0
Loop()
EndFunc
Func Close()
Exit 0
EndFunc
In this I am trying to pass $var1 to If $user = "$Var1" Then but unless I type in the username it will not work.
Can some one please explain to me how this works?
Many Thanks