Shravani Posted April 10, 2018 Posted April 10, 2018 (edited) Hi everyone, Iam very new to scripting... I have written a script to create the table from existing database to other existing database. the script works fine when the data base is hardcoded but when use fileopendialog to select the database the script doesnot function could naot able to understand where iam going wrong. Here is my script, I would be great support if i get any help. #AutoIt3Wrapper_UseX64=N #include "MS_AccessDB1.au3" Const $conDbFile1 = "RHD_system_run_3_2610.mdb" ; Const $conDbFile2 = "Template1.mdb" ; $surveyname= "_RHD_system_run_3_2610" $o_Database1 = MS_AccessDatabaseConnect(@ScriptDir & "\" & $conDbFile1) If $o_Database1 = 0 Then MsgBox(16, "Error", "Database File is not found " & @error & @LF & @ScriptDir & "\" & $conDbFile1) Else ;MsgBox(0, "", "found DB1") ;Exit EndIf $o_Database2 = MS_AccessDatabaseConnect(@ScriptDir & "\" & $conDbFile2) If $o_Database2 = 0 Then MsgBox(16, "Error", "Database File is not found " & @LF & @ScriptDir & "\" & $conDbFile2) Else ;MsgBox(0, "", "found DB2") ;Exit EndIf CreateMissingTablesAndColumns($o_Database1,$o_Database2,$surveyname) CreateMissingTablesAndColumns($o_Database2,$o_Database1,$surveyname) MS_AccessDatabaseDisconnect($o_Database1) MS_AccessDatabaseDisconnect($o_Database2) Edited April 10, 2018 by Melba23 Added code tags
Moderators Melba23 Posted April 10, 2018 Moderators Posted April 10, 2018 (edited) Shravani, As explained in the Help file, a successful call to FileOpenDialog changes the @WorkingDir and I imagine that is the cause of your problems. So either save and reset @WorkingDir (preferable) or hardcode the paths that might be affected. M23 P.S When you post code please use Code tags - see here how to do it. Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. Edited April 10, 2018 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now