Jump to content

Recommended Posts

Posted

Hello, please tell me what could be the problem when reading data from ComboBox to the family location from GUICtrlSetData, it always returns the number 7. I have already tried all the functions, they all give the number 7,  I can't figure out what the problem is:

Global $Form1 = GUICreate("Оформление заявки на топливозаправщик", 435, 438, 301, 154)
$Combo1 = GUICtrlCreateCombo("Водитель", 232, 248, 185, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData($Combo1,"Ефименко|Финк")
Local $tInfo,$Combo1
GUISetState(@SW_SHOW)

$oWord = _Word_Create(True,False)
$oDocTemp=_Word_DocOpen($oWord, @ScriptDir&'\Документ Microsoft Word (2).docx') ;
WinActivate("Документ Microsoft Word (2).docx - Word")
Sleep(500)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Combo1
If _GUICtrlComboBox_GetComboBoxInfo($Combo1,$tInfo) Then
_Word_DocFindReplace($oDocTemp, "111",$Combo1)
EndIf
EndSwitch
WEnd

  • Developers
Posted (edited)

What with these quoted posts without any extra info? Just be patient in case this is your way of bumping the thread and stop doing it.

(Redundant posts removed)

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted
2 hours ago, Jos said:

What with these quoted posts without any extra info? Just be patient in case this is your way of bumping the thread and stop doing it.

(Redundant posts removed)

Sorry for that I'm not American I was just trying to edit my original post but my English isn't very good so I messed up and couldn't delete it.

Posted (edited)

Welcome.  So here a few hints that you should consider before asking for help :

1- When you post code, use the method shown in the link
2- Translate your code into english so we can more easily understand the goal of the script
3- Indent your code properly to make it readable (use tidy : Ctrl+t)
4- Make sure that the script is runnable by itself, in your case all the #include were missing
5- When your code contains references to file (.docx in your case), add an example of the files in your post

The problem in your code is that line :

_Word_DocFindReplace($oDocTemp, "111",$Combo1)

You should modify it like this :

_Word_DocFindReplace($oDocTemp, "111", GUICtrlRead($Combo1))

ps. you have declared $Combo1 after its usage, not a good idea.  Always use this line after the #include, it will save you lot of bugs easily detectible with it :

Opt("MustDeclareVars", True)

 

Edited by Nine
Posted
7 hours ago, Nine said:

Welcome.  So here a few hints that you should consider before asking for help :

1- When you post code, use the method shown in the link
2- Translate your code into english so we can more easily understand the goal of the script
3- Indent your code properly to make it readable (use tidy : Ctrl+t)
4- Make sure that the script is runnable by itself, in your case all the #include were missing
5- When your code contains references to file (.docx in your case), add an example of the files in your post

The problem in your code is that line :

_Word_DocFindReplace($oDocTemp, "111",$Combo1)

You should modify it like this :

_Word_DocFindReplace($oDocTemp, "111", GUICtrlRead($Combo1))

ps. you have declared $Combo1 after its usage, not a good idea.  Always use this line after the #include, it will save you lot of bugs easily detectible with it :

Opt("MustDeclareVars", True)

 

Thank you, you helped a lot!

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...