Jump to content

Tigerweld

Active Members
  • Posts

    102
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Tigerweld's Achievements

Adventurer

Adventurer (3/7)

0

Reputation

  1. thanks spudw2k. That works great!
  2. I have a csv file I need to format column A and G as number and save the change and I need to add this to a scheduled task on a server so I need to be able to do this without someone having to do this manually. I've looked around and came up with this, but something tells me I'm way off. #include <Excel.au3> $oExcel = _Excel_Open() $oExcel.Range("A1").Select $oWorkbook = "c:\temp\Cards.csv" $oExcel.Selection.NumberFormat = "$#,##0.00"
  3. C:\scripts>ECHO OFF ERROR: The system was unable to find the specified registry key or value. ERROR: Invalid syntax. Type "REG ADD /?" for usage. C:\scripts> I assume the error is because of the HKLM read. ECHO OFF REM Retrieve Logged on User's Session ID REM and from this get the ip address assoc with this session ID REM set ip in a reg value for autoit to read REM REM SETLOCAL SET MY_SESSION_ID =unknown SET CLIENTIP =unknown REM retrieve session id of logged on user FOR /f "tokens=3-4" %%a IN ('query session %username%') DO @if "%%b"=="Active" SET MY_SESSION_ID=%%a REM using session id lets retrieve the ip of the client FOR /f "tokens=2*" %%a IN ('Reg Query HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\Ica\Session\%MY_SESSION_ID%\Connection /v ClientAddress') DO SET "CLIENTIP=%%~b" REM write ip address back to registry so AutoIt script can read it for continuation REG ADD "HKCU\Software\M&I Data Services\TellerInsight\DEFAULT\DS" /f /v ClientIP /t REG_SZ /d %CLIENTIP% exit /B %EXIT_CODE%
  4. Just the simple line of RunWait(@Comspec & ' /c "C:\Scripts\TellInsight.bat"', '') will not run the batch file. I see the batch file open and close and it appears there may be a problem, but I can't read it quick enough. It closes too quick. Is there another way to run a batch file?
  5. that doesn't work either.
  6. batch code is SETLOCAL SET MY_SESSION_ID =unknown SET CLIENTIP =unknown REM retrieve session id of logged on user FOR /f "tokens=3-4" %%a IN ('query session %username%') DO @if "%%b"=="Active" SET MY_SESSION_ID=%%a REM using session id lets retrieve the ip of the client FOR /f "tokens=2*" %%a IN ('Reg Query HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\Ica\Session\%MY_SESSION_ID%\Connection /v ClientAddress') DO SET "CLIENTIP=%%~b" REM write ip address back to registry so AutoIt script can read it for continuation REG ADD "HKCU\Software\M&I Data Services\TellerInsight\DEFAULT\DS" /f /v ClientIP /t REG_SZ /d %CLIENTIP% exit /B %EXIT_CODE%
  7. Tried #RequreAdmin and got same result.
  8. I tried RunWait(@Comspec & ' /c "C:\Scripts\TellInsight.bat"', '', @SW_HIDE) but got the same result,
  9. My batch file runs fine, but when I try running it from AutoIt it fails to write to the registry. ShellExecuteWait( "c:\scripts\TellerInsight.bat", "", "c:\scripts") Local $ipAddress = RegRead("HKCU\SOFTWARE\M&I Data Services\TellerInsight\DEFAULT\DS", "ClientIP") MsgBox(1, "client ip", "client ip is: " & $ipAddress)
  10. that works, but I cannot use it within an IF statement. Is that by design?
  11. I have a simple msgbox function that I need to use in multiple places, but have different outcomes. For example, in one location if the left button was pressed I need it to write a one of the reg values. How do I accomplish this? #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Local $reg0 = RegWrite("HKLM\SOFTWARE\Wow6432Node\Newton\Default\Servers", "WRKSTN_ID", "REG_DWORD", "0") Local $reg1 = RegWrite("HKLM\SOFTWARE\Wow6432Node\Newton\Default\Servers", "WRKSTN_ID", "REG_DWORD", "1") Local $reg2 = RegWrite("HKLM\SOFTWARE\Wow6432Node\Newton\Default\Servers", "WRKSTN_ID", "REG_DWORD", "2") Local $reg3 = RegWrite("HKLM\SOFTWARE\Wow6432Node\Newton\Default\Servers", "WRKSTN_ID", "REG_DWORD", "3") Local $reg4 = RegWrite("HKLM\SOFTWARE\Wow6432Node\Newton\Default\Servers", "WRKSTN_ID", "REG_DWORD", "4") MainGUI() Func MainGUI() Local $Left, $Right, $msg GUICreate("Light") Opt("GUICoordMode", 2) $Left = GUICtrlCreateButton("Left", 10, 30, 50) $Right = GUICtrlCreateButton("Right", 0, -1) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Left ; write reg value Case $msg = $Right ; write reg value EndSelect WEnd EndFunc
  12. no, unfortunately its coming up blank. thanks though.
  13. so there is no way of obtaining the id?
  14. I think I'm closer, but its giving me zero when I know the id is 1. $MY_SESSION_ID = RunWait(@ComSpec & 'for /f "tokens=3-4" %a in (''query session %username%'') do @if "%b"=="Active" set MY_SESSION_ID=%a', @SystemDir) MsgBox(1, "My Session ID", "Session ID is: " & $MY_SESSION_ID)
  15. I'm not trying to get process id, I'm trying to get the id of the user's session. This works in a batch file, but I want to use it in Autoit.
×
×
  • Create New...