CT83

Cannot CtrlSetData when Edit Field Variable is passed as a function Argument

11 posts in this topic

Dir_Load("Target1", "GS1_TarToday", $GS1_TarToday)
;here Target1 is a dir. and GS1_TarToday is a filename.  $GS1_TarToday is the edit box in which i want to display info set by dir_load function

Func Dir_Load($cS_Group,$cS_Name,$cVData,$cSavedPath="Configurations\Default")
Local $cCurrent_Path=String($cSavedPath&"\"&$cS_Group&"\"&$cS_Name&".ct83")
Local $cFileData
If Not _FileReadToArray($cCurrent_Path,$cFileData, 0) Then
MsgBox($MB_SYSTEMMODAL, "", "There was an error Reading the "& $cS_Group&"\"&$cS_Name &".ct83 File ! Please Try again! ")
EndIf
Local $cFileData1 = _ArrayToString($cFileData)
GUICtrlSetData($cVData,$cFileData1)
Endfunc

The above code is meant to set the data of the edit box to a file GS1_TarToday.ct83 in Target1 folder ( $cFileData1 ) but this code simply does nothing. No errors are returned. still the data of the edit box remains as it is, 

Share this post


Link to post
Share on other sites



11 minutes ago, j0kky said:

Add an error checking line after _ArrayToString call and see what happens:

if @error then consolewrite("Error: " & @error & @crlf)

 

Yip done that, Nope no errors returned and when i MsgBox the contents of variable $cFileData1 I correctly see them, in this case they are  the digits "25"

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

See the output of:

consolewrite(GUICtrlSetData($cVData,$cFileData1) & @crlf)

Anyhow, to help you, you should post the entire code, I think there is something wrong with $GS1_TarToday

Edited by j0kky
1 person likes this

Share this post


Link to post
Share on other sites

Check the contents of

$cSavedPath&"\"&$cS_Group&"\"&$cS_Name&".ct83"

Perhaps it's just full of white spaces and the edit control is being set properly.

1 person likes this

Share this post


Link to post
Share on other sites
15 minutes ago, j0kky said:

See the output of:

consolewrite(GUICtrlSetData($cVData,$cFileData1) & @crlf)

Anyhow, to help you, you should post the entire code, I think there is something wrong with $GS1_TarToday

yeah i will post the entire code in a while :) ... btw  consolewrite(GUICtrlSetData($cVData,$cFileData1) & @crlf) just returns "0" what should i be expecting?

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

16 minutes ago, j0kky said:

If it outputs 1 there was real a problem :) Now I'm quite sure the problem resides in $GS1_TarToday

Yes you are right! :):)  and as it turns out $GS1_TarToday was the variable which stored text from $S1_TarToday and not the actual edit box :(   . So all the time i was trying to set a entirely different variable.  oh i am so embarrassed. :( 

Thanks for your help! You guys are awesome! :) 

Edited by CT83

Share this post


Link to post
Share on other sites

Maybe look into better naming conventions.

$edtEdit, $sString, $aArray, etc ;)

Share this post


Link to post
Share on other sites

#10 ·  Posted

3 minutes ago, InunoTaishou said:

Maybe look into better naming conventions.

$edtEdit, $sString, $aArray, etc ;)

:) yeah i guess... newbie here o:)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • mdwerne
      SCHTASKS /CREATE with an argument?
      By mdwerne
      I'm attempting to created a windows task using SCHTASKS, but seem to have my formatting incorrect as a double quote is getting stripped out. How might I correct my code to resolve this dilemma?
      #RequireAdmin #include <AutoItConstants.au3> Global $TaskName, $sStartTime, $Program, $ProgramName, $Argument $TaskName = "MyTask" $sStartTime = "15:00" $ProgramName = "\\Server\share\myapp.exe" $Argument = " /verbose" $Program = '"' & $ProgramName & '"' & $Argument & '"' MsgBox(0, "Program with Argument", $Program) Scheduler() Func Scheduler() Local $sCmd, $sStartDate, $sDateTime, $sXtra_Parms, $Result Local $QueryTask = Run("SCHTASKS /QUERY /TN " & $TaskName, "", @SW_HIDE, $STDOUT_CHILD) Local $line = "" If @OSVersion = "WIN_VISTA" Or @OSVersion = "WIN_7" Or @OSVersion = "WIN_8" Or @OSVersion = "WIN_81" Then $sXtra_Parms = " /Z /V1" While 1 $line &= StdoutRead($QueryTask) If @error Then ExitLoop WEnd If $line = "" Then MsgBox(1, "Task Command", 'SCHTASKS /CREATE /TN ' & $TaskName & ' /TR ' & '"' & $Program & '"' & ' /ST ' & $sStartTime & ' /SC ONCE /RU SYSTEM' & $sXtra_Parms) $sCmd = 'SCHTASKS /CREATE /TN ' & $TaskName & ' /TR ' & '"' & $Program & '"' & ' /ST ' & $sStartTime & ' /SC ONCE /RU SYSTEM' & $sXtra_Parms ;$sCmd = 'SCHTASKS /CREATE /TN ' & $TaskName & ' /TR ' & $Program & ' /ST ' & $sStartTime & ' /SC ONCE /RU SYSTEM' & $sXtra_Parms Else $sCmd = 'SCHTASKS /CHANGE /TN ' & $TaskName & ' /ST ' & $sStartTime EndIf $Result = Run($sCmd, "", @SW_HIDE) If $Result > 0 Then MsgBox(64, "Success!!", "The task was successfully created.") Else MsgBox(48, "Sorry...", "There was a problem scheduling this installation, please contact the HelpDesk for assistance.") EndIf EndFunc ;==>Scheduler The task is created with the above code, except the formatting is wrong so I getting an invalid directory error upon run time.
      The above creates this command (Serversharemyapp.exe" /verbose) in the task scheduler.
      What I'm actually trying to get is ("Serversharemyapp.exe" /verbose)
      The first double quote is being stripped out using my faulty code.
      Any suggestions?
      Thanks for your time,
      -Mike
    • which1
      _WordMacroRun with argument problem
      By which1
      Hi everybody,

      Sub Bookmarks() is a VBA macro which puts... bookmarks in a Word document. Working fine from autoit with :


      _WordMacroRun($oWordApp, "Bookmarks")
      Sub Bookmarks(ByVal nbre As Integer) is quite the same macro : I just added a MsgBox for testing purpose. Still working fine from VBA, but no more from autoit with :



      _WordMacroRun($oWordApp, "Bookmarks", 2)
      I tried (rather blindly) ByVal --> ByRef and ("test", String) in place of (2, Integer) without succes.

      I'm afraid I need some help ! Thanks in advance.