Save as triggers iLogic rule before "Save as" in stead of after.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'm currently creating an iLogic rule that automaticly creates a .pdf file whenever I save my .idw drawing file. So far so good, using the normal "save" option works like a charm and it does everything its supposed to.
Now the problem is, whenever I use the "save as" function, the iLogic rule activates itself on the old filename instead of the newly created one. To describe the situation, if I want to create a revision of lets say "Example.idw" and call it "Example A.idw". As soon as I used save as to create "Example A.idw", it saves the .pdf file as the old extension ("Example.idw") instead of the newly created one.
To avoid the problem of the Event Triggers, Yes i did post my rule in the "After Save Document" section of the event triggers that's why I don't get why on save as, it saves before I saved my file.
Heres my code, included with comments on what everyting currently does.
file_path = ThisDoc.Path file_name = ThisDoc.FileName(False) file_name_path = file_path & "\" & file_name If file_path & "\" & ThisDoc.FileName(True) = (file_name_path & ".idw") Then 'Checks if the current file extension is an idw or not. Because I only have to create a pdf when my file is an idw. If System.IO.File.Exists(file_name_path & ".pdf") Then 'Checks if theres already an existing .pdf file on the current idw file. vraag=MessageBox.Show("Wilt u het bestand overschrijven?", "Opslaan in PDF",MessageBoxButtons.YesNo) 'Message box that asks if you want to overwrite the current file yes or no. If vraag = vbYes Then System.IO.File.Delete(file_name_path & ".pdf") 'Deletes the old pdf file, i couldn't find another solution to overwrite an existing pdf file. ThisDoc.Document.SaveAs(file_name_path & ".pdf", True) 'Newly saves the pdf file to have an updated version Else MessageBox.Show("Er zijn geen wijzigingen toegepast aan het PDF bestand.", "Voltooid") 'If chosen no, it just gives a messages that no changes have been made to the pdf file. End If Else 'If the system doesn't detect a pdf file it creates a pdf file and gives me a message that it created a pdf. ThisDoc.Document.SaveAs(file_name_path & ".pdf", True) MessageBox.Show("Het PDF bestand is opgeslagen", "Voltooid") End If End If
You could compare my problem to the following older thread post. But I don't see the solution to the problem in there.
I hope someone can help. Thanks!