### Creating and Starting a Timer - WLangage Example Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/TraitementDonnees/Donnees/Autres/3015007.md This example demonstrates how to create and start a timer in WLangage using the Timer function. It sets up a procedure 'Affiche_Heure' to display the current system time regularly. The timer is configured to call 'Affiche_Heure' every second. It also includes error handling if the timer creation fails. ```WLangage // Procdure permettant l'affichage rgulier de l'heure dans HEURE1 PROCEDURE Affiche_Heure() HEURE1 = HeureSys() // Traitement l'ouverture de la fentre ou de la page // Affiche_Heure sera automatiquement appele chaque seconde NumTimer est un entier NumTimer = Timer("Affiche_Heure", 100, 1) SI NumTimer = 0 ALORS Erreur("Cration du timer impossible") FIN ``` -------------------------------- ### React Application Setup with create-react-app Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Interface/Autres/9000197.md This snippet shows the command-line instructions to create a new React application using `create-react-app`, navigate into the application directory, and start the development server. The React app will be visible at `http://localhost:3000`. ```bash npx create-react-app my-app cd my-app npm start ``` -------------------------------- ### WLangage Chronometer Example Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/TraitementDonnees/Donnees/Autres/1000023789.md Demonstrates starting two chronometers, stopping them at different points, and reporting the elapsed durations. It highlights how to use Chrono.Start and Chrono.Fin to measure execution times of different code sections. ```wl MonChrono1 est un Chrono MonChrono2 est un Chrono // Dmarrage du premier chronomtre MonChrono1.Dbut() // Dmarrage du second chronomtre MonChrono2.Dbut() // Arrt premier chronomtre DureChronoDbut est une Dure = MonChrono1.Fin() MaFonction() // Arrt du second chronomtre DureMaFonction est une Dure = MonChrono2.Fin() Info("Le traitement MaFonction() a dur " + DureMaFonction, ... "Le traitement complet a dur " + DureChronoDbut) ``` -------------------------------- ### WINDEV Application Installation/Update Event Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Outils/Gestion/Projet/2030011.md This event is executed during the installation, update, or unblocking of an application. It can be used for any post-installation or update-related setup or actions required by the application. ```WINDEV // Example: Performing actions after application installation or update SetupPostInstallation() UpdateConfiguration() ``` -------------------------------- ### WL Operator (&) Usage Examples Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Langage/Operateurs/1512002.md Demonstrates the usage of the '&' operator in WL to get the memory addresses of different variable types, including simple variables, strings, arrays, and structures. It shows how to get the address of the start of a variable, specific elements of an array, or members of a structure. ```wl i est un entier z est une chane ASCIIZ sur 50 t est un tableau de 10 rels s est compos de L_Age est un entier Le_Nom est une chane ASCIIZ sur 50 FIN adr est un entier adr = & i adr = & z adr = & z + 2 // Adresse du 3me caractre de la chane adr = & t // Adresse du dbut du tableau (donc du 1er lment) adr = & t[5] // Adresse du 5me lment adr = & s // Adresse de la structure et donc de s.age adr = & s.L_Age adr = & s.Le_Nom ``` -------------------------------- ### Create Desktop (user32) Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Systeme/DLL/API/6510002.md Creates a new desktop. Parameters include desktop name, device name, device mode, flags, desired access, and security attributes. ```Wlangage API("user32", "CreateDesktopA" , &lpszDesktop, &lpszDevice, &pDevmode, dwFlags, dwDesiredAccess, &lpsa) ``` -------------------------------- ### Get Call Start Time with WLangage Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Communication/Telephonie/3076006.md This WLangage code snippet demonstrates how to get the start date and time of a phone call using the telAppelDbut function. It declares a DateHeure variable and assigns the result of the function call to it. This function is part of the wd280com.dll component and relies on TAPI 2.0 and/or TAPI 3.1. ```wl DateHeureAppel est une DateHeure DateHeureAppel = telAppelDbut() ``` -------------------------------- ### WLangage SQL Connection Example Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Documentation/Presentation/100.md Example demonstrating how to establish a connection to an SQL database using the SQLConnecte function in WLangage. This is a fundamental step for any database interaction. ```WLangage SQLConnecte("MaBase", "Utilisateur", "MotDePasse") ``` -------------------------------- ### WINDEV Telephony Example: Dialing and Call Detection Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Communication/Autres/3076009.md This example, 'WD Téléphonie', demonstrates the practical application of WINDEV's telephony functions. It covers two main aspects: programmatically dialing a phone number and detecting/identifying incoming calls. The example requires a properly installed modem and is designed to be run within the WINDEV environment. ```WINDEV // Example demonstrating dialing a phone number // Requires a configured modem and TAPI device selection // TELCOMPOSE(PhoneNumber) // Example demonstrating detection and identification of incoming calls // Requires a configured modem and TAPI device selection // TELDEMARREDETECTIONAPPEL() // Example of handling incoming call notification (caller ID) // Requires modem with caller ID feature // TELIDENTIFIANTAPPELANT() ``` -------------------------------- ### Initialisation programmée d'un champ Zone Répétée avec WLangage Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Interface/Controles/Avances/1013077.md Cet exemple montre comment initialiser un champ Zone Répétée en utilisant WLangage pour parcourir un fichier de données HFSQL et ajouter les enregistrements. Il utilise les fonctions HLitPremier, HEndehors, ZoneRépéteAjoute, et HLitSuivant. Cette méthode est déconseillée au profit de l'initialisation automatique. ```WLangage // Le champ Zone répétée ZR_REPETE1 contient 5 libellés et une image // 6 attributs permettent de modifier la valeur des libellés et l'image affichée // Initialisation de la zone répétée à partir du contenu d'un fichier de données HFSQL HLitPremier(Produit, NomProduit) TANTQUE PAS hEndehors() ZoneRépétéeAjoute(ZR_REPETE1, Produit.NomProduit + TAB + Produit.Duree + \ TAB + Produit.Realisateur + TAB + Produit.Acteur + \ TAB + Produit.Photo + TAB + Produit.Designation) HLitSuivant(Produit, NomProduit) FIN ``` -------------------------------- ### WINDEV Liste.Cherche - Counting Occurrences Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/TraitementDonnees/Donnees/Collections/1000017320.md This example demonstrates how to count all occurrences of elements starting with 'DUP' in the 'LISTE_ListeClient' field. It uses a loop to find subsequent matches by incrementing the starting index. ```wl Indice est un entier Cpt est un entier = 0 // Se positionner sur le premier lment correspondant Indice = LISTE_ListeClient.Cherche("DUP", Faux) TANTQUE Indice <> -1 Cpt++ // Recherche du nom suivant commenant par "DUP" Indice = LISTE_ListeClient.Cherche("DUP", Faux, Indice + 1) FIN ``` -------------------------------- ### Remplir un champ Liste image avec une boucle Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Interface/Controles/Liste/1013198.md Cette méthode permet d'initialiser un champ Liste image en ajoutant plusieurs éléments de manière programmatique. Elle utilise une boucle pour itérer sur une plage définie et ajouter chaque élément avec sa valeur et son image correspondante. ```WINDEV i est un entier POUR i = 1 A 52 ListeAjoute(LSI_ListeImage1, NOM[i], Image[i]) FIN ``` -------------------------------- ### Remplir un champ Liste image avec une boucle Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Interface/Controles/Liste/1013314.md Cette méthode permet d'initialiser tous les éléments d'un champ Liste image en utilisant une boucle d'itération. Elle parcourt une plage d'indices pour ajouter chaque élément avec sa valeur et son image correspondante. ```wl i est un entier POUR i = 1 A 52 LSI_ListeImage1.Ajoute(NOM[i], Image[i]) FIN ``` -------------------------------- ### WINDEV Liste.Cherche - Generic Search Example Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/TraitementDonnees/Donnees/Collections/1000017320.md This example illustrates a generic search, finding all elements in the 'LISTE_Nom' list that start with 'DUP'. The second parameter is set to Faux for a generic search. ```wl // Retourner tous les noms commenant par "DUP" LISTE_Nom.Cherche("DUP", Faux) ``` -------------------------------- ### Get Total Elements in a 1D Array - WLangage Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/TraitementDonnees/Donnees/Collections/3075005.md This example demonstrates how to get the total number of elements in a one-dimensional WLangage array using the TableauInfo function with the tiNombreTotal constant. ```WLangage // Nombre total d'éléments dans un tableau à une dimension MonTableau est un tableau de 5 entiers ... nbDim est un entier nbDim = TableauInfo(MonTableau, tiNombreTotal) // nbDim vaut 5 ``` -------------------------------- ### WINDEV: Remplir un champ Planning depuis HFSQL Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Interface/Controles/Avances/1000019505.md Remplit un champ Planning avec des données stockées dans un fichier HFSQL. Ce processus implique de parcourir le fichier de données via une boucle POUR TOUT et d'ajouter chaque enregistrement comme un rendez-vous dans le champ Planning. ```wl // Variable de type RendezVous MonRendezVous est un RendezVous // Parcours des rendez-vous mémorisés en base POUR TOUT RDV // Remplit les informations de la variable MonRendezVous.Titre = RDV.Titre MonRendezVous.Contenu = RDV.Contenu MonRendezVous.DateDébut = RDV.DateDébut MonRendezVous.DateFin = RDV.DateFin MonRendezVous.Catégorie = RDV.Catégorie MonRendezVous.ID = RDV.IDRDV // Ajoute le rendez-vous au champ Planning PlanningAjouteRendezVous(PLN_MonPlanning, MonRendezVous) FIN ``` -------------------------------- ### Get Pointer Type (WINDEV) Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/TraitementDonnees/Donnees/Autres/1000023785.md This example demonstrates how to get the pointer type using the GesteTypePointeur function and display a message if the pointer is a finger. This function is available in WINDEV and should be used within pointer-related events. ```wl nType est un entier = GesteTypePointeur() SI nType = typePointeurDoigt ALORS Info("Le pointeur utilis\u00e9 est le doigt.") ``` -------------------------------- ### Get Data File GUID - WLangage Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Proprietes/Autres/2512099.md This snippet demonstrates how to retrieve the GUID of a data file named 'Client' using the GUIDFichier property in WLangage. The GUID is then displayed using the Trace function. This property is specific to WLangage and HFSQL Classic or Client/Server data files. ```WLangage // GUID du fichier de donnes "Client" Trace(Client.GUIDFichier) ``` -------------------------------- ### Lister les drivers vidéo installés avec CaméraListeDriver Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/TraitementDonnees/Donnees/Collections/1000022457.md Cet exemple montre comment utiliser la fonction CaméraListeDriver pour obtenir la liste des drivers vidéo installés sur le système. La fonction prend en paramètre la technologie à utiliser (ici, viDirectShow) et ajoute le résultat à une liste nommée LISTE_ListeDriver. ```wl // Connaître les drivers Vidéo installés // Affichage dans la liste LISTE_ListeDriver ListeAjoute(LISTE_ListeDriver, CaméraListeDriver(viDirectShow)) ``` -------------------------------- ### Create Icon (user32) Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Systeme/DLL/API/6510002.md Creates an icon. Requires instance handle, dimensions, color planes, bits per pixel, and pointers to the AND and XOR bitmasks defining the icon's appearance. ```Wlangage API("user32", "CreateIcon" , hInstance, nWidth, nHeight, nPlanes, nBitsPixel, &lpANDbits, &lpXORbits) ``` -------------------------------- ### WLangage Date.VersJour() Example Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/TraitementDonnees/Donnees/Dates/Heures/1000024030.md This example demonstrates how to use the VersJour() function in WLangage. It shows assigning a date string to a Date variable, calling VersJour() to get the day of the week, and using it in a conditional statement. ```wl MaDate est une Date MaDate = "20011225" MaDate.VersJour() // Retourne 2 MaDate = DateSys SI MaDate.VersJour() > 5 ALORS Info("C'est le week-end") FIN ``` -------------------------------- ### Create Tape Partition (kernel32) Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Systeme/DLL/API/6510002.md Creates a partition on a tape. This function is used for managing storage on tape devices. Parameters include the tape device handle, partitioning method, number of partitions, and partition size. ```Wlangage API("kernel32", "CreateTapePartition" , hDevice, dwPartitionMethod, dwCount, dwSize) ``` -------------------------------- ### Get Previous Field Name in WL Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Interface/Autres/3025033.md This example demonstrates how to use the ChampPrécédent function in WL to get the name of the previous field. It checks if the previous field was 'SAI_CP' and, if so, populates the 'SAI_VILLE' field with the corresponding city obtained from 'CPVersVille'. ```wl SI ChampPrcdent() = SAI_CP ALORS // On rempli le nom en fonction du CP SAI_VILLE = CPVersVille(SAI_CP) FIN ``` -------------------------------- ### WINDEV TableCherche: Search for 'Chemise' in 'COL_Produit' Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/TraitementDonnees/Donnees/Autres/3074015.md This example demonstrates how to use the TableCherche function to find the element 'Chemise' within the 'COL_Produit' column, starting the search from row 5. It utilizes the 'rechercheCommencePar' (starts with) search type. ```wl // Recherche l'lment "Chemise" dans la colonne "COL_Produit" // Recherche gnrique partir de ligne 5 soit ResCherche = TableCherche(COL_Produit, "Chemise", rechercheCommencePar, 5) ``` -------------------------------- ### Ajouter une sauvegarde planifiée avec WLangage Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Autres/Donnees/General/1000022644.md Cet exemple montre comment configurer et ajouter une sauvegarde planifiée pour une connexion de base de données en utilisant la fonction AjouteSauvegardePlanifiée. Il inclut la définition des détails de la sauvegarde via hDescriptionSauvegarde et la gestion des erreurs. ```wl ConnexionBase est une Connexion ... // Cration d'une sauvegarde planifie toutes les 5 minutes // avec une sauvegarde diffrentielle toutes les minutes hSvg est une hDescriptionSauvegarde hSvg.Activ = Vrai hSvg.AvecIndex = Vrai hSvg.Description = "Sauvegarde planifie toutes les N minutes avec " + ... "une sauvegarde diffrentielle toutes les minutes sur la base " + ... ConnexionBase.BaseDeDonnes + " cre le "+ ... DateVersChane(DateSys(), maskDateSystme) + " " + ... HeureVersChane(HeureSys(), "HH:MM:SS:CC") hSvg.Destination = "Sauvegarde_" + ConnexionBase.BaseDeDonnes hSvg.LimiteNombreSauvegarde = 2 hSvg.Source = ConnexionBase.BaseDeDonnes hSvg.PlanificationComplte.Mois = "*" hSvg.PlanificationComplte.JourDuMois = "*" // Dfinition de la planification dhDateHeureServeur est une DateHeure = ConnexionBase.InfoServeur(hInfoDate) dhDateHeureServeur.Minute++ hSvg.PlanificationComplte.Heure = dhDateHeureServeur.Heure hSvg.PlanificationComplte.Minute = dhDateHeureServeur.Minute hSvg.PlanificationComplte.JourDeLaSemaine = "*" hSvg.PlanificationComplte.JourDuMoisOuDeLaSemaine = Faux hSvg.PlanificationDiffrentielle.Mois = "*" hSvg.PlanificationDiffrentielle.JourDuMois = "*" hSvg.PlanificationDiffrentielle.Heure = "*" hSvg.PlanificationDiffrentielle.Minute = "*" hSvg.PlanificationDiffrentielle.JourDeLaSemaine = "*" hSvg.PlanificationDiffrentielle.JourDuMoisOuDeLaSemaine = Faux // Ajout de la sauvegarde planifie SI ConnexionBase.AjouteSauvegardePlanifie(hSvg) = Faux ALORS Erreur("Echec de la cration de la sauvegarde planifie", ... HErreurInfo(hErrComplet)) RETOUR FIN ``` -------------------------------- ### Get HFSQL File Size using Connexion.InfoFichier (WLangage) Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Autres/Donnees/General/1000023961.md This example demonstrates how to retrieve the total size of a data file using the Connexion.InfoFichier function in WLangage. It requires a defined Connexion object with connection parameters. ```WLangage // Rcupration de la taille d'un fichier de donnes en utilisant une connexion // Paramtres de la connexion CnxTest est une Connexion CnxTest.Provider = hAccsHFClientServeur CnxTest.Utilisateur = "admin" CnxTest.MotDePasse = "pass_admin" CnxTest.Serveur = "serveur:4930" CnxTest.BaseDeDonnes = "BaseTest" Trace("Taille totale fichier Client : " + ... CnxTest.InfoFichier("NomFichier.FIC", hTailleTotale)) ``` -------------------------------- ### Ajouter une ligne SaisieAssistée à une liste de saisie assistée Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/TraitementDonnees/Donnees/Autres/1000020043.md Permet d'ajouter une ligne préconfigurée dans une liste de saisie assistée en utilisant une variable de type SaisieAssistée. Cette méthode est utile pour ajouter des données complexes ou structurées. La fonction retourne le numéro de la ligne ajoutée. ```wl // Ajout d'une ligne _sa est SaisieAssistée _sa.Libellé = "34300(Agde)" _sa.ValeurMémorisée = 343300 SaisieAssistéeAjoute(SAI_CP, _sa) // -- Evénement "Sélection d'une valeur dans la liste de saisie assistée" PROCÉDURE Sélection(MaSélection est SaisieAssistée) SAI_CP = MaSélection.ValeurMémorisée ``` -------------------------------- ### Start Transaction on Specific Connection - WLangage Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Autres/Donnees/General/1000023965.md Initiates a transaction on data files associated with a specific connection variable in WLangage. This example demonstrates starting a transaction, performing an operation, and then either validating or canceling it based on exceptions. ```WLangage MaConnexion1 est une Connexion // Dbut de la transaction sur les fichiers de donnes associs la connexion MaConnexion1 MaConnexion1.Transaction() Ajout_Commande() QUAND EXCEPTION DANS // Ajout de la commande Commande.Ajoute() // Validation de l'ajout MaConnexion1.TransactionFin() FAIRE // Suppression des lignes de commandes MaConnexion1.TransactionAnnule() FIN ``` -------------------------------- ### Configure WINDEV Execution Log via .WX File Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Outils/Autres/2019030.md This configuration example shows how to enable the WINDEV execution log without modifying application code. By creating a `.WX` file alongside the executable, you can define log activation status, file naming conventions using predefined variables, and specific logging options (e.g., tracing functions, parameters, or all information). ```INI [LOG] Actif=<0/1> Fichier= Option= ``` -------------------------------- ### Convert Date to Integer (WLangage) Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/TraitementDonnees/Donnees/Dates/Heures/3027014.md Converts a date to an integer representing the number of days elapsed. The first example calculates days from 01/01/1800. The second example uses the optional 'Vrai' parameter to calculate days from the start of the year 2004. ```wl // Nombre de jours couls entre le 01/01/1800 et le 25/12/2001 DateVersEntier("20011225") // Retourne 73773 // Nombre de jours couls entre le 01/01/1800 et le 03/01/1800 DateVersEntier("18000103") // Retourne 3 // Nombre de jours couls entre le 01/01/2004 et le 25/01/2004 DateVersEntier("20040125", Vrai) // Retourne 25 ``` -------------------------------- ### Remplir un champ Liste avec une boucle en WLangage Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Interface/Controles/Liste/1013318.md Ce code illustre comment remplir un champ Liste en itérant sur une plage de données et en ajoutant chaque élément à la liste. C'est une méthode courante pour initialiser une liste avec des données provenant d'une autre source. ```WLangage i est un entier POUR i = 1 A 52 LISTE_LISTE1.Ajoute(NOM[i]) FIN ``` -------------------------------- ### Get Screen Cursor Position (X and Y) in WLangage Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/TraitementDonnees/Donnees/Autres/3014017.md This example shows how to get the current cursor position on the client area using CurseurPos and then extract the X and Y coordinates using PoidsFaible and PoidsFort respectively. The coordinates are displayed in a message box. ```wl Res est un entier = CurseurPos(cpClient) SI Res <> -1 ALORS Message("Position X = " + PoidsFaible(Res) + "Position Y = " + PoidsFort(Res)) FIN ``` -------------------------------- ### Remplir un champ Planning avec des données HFSQL Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Interface/Controles/Avances/1000019654.md Remplit un champ Planning en parcourant un fichier HFSQL. Pour chaque enregistrement du fichier, les données sont assignées à une variable de type RendezVous, puis ajoutées au champ Planning à l'aide de la fonction AjouteRendezVous. ```wl // Variable de type RendezVous MonRendezVous est un RendezVous // Parcours des rendez-vous mémorisés en base POUR TOUT RDV // Remplit les informations de la variable MonRendezVous.Titre = RDV.Titre MonRendezVous.Contenu = RDV.Contenu MonRendezVous.DateDébut = RDV.DateDébut MonRendezVous.DateFin = RDV.DateFin MonRendezVous.Catégorie = RDV.Catégorie MonRendezVous.ID = RDV.IDRDV // Ajoute le rendez-vous au champ Planning PLN_MonPlanning.RendezVous(MonRendezVous) FIN ``` -------------------------------- ### Create Metafile (gdi32) Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Systeme/DLL/API/6510002.md Creates a metafile device context. This allows recording drawing commands that can be played back. Requires a string pointer for the metafile name. ```Wlangage API("gdi32", "CreateMetaFileA" , &lpString) ``` -------------------------------- ### WLangage Array Copy with Start Position and Size Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/TraitementDonnees/Donnees/Collections/3075004.md Illustrates advanced array copying in WLangage, allowing specification of the starting position and the number of elements to copy. This example shows how to copy a subset of elements from an integer array into new arrays. ```wl tabT1 est un tableau d'entiers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] // On copie les 3 premiers éléments de tabT1 dans tabT2 tabT2 est un tableau d'entiers TableauCopie(tabT1, tabT2, 1, 3) // [1, 2, 3] // On copie 4 entiers à partir de la position 4 tabT3 est un tableau d'entiers TableauCopie(tabT1, tabT3, 4, 4) // [4, 5, 6, 7] // On copie la fin du tableau à partir de la position 6 tabT4 est un tableau d'entiers TableauCopie(tabT1, tabT4, 6) // [7, 8, 9, 10] ``` -------------------------------- ### Get Parent XML Tag Name with XMLNomParent (WLangage) Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Web/XML/3081035.md This example demonstrates how to use the XMLNomParent function to get the name of the parent tag of the current XML element. It includes error handling to check if an element is currently selected. ```wl NomBalise est une chane NomBalise = XMLNomParent("DocXML") // Positionn sur une balise ? SI NomBalise = "" ALORS Erreur(ErreurInfo()) SINON Info("Le nom de la balise parente est : " + NomBalise) FIN // Autre possibilit // Positionn sur une balise ? SI ErreurDtecte = Vrai ALORS Erreur(ErreurInfo()) SINON Info("Le nom de la balise parente est : " + NomBalise) FIN ``` -------------------------------- ### WLangage: Procedure Call Example Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Proprietes/Autres/1000020878.md Example demonstrating how to chain procedure calls for an event and how to interrupt the chain using DonneFocusEtRetourUtilisateur. ```WLangage // Clic sur BTN_Bouton1 BTN_Bouton1.Traitement[trtClic] += MaProc1 BTN_Bouton1.Traitement[trtClic] += MaProc2 ``` ```WLangage // Clic sur BTN_Bouton1 Trace("Clic sur Bouton 1") ``` ```WLangage PROCEDURE MaProc1() Trace(dbgInfo(dbgTraitement)) DonneFocusEtRetourUtilisateur(MoiMme.Nom) ``` ```WLangage PROCEDURE MaProc2() Trace(dbgInfo(dbgTraitement)) ``` -------------------------------- ### Get Current Track with MCIPiste Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/TraitementDonnees/Donnees/Autres/3051016.md This example demonstrates how to open a CD audio device, retrieve the current track using MCIPiste, display it, and then close the device. It highlights the basic usage flow for accessing track information. ```wl MCIOuvre("cdaudio", "cd") ... Info("Piste courante : " + MCIPiste("cd")) ... MCIFerme("cd") ``` -------------------------------- ### Saisie assistée programmée avec WLangage Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Interface/Saisie/1000024066.md Implémentation de la saisie assistée programmée en WLangage. Cette méthode permet de manipuler une source de données personnalisée en utilisant les fonctions SaisieAssistée pour vider, ajouter des éléments et ouvrir la liste des propositions. ```WLangage // Recherche de type "contient" dans le nom // et le code d'un tableau d'actions boursires POUR TOUT sNom, sCode de gTabAction SI Contient(sCode, sValeurRecherche) _OU_ ... Contient(sNom, sValeurRecherche) ALORS SAI_Mode_programm.AjouteSaisieAssiste(sNom) FIN FIN ``` -------------------------------- ### Get Upload File Size and Convert to KB Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Systeme/Fichiers/Proprietes/1000019035.md This example demonstrates how to use the UploadTailleFichier function to get the total file size in bytes, convert it to kilobytes, and display it with 'Ko'. It assumes a file upload field named 'MoiMême' with an index of 1. ```wl // Affiche la taille totale du fichier en Ko LIB_TailleTotaleFichier = Arrondi(UploadTailleFichier(MoiMême, 1) / 1024, 0) + "Ko" ``` -------------------------------- ### WLangage: Window Initialization for Vision Plus Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Interface/Fenetres/2031029.md This code snippet sets up the initial state of a Vision Plus window. It displays the table, positioning it on the first current record, and sets a default return value of 'False' for the window. This ensures the table is populated correctly upon opening and provides a default state for operations. ```WLangage // Positionnement sur l'enregistrement courant TableAffiche(TABLE_RADFichierA, taCourantPremier) // Valeur de retour par défaut MaFenêtre.ValeurRenvoyée = Faux ``` -------------------------------- ### Exemple d'utilisation de ServeurAppliListeTâchePlanifiée Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Systeme/Autres/1000022352.md Cet exemple montre comment parcourir la liste des tâches planifiées retournées par ServeurAppliListeTâchePlanifiée et afficher le nom de chaque tâche. La fonction retourne un tableau de tâches, qui est ensuite itéré pour accéder à la propriété 'Nom'. ```wl POUR TOUT UneTâchePlanifiée de ServeurAppliListeTâchePlanifiée() Trace(UneTâchePlanifiée.Nom) FIN ``` -------------------------------- ### Get Start Date of Displayed Period in Report (WLangage) Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Proprietes/Autres/1000020183.md This code snippet demonstrates how to retrieve and use the DateDébutPériodeAffichée property to construct a report header label showing the week's start date. It's used in WLangage for report generation. ```wl // Traitement avant impression du bloc d'entête PLN_MonPlanning.LibellePériodeEntête = ... "Semaine du" + DateVersChaîne(PLN_MonPlanning.DateDébutPériodeAffichée) + ... "au" + DateVersChaîne(PLN_MonPlanning.DateFinPériodeAffichée) ``` -------------------------------- ### Create Device Context (gdi32) Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Systeme/DLL/API/6510002.md Creates a device context (DC) for a specified driver, device, and output. It takes pointers to driver name, device name, output, and initialization data. ```Wlangage API("gdi32", "CreateDCA" , &lpDriverName, &lpDeviceName, &lpOutput, &lpInitData) ``` -------------------------------- ### Get Running Excel Application Object - WL Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Communication/Autres/3057006.md This example demonstrates how to use the ObjetActif function to get a handle to an already running Excel application. If Excel is not running, it shows how to allocate a new instance. This function is useful for controlling existing applications from WINDEV. ```wl Excel est un objet Automation dynamique // Si Excel est dj lanc, utilisation de ce programme Excel = ObjetActif("Excel.Application") SI Excel = NULL ALORS // On lance Excel Excel = allouer un objet Automation "Excel.Application" ... FIN ``` -------------------------------- ### WLangage: Get Character Type with CaractType Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/TraitementDonnees/Donnees/Autres/1000019895.md Demonstrates how to use the CaractType function to determine the type of a character. It shows examples of checking if a character is a letter, accented, or a combination of types. It also includes an example of verifying if a character is a letter using ETBinaire. ```wl CaractType("A") // la fonction renvoie ctLettre|ctMajuscule CaractType("") // la fonction renvoie ctLettre|ctMinuscule|ctAccent // Vrifie si un caractre est une lettre SI ETBinaire(CaractType("c"), ctLettre) <> 0 Alors Trace("Ce caractre est une lettre") FIN ``` -------------------------------- ### Execute Python Function - Wlangage Example Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Multimedia/Autres/1410088102.md This Wlangage code demonstrates how to initialize the Python interpreter, set the module path, and execute a Python function using PythonExecute. It includes error handling for initialization and path setting, and shows how to import and call functions from both imported and non-imported Python files. ```Wlangage sModulePython est une chane // Exemple d'emplacement du module Python // Le nom du module Python peut tre diffrent sModulePython = SysRep(srAppDataLocal) + .. [fSep]+"Programs\Python\Python39\python39.dll" // Exemple d'emplacement du module Python // Le nom du module Python peut tre diffrent // (dpend de la version de Python, de la distribution Linux) sModulePython ="/usr/bin/python/python39.so" SI PAS PythonInitialise(sModulePython) ALORS // Il faut dans ce cas : // Vrifier le chemin // Vrifier que le mode de compilation (32/64 bits) correspond au mode d'excution Erreur("Echec de l'initialisation de Python", ErreurInfo()) RETOUR FIN Info(FonctionPythonImporteeHelloWorld()) // Avec un fichier Python import (.py) dans le projet qui contient : // def FonctionPythonImporteeHelloWorld(): // return "Hello World !"; SI PAS PythonAjouteChemin(fRepDonnes()) ALORS Erreur("Echec de l'initialisation d'un chemin Python", ErreurInfo()) RETOUR FIN // Le fichier Python "fichier_python.py" doit tre prsent dans le rpertoire // spcifi par la fonction PythonAjouteChemin. // Dans cet exemple, ce rpertoire correspond au rpertoire des donnes Info(PythonExcute("fichier_python", "FonctionPythonHelloWorldNonImportee")) PythonTermine() ``` -------------------------------- ### Basic Drawing Initialization and Text Rendering (WLangage) Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/TraitementDonnees/Donnees/Autres/1000024326.md This WLangage example shows the initialization of drawing on 'IMG_Image1' using DébutDessin, followed by setting a font and drawing text onto the image field. This illustrates a common workflow for adding text to an image dynamically. ```WLangage IMG_Image1.DébutDessin() IMG_Image1.Police("Arial", 12, iNormal, 0) IMG_Image1.DessineTexte(4, 0, "J'écris mon texte dans un champ Image !") ``` -------------------------------- ### Get Menu Option State - WLangage Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/TraitementDonnees/Donnees/Autres/3038003.md This example demonstrates how to use the MenuEtat function in WLangage to get the current state of a menu option named 'OPT_BarreIcone'. The result is stored in the 'ResEtat' variable. The function can optionally take a window name as the first parameter. ```WLangage // Etat de l'option "OPT_BarreIcone" ResEtat = MenuEtat(OPT_BarreIcone) ``` -------------------------------- ### WLangage: Get Selected Column Number in Table Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/TraitementDonnees/Donnees/Autres/1000019381.md This example demonstrates how to use TableColonneSelectOccurrence and TableColonneSelect to retrieve the numbers of all selected columns in a WLangage table. It first gets the total count of selected columns and then iterates through them to print each selected column's number. ```WLangage NbColSlection est entier NumCol est entier NbColSlection = TableColonneSelectOccurrence(TABLE_TABLE1) Trace("TableColonneSelectOccurrence() = " + NbColSlection) POUR i = 1 A NbColSlection NumCol = TableColonneSelect(TABLE_TABLE1,i) Trace("La colonne " + NumCol + " est slectionne") FIN ``` -------------------------------- ### Afficher un site dans une frame spécifique (WLangage) Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Systeme/Autres/3055006.md Affiche un site Internet dans une frame spécifique d'un site WEBDEV. Le nom de la frame est passé comme second argument à la fonction NavigateurOuvre. ```txt NavigateurOuvre("http://www.pcsoft.fr", ) ``` -------------------------------- ### Create Process (kernel32) Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Systeme/DLL/API/6510002.md Creates a new process and its primary thread. This function is used to launch new applications. Parameters include application name, command line, process and thread attributes, handle inheritance flags, creation flags, environment block, current directory, and startup info. ```Wlangage API("kernel32", "CreateProcessA" , &lpApplicationName, &lpCommandLine, &lpProcessAttributes, &lpThreadAttributes, bInheritHandles, dwCreationFlags, &lpEnvironment, &lpCurrentDriectory, &lpStartupInfo, &lpProcessInformation) ``` ```Wlangage API("kernel32", "CreateProcessAsUserA" , hToken, &lpApplicationName, &lpCommandLine, &lpProcessAttributes, &lpThreadAttributes, bInheritHandles, dwCreationFlags, &lpEnvironment, &lpCurrentDirectory, &lpStartupInfo, &lpProcessInformation) ``` -------------------------------- ### Get Pane Name - WLangage Example Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Interface/Autres/1000021625.md This WLangage code snippet demonstrates how to use the VoletDuChamp function to get the name of the pane associated with a button and then set its caption. It's typically used within event handlers like a button's click event. ```wl // Clic sur bouton "BTN _Nouveau" MonVolet est un Champ MonVolet <- VoletDuChamp(MoiMême) MonVolet.Libellé = "Nouveau document.txt" ``` -------------------------------- ### WINDEV: Ajouter un rendez-vous à un champ Planning (Syntaxe 1) Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Interface/Controles/Avances/1000019505.md Ajoute un rendez-vous à un champ Planning en spécifiant directement ses caractéristiques comme le titre, la description et les dates de début et de fin. Cette méthode est utile pour des ajouts rapides de rendez-vous. ```wl // Ajoute un rendez-vous d'1 heure pour ce soir MaRessource est une chaîne MonTitre est une chaîne DébutRDV est un DateHeure MaRessource = "Françoise" MonTitre = "Réunion commerciale" DébutRDV = DateSys() + "17000000" PlanningAjouteRendezVous(PLN_Planning, MaRessource, MonTitre, DébutRDV) ``` -------------------------------- ### WINDEV: Ajouter une ressource à un champ Planning Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Interface/Controles/Avances/1000019505.md Ajoute une ressource à un champ Planning en utilisant la fonction PlanningAjouteRessource. Cette fonction permet d'ajouter des personnes ou des salles comme ressources. Elle peut également intégrer des images dans le titre de la ressource. ```wl // Ajoute des ressources dans un champ Planning PlanningAjouteRessource(PLN_Planning1, "Florence" + gValeurMémorisée("FP")) PlanningAjouteRessource(PLN_Planning1, "Emma" + gValeurMémorisée("EM")) PlanningAjouteRessource(PLN_Planning1, "Frédéric" + gValeurMémorisée("FR")) ``` -------------------------------- ### Get Tree Element Info using ArbreInfoXY Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/TraitementDonnees/Donnees/Autres/3018026.md This example demonstrates how to use the ArbreInfoXY function to get the line number and branch name of a Tree control element at a specific click position. It first gets the X and Y coordinates from the cursor position, then calls ArbreInfoXY with different information types (aiNumLigne and aiNomBranche) to retrieve the data. The retrieved information is then logged using the Trace function. ```WLangage // -- Clic sur le champ Arbre ARBRE_Arbre1 X, Y sont des entiers X = PoidsFaible(CurseurPos()) Y = PoidsFort(CurseurPos()) // Recherche du numro de la ligne correspondant au clic LigneClic est un entier LigneClic = ArbreInfoXY(ARBRE_Arbre1, aiNumLigne + aiOrigineEcran, X, Y) // Recherche du nom de la branche Branche est une chane Branche = ArbreInfoXY(ARBRE_Arbre1, aiNomBranche + aiOrigineEcran, X, Y) Trace("Vous avez cliqu sur la branche " + ... Branche + "(ligne n" + LigneClic + ")") ``` -------------------------------- ### Ajouter des ressources à un champ Planning Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Interface/Controles/Avances/1000019654.md Utilise la fonction AjouteRessource pour ajouter des ressources (personnes, salles, etc.) à un champ Planning. La fonction gValeurMémorisée peut être utilisée pour proposer des ressources affichées et programmées. ```wl // Ajoute des ressources dans un champ Planning PLN_Planning1.AjouteRessource("Florence" + gValeurMémorisée("FP")) PLN_Planning1.AjouteRessource("Emma" + gValeurMémorisée("EM")) PLN_Planning1.AjouteRessource("Frédéric" + gValeurMémorisée("FR")) ``` -------------------------------- ### List Events from a Specific Time in TimeLine Field Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/TraitementDonnees/Donnees/Collections/1000020779.md This example shows how to list events from a TimeLine field starting from a specific time point. It retrieves events associated with 'Automate 1' that occur after time 70 and logs their start time, end time, and title to the trace output. ```wl // Liste les vnements partir d'un moment tabEvt est un tableau de EvnementTimeline tabEvt = TL_Automates.ListeEvnement("Automate 1", 70) POUR TOUT gMonEvnement DE tabEvt Trace(gMonEvnement.Dbut, gMonEvnement.Fin, gMonEvnement.Titre) FIN ``` -------------------------------- ### WLangage: Asynchronously get HTML editor selection Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/TraitementDonnees/Donnees/Autres/1000025992.md This WLangage code snippet demonstrates how to use `EditeurHTMLRcupreSlection` to get the selected text in an HTML editor. It includes a callback procedure to process the selection, disabling a button if the selection does not start with 'https:\'. This is useful for conditional UI updates based on user input. ```WLangage // Grise ou non le bouton Ouvrir selon la slection EditeurHTMLRcupreSlection(EDHTML_MonEditeurHTML, EditeurHTMLRcupreSlection_Callback) PROCEDURE INTERNE EditeurHTMLRcupreSlection_Callback(Slection est un edtHTMLSlection) BTN_Ouvrir.Gris = PAS Gauche(slection.Texte, "https:\\") FIN ``` -------------------------------- ### Create Directory (kernel32) Source: https://github.com/asshole-driven-dev/wlangage-bible-for-ai/blob/main/Systeme/DLL/API/6510002.md Creates a new directory. This function allows specifying the path name and security attributes for the new directory. An extended version also allows for a template directory. ```Wlangage API("kernel32", "CreateDirectoryA" , &lpPathName, &lpSecurityAttributes) ``` ```Wlangage API("kernel32", "CreateDirectoryExA" , &lpTemplateDirectory, &lpNewDirectory, &lpSecurityAttributes) ```